3 # list a files libraries
5 LD_TRACE_LOADED_OBJECTS=1 /lib/ld-linux-x86-64.so.2
12 while getopts avs arg; do
18 ?) printf 'usage: zpm-preserve [-av] <pkgname>\n'
26 pacman -Qlq "$pkgname" | while read file; do
27 if [ ! -f "$file" ]; then continue; fi
28 base=$(basename "$file")
29 if [ $all -eq 0 ] && [ "$base" = "${base#lib}" ]; then continue; fi
31 if [ $check -eq 1 ]; then
34 if [ $rv -ne 0 ]; then continue; fi
35 for lib in $(zpm getlibs $file | grep preserve); do
36 echo $pkgname $file $lib
41 soname=$(soname $file)
42 if [ $? -eq 0 ] && [ -n "$soname" ]; then
43 dir=$(dirname "$file")
44 if [ "$script" -ne 0 ]; then
45 printf 'mkdir -p "%s"\n' "$dir/preserve"
46 printf 'ln -f "%s" "%s"\n' "$file" "$dir/preserve/"
48 mkdir -p "$dir/preserve"
49 if [ "$verbose" -gt 0 ]; then
50 printf '# preserving %s\n' "$file"
52 ln -f "$file" "$dir/preserve/"