3 # preserve a packages libraries
10 while getopts avs arg; do
16 ?) printf 'usage: zpm-preserve [-av] <pkgname>\n'
24 pacman -Qlq "$pkgname" | while read file; do
25 if [ ! -f "$file" ]; then continue; fi
26 base=$(basename "$file")
27 if [ $all -eq 0 ] && [ "$base" = "${base#lib}" ]; then continue; fi
29 if [ $check -eq 1 ]; then
32 if [ $rv -ne 0 ]; then continue; fi
33 for lib in $(zpm getlibs $file | grep preserve); do
34 echo $pkgname $file $lib
39 soname=$(zpm soname $file)
40 if [ $? -eq 0 ] && [ -n "$soname" ]; then
41 dir=$(dirname "$file")
42 if [ "$script" -ne 0 ]; then
43 printf 'mkdir -p "%s"\n' "$dir/preserve"
44 printf 'ln -f "%s" "%s"\n' "$file" "$dir/preserve/"
46 mkdir -p "$dir/preserve"
47 if [ "$verbose" -gt 0 ]; then
48 printf '# preserving %s\n' "$file"
50 ln -f "$file" "$dir/preserve/"