source: trunk/dports/tex/texlive/patch-texk_tetex_texlinks @ 30880

Last change on this file since 30880 was 30880, checked in by milosh@…, 13 years ago

A tentative texlive port.

File size: 4.9 KB
Line 
1$OpenBSD: patch-texk_tetex_texlinks,v 1.1 2007/10/19 22:14:13 steven Exp $
2--- texk/tetex/texlinks.orig    Wed Jan 17 16:31:31 2007
3+++ texk/tetex/texlinks Mon Oct 15 09:49:15 2007
4@@ -6,6 +6,9 @@
5 # the lines given in fmtutil.cnf.
6
7 # History:
8+#   Tue Oct  9 14:23:01 BST 2007
9+#      Added unlink option (-u) to aid OpenBSD package uninstall
10+#      Edd Barrett <vext01@gmail.com>
11 #   Sun Aug 28 21:41:06 CEST 2005
12 #      remove special cases for csplain,cslatex,pdfcslatex,pdfcsplain
13 #   Fr Apr  8 19:15:05 CEST 2005
14@@ -35,34 +38,31 @@ export PATH
15 test -n "${ZSH_VERSION+set}" && alias -g '${1+"$@"}'='"$@"'
16
17 cnf=fmtutil.cnf   # name of the config file
18-version=1169050907 # seconds since `00:00:00 1970-01-01 UTC'
19+version=1192147136 # seconds since `00:00:00 1970-01-01 UTC'
20                    # date '+%s' (with GNU date)
21 progname=texlinks
22
23-usage='texlinks [options] [directories]
24+usage='Usage: texlinks [OPTION]... [DIRECTORY]...
25
26 Create symbolic links format -> engine according to fmtutil setup.
27
28-Valid options:
29-  --help
30-  -h                    show this help text
31-  --version             show version string
32-  --cnffile file
33-  -f file               use file as config file (default: fmtutil.cnf)
34-  --verbose
35-  -v                    set verbose mode on (default: off)
36-  --multiplatform
37-  -m                    operate in all platform specific directories
38+Mandatory arguments to long options are mandatory for short options too.
39+  -h, --help           show this help text
40+  --version            show version string
41+  -f, --cnffile FILE   use FILE as config file (default: fmtutil.cnf)
42+  -v, --verbose        enable verbose messages (default: off)
43+  -m, --multiplatform  operate in all platform specific directories
44                         (default: operate only in directory for this platform)
45-  --silent
46-  -s                    silently skip over existing scripts / binaries
47-                        instead of creating a warning
48+  -s, --silent         silently skip existing scripts / binaries
49+                        (default: issue warning)
50+  -u, --unlink        remove symlinks created by texlinks
51
52-directories is an optional list of directories in which to operate.
53-If no directories are specified the list of directories depends on the
54---multiplatform option.
55-'
56+The DIRECTORY arguments are an optional list of directories in which to
57+operate.  If no directories are specified the list of directories
58+depends on the --multiplatform option.
59
60+Report bugs to tex-k@tug.org.'
61+
62 ###############################################################################
63 # abort(errmsg)
64 #   print `errmsg' to stderr and exit with error code 1
65@@ -140,7 +140,7 @@ install_link()
66         fi
67         if test -f $selfautoloc/mf && test -f $selfautoloc/mf-nowin; then
68           # have both mf and mf-nowin binaries.  no link.
69-          verbose_echo "metafont symlink $src -> $dest skipped (special case)"
70+          verbose_echo "skipped metafont symlink $src -> $dest (special case)"
71           return
72         fi
73       fi
74@@ -149,7 +149,7 @@ install_link()
75
76   case $src in
77     */cont-??|*/metafun|*/mptopdf)
78-      verbose_echo "symlink $src -> $dest skipped (special case)"
79+      verbose_echo "skipped ConTeXtish symlink $src -> $dest (special case)"
80       ;;
81     *)
82       test "x$src" != "x`(ls -ld $src | awk '{print $NF}') 2>/dev/null`" &&
83@@ -205,6 +205,24 @@ upd_symlinkdir()
84 }
85
86 ###############################################################################
87+# rm_link()
88+#   Delete a previously installed link
89+###############################################################################
90+rm_link()
91+{
92+  link=$1;
93+  if test -e $link; then
94+    if test -h $link; then
95+      verbose_do rm -Rf $link
96+    else
97+      verbose_echo "kept $link, since not a symlink"
98+    fi
99+  else
100+    verbose_echo "skipped $link, non-existent"
101+  fi
102+}
103+
104+###############################################################################
105 # main()
106 #   parse commandline arguments, initialize variables,
107 #   switch into temp. direcrory, execute desired command
108@@ -217,6 +235,7 @@ main()
109
110   multiplatform=false
111   verbose=false
112+  unlink=false
113   silent=false
114   thisdir=`pwd`
115   : ${KPSE_DOT=$thisdir}; export KPSE_DOT
116@@ -232,6 +251,7 @@ main()
117       --v*|-v) verbose=true;;
118       --s*|-s) silent=true;;
119       --m*|-m) multiplatform=true;;
120+      --u*|-u) unlink=true;;
121       -*) errmsg "fmtutil: unknown option \`$1' ignored.";;
122       *)  break;;
123     esac
124@@ -278,9 +298,14 @@ main()
125
126       test "x$fmt" = "x$engine" && continue
127       if test -f "$d/$engine"; then
128-        install_link "$engine" "$d/$fmt"
129+        case $unlink in
130+        true)
131+          rm_link "$d/$fmt";;
132+        *)
133+          install_link "$engine" "$d/$fmt";;
134+        esac
135       else
136-        verbose_echo "$d/$engine: engine does not exist. Skipping..."
137+        verbose_echo "skipped $d/$engine, engine does not exist"
138       fi
139
140       # restore positional arguments:
Note: See TracBrowser for help on using the repository browser.