From bd110120a6078732e0a1f71b4c29e865364ff539 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 12 Oct 2007 00:03:16 +0000 Subject: new option --u[nlink] (from Edd Barrett, 10 Oct 2007 11:05:55) git-svn-id: svn://tug.org/texlive/trunk@5166 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/tetex/ChangeLog | 5 +++++ Build/source/texk/tetex/texlinks | 40 ++++++++++++++++++++++++++++++++++----- 2 files changed, 40 insertions(+), 5 deletions(-) (limited to 'Build/source/texk/tetex') diff --git a/Build/source/texk/tetex/ChangeLog b/Build/source/texk/tetex/ChangeLog index 0ead26cf709..5c8630eb3f1 100644 --- a/Build/source/texk/tetex/ChangeLog +++ b/Build/source/texk/tetex/ChangeLog @@ -1,3 +1,8 @@ +2007-10-12 Karl Berry + + * texlinks: new option -u[nlink] for uninstall. + From Edd Barrett, 10 Oct 2007 11:05:55. + 2007-09-30 Karl Berry * texconfig-sys: export texconfig_sys. diff --git a/Build/source/texk/tetex/texlinks b/Build/source/texk/tetex/texlinks index f84f55a95bd..3a06f095707 100755 --- a/Build/source/texk/tetex/texlinks +++ b/Build/source/texk/tetex/texlinks @@ -6,6 +6,9 @@ # the lines given in fmtutil.cnf. # History: +# Tue Oct 9 14:23:01 BST 2007 +# Added unlink option (-u) to aid OpenBSD package uninstall +# Edd Barrett # Sun Aug 28 21:41:06 CEST 2005 # remove special cases for csplain,cslatex,pdfcslatex,pdfcsplain # Fr Apr 8 19:15:05 CEST 2005 @@ -35,7 +38,7 @@ export PATH test -n "${ZSH_VERSION+set}" && alias -g '${1+"$@"}'='"$@"' cnf=fmtutil.cnf # name of the config file -version=1169050907 # seconds since `00:00:00 1970-01-01 UTC' +version=1192147136 # seconds since `00:00:00 1970-01-01 UTC' # date '+%s' (with GNU date) progname=texlinks @@ -57,6 +60,8 @@ Valid options: --silent -s silently skip over existing scripts / binaries instead of creating a warning + --unlink Delete symlinks created by texlinks + -u directories is an optional list of directories in which to operate. If no directories are specified the list of directories depends on the @@ -140,7 +145,7 @@ install_link() fi if test -f $selfautoloc/mf && test -f $selfautoloc/mf-nowin; then # have both mf and mf-nowin binaries. no link. - verbose_echo "metafont symlink $src -> $dest skipped (special case)" + verbose_echo "skipped metafont symlink $src -> $dest (special case)" return fi fi @@ -149,7 +154,7 @@ install_link() case $src in */cont-??|*/metafun|*/mptopdf) - verbose_echo "symlink $src -> $dest skipped (special case)" + verbose_echo "skipped ConTeXtish symlink $src -> $dest (special case)" ;; *) test "x$src" != "x`(ls -ld $src | awk '{print $NF}') 2>/dev/null`" && @@ -204,6 +209,24 @@ upd_symlinkdir() done } +############################################################################### +# rm_link() +# Delete a previously installed link +############################################################################### +rm_link() +{ + link=$1; + if test -e $link; then + if test -h $link; then + verbose_do rm -Rf $link + else + verbose_echo "kept $link, since not a symlink" + fi + else + verbose_echo "skipped $link, non-existent" + fi +} + ############################################################################### # main() # parse commandline arguments, initialize variables, @@ -217,6 +240,7 @@ main() multiplatform=false verbose=false + unlink=false silent=false thisdir=`pwd` : ${KPSE_DOT=$thisdir}; export KPSE_DOT @@ -232,6 +256,7 @@ main() --v*|-v) verbose=true;; --s*|-s) silent=true;; --m*|-m) multiplatform=true;; + --u*|-u) unlink=true;; -*) errmsg "fmtutil: unknown option \`$1' ignored.";; *) break;; esac @@ -278,9 +303,14 @@ main() test "x$fmt" = "x$engine" && continue if test -f "$d/$engine"; then - install_link "$engine" "$d/$fmt" + case $unlink in + true) + rm_link "$d/$fmt";; + *) + install_link "$engine" "$d/$fmt";; + esac else - verbose_echo "$d/$engine: engine does not exist. Skipping..." + verbose_echo "skipped $d/$engine, engine does not exist" fi # restore positional arguments: -- cgit v1.2.3