42 lines
1.3 KiB
Bash
Executable File
42 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
package="$1"
|
|
|
|
base_dir="$(dirname "$(realpath -s "$0")")"
|
|
package_dir=""
|
|
|
|
function get_rpm_property() {
|
|
package="$1"
|
|
property="$2"
|
|
|
|
echo $(rpm -qi $package | grep "$property" | sed "s|.*: ||")
|
|
}
|
|
|
|
rpm -q $package &>/dev/null
|
|
[[ $? != 0 ]] && exit $?
|
|
|
|
package_name="$(get_rpm_property "$package" "Name")"
|
|
package_version="$(get_rpm_property "$package" "Version")-$(get_rpm_property "$package" "Release")~$(get_rpm_property "$package" "Architecture")"
|
|
|
|
rm -rf "$base_dir/$package_name/$package_version"
|
|
mkdir -p "$base_dir/$package_name/$package_version"
|
|
|
|
rpm -ql $package_name | \
|
|
while read i
|
|
do
|
|
copy="true"
|
|
system_path="$i"
|
|
copied_dir="$(dirname $system_path | sed "s|/*||")"
|
|
copied_filename="$(basename "$system_path")"
|
|
|
|
[[ ! -f "$system_path" ]] && copy="false"
|
|
[[ -d "$system_path" ]] && copy="false"
|
|
[[ "$system_path" == "/usr/lib/.build-id"* ]] && copy=$false
|
|
|
|
if [[ $copy == "true" ]]; then
|
|
mkdir -p "$base_dir/$package_name/$package_version/$copied_dir"
|
|
cp -f "$system_path" "$base_dir/$package_name/$package_version/$copied_dir/$copied_filename"
|
|
echo "[\"../../../lfs/binaries/fedora/$package_name/$package_version/$copied_dir/$copied_filename\", \"$system_path\"],"
|
|
fi
|
|
done
|