pthbs-link (606B)
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 'error in: "%s" "%s" "%s"\n' "$0" "$1" "$2" 11 printf >&2 'FATAL: link source already exists: "%s"\n' "$source" 12 ls >&2 -l "$source" 13 exit 1 14 fi 15 if ! test -e "$target"; then 16 printf >&2 'error in: "%s" "%s" "%s"\n' "$0" "$1" "$2" 17 printf >&2 'FATAL: link target does not exists: "%s"\n' "$target" 18 exit 1 19 fi 20 mkdir -p "${source%/*}" 21 ln -s "$target" "$source" 22 done <"$1/.install-links"