pthbs-link (492B)
1 #!/bin/sh -e 2 test -d "$1" || exit 1 3 test -d "$2" || exit 1 4 while IFS= read -r line; do 5 target=${line% *} 6 source=${line#* } 7 target=$1/${target#./} 8 source=$2/${source#./} 9 if test -e "$source"; then 10 printf >&2 'FATAL: link source already exists: "%s"\n' "$source" 11 ls >&2 -l "$source" 12 exit 1 13 fi 14 if ! test -e "$target"; then 15 printf >&2 'FATAL: link target does not exists: "%s"\n' "$target" 16 exit 1 17 fi 18 mkdir -p "${source%/*}" 19 ln -s "$target" "$source" 20 done <"$1/.install-links"