cookutils rev 1050

cook: fix(): add `fix symlinks` function (for "glusterfs" package, and maybe some other)
author Aleksej Bobylev <al.bobylev@gmail.com>
date Fri Apr 20 13:55:27 2018 +0300 (2018-04-20)
parents 251a9d5b7542
children ab62aac645d4
files cook
line diff
     1.1 --- a/cook	Thu Apr 19 17:43:31 2018 +0300
     1.2 +++ b/cook	Fri Apr 20 13:55:27 2018 +0300
     1.3 @@ -560,6 +560,23 @@
     1.4  				s|std::isnormal|__builtin_isnormal|g
     1.5  				' '{}' \;
     1.6  			;;
     1.7 +		symlinks)
     1.8 +			# make absolute symlinks relative
     1.9 +			echo "fix symlinks"
    1.10 +			local ifs="$IFS" link target
    1.11 +			IFS=$'\n'
    1.12 +			# step 1: fast job, prefix all the absolute symlinks with "$install"
    1.13 +			for link in $(find $install -type l); do
    1.14 +				target="$(readlink $link)"
    1.15 +				case "$target" in
    1.16 +					/*) ln -sfv "$install$target" "$link";;
    1.17 +				esac
    1.18 +			done
    1.19 +			IFS="$ifs"
    1.20 +			# step 2: fine tuning, make symlinks relative
    1.21 +			tazpkg -gi --quiet --local --cookmode symlinks
    1.22 +			symlinks -cr $install
    1.23 +			;;
    1.24  	esac
    1.25  }
    1.26