$OpenBSD: patch-texk_tetex_texlinks,v 1.1 2007/10/19 22:14:13 steven Exp $ --- texk/tetex/texlinks.orig Wed Jan 17 16:31:31 2007 +++ texk/tetex/texlinks Mon Oct 15 09:49:15 2007 @@ -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,34 +38,31 @@ 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 -usage='texlinks [options] [directories] +usage='Usage: texlinks [OPTION]... [DIRECTORY]... Create symbolic links format -> engine according to fmtutil setup. -Valid options: - --help - -h show this help text - --version show version string - --cnffile file - -f file use file as config file (default: fmtutil.cnf) - --verbose - -v set verbose mode on (default: off) - --multiplatform - -m operate in all platform specific directories +Mandatory arguments to long options are mandatory for short options too. + -h, --help show this help text + --version show version string + -f, --cnffile FILE use FILE as config file (default: fmtutil.cnf) + -v, --verbose enable verbose messages (default: off) + -m, --multiplatform operate in all platform specific directories (default: operate only in directory for this platform) - --silent - -s silently skip over existing scripts / binaries - instead of creating a warning + -s, --silent silently skip existing scripts / binaries + (default: issue warning) + -u, --unlink remove symlinks created by texlinks -directories is an optional list of directories in which to operate. -If no directories are specified the list of directories depends on the ---multiplatform option. -' +The DIRECTORY arguments are an optional list of directories in which to +operate. If no directories are specified the list of directories +depends on the --multiplatform option. +Report bugs to tex-k@tug.org.' + ############################################################################### # abort(errmsg) # print `errmsg' to stderr and exit with error code 1 @@ -140,7 +140,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 +149,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`" && @@ -205,6 +205,24 @@ upd_symlinkdir() } ############################################################################### +# 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, # switch into temp. direcrory, execute desired command @@ -217,6 +235,7 @@ main() multiplatform=false verbose=false + unlink=false silent=false thisdir=`pwd` : ${KPSE_DOT=$thisdir}; export KPSE_DOT @@ -232,6 +251,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 +298,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: