From: Mark Wooding Date: Tue, 25 Jun 2013 20:02:36 +0000 (+0100) Subject: mklinks.in: Allow `TARGET=SOURCE' renamings in `.links' files. X-Git-Tag: 1.3.11~9 X-Git-Url: https://git.distorted.org.uk/~mdw/cfd/commitdiff_plain/63d48395d38ab5639f9820ad205e8bc24cb1ca42 mklinks.in: Allow `TARGET=SOURCE' renamings in `.links' files. --- diff --git a/mklinks.in b/mklinks.in index 863ead7..3435879 100755 --- a/mklinks.in +++ b/mklinks.in @@ -71,12 +71,16 @@ done [ $# = 0 ] && set .links cat "$@" | while read name; do - case "$name" in "" | "#"*) continue ;; esac - base=${name##*/} dir=${name%/*} - if [ -r "$pkgdatadir/$base" ]; then + case "$name" in + "" | "#"*) continue ;; + *=*) want=${name##*=}; name=${name%=*} ;; + *) want=${name##*/} ;; + esac + dir=${name%/*} + if [ -r "$pkgdatadir/$want" ]; then mkdir -p "$dir" rm -f "$name" - ln -sf "$pkgdatadir/$base" "$name" + ln -sf "$pkgdatadir/$want" "$name" fi done