diff options
author | Karl Berry <karl@freefriends.org> | 2019-03-17 21:54:02 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-03-17 21:54:02 +0000 |
commit | a79da32935834f42057e258d22bb90e8ed7e65aa (patch) | |
tree | 5a572359444a579b30b73e8a3844b01afe47ff22 /Master/tlpkg/bin/deref-symlinks | |
parent | 5698059f8aa4109c8f98d166ef398f04c515b022 (diff) |
webquiz deref/remove symlinks
git-svn-id: svn://tug.org/texlive/trunk@50431 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/bin/deref-symlinks')
-rwxr-xr-x | Master/tlpkg/bin/deref-symlinks | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/Master/tlpkg/bin/deref-symlinks b/Master/tlpkg/bin/deref-symlinks new file mode 100755 index 00000000000..3b1dbd6202f --- /dev/null +++ b/Master/tlpkg/bin/deref-symlinks @@ -0,0 +1,22 @@ +#!/bin/sh +# $Id$ +# Originally written by Karl Berry. Public domain. +# +# Replace symlinks to files with the actual files. +# Symlinks to anything else are not touched. + +if test "x$1" = --save-links; then + savelinks=true +else + savelinks=false +fi + +for f in "$@"; do + test -h "$f" || continue # skip non-symlinks + test -f "$f" || continue # skip links to anything but regular files + + cp --dereference "$f" "$f".file # expand link + mv "$f" "$f".link # move link out of the way + mv -v "$f".file "$f" # replace with regular file + $savelinks || rm "$f".link # remove link unless keeping +done |