aboutsummaryrefslogtreecommitdiff
path: root/tlobsd-mksymlinks
blob: 3eabe4f5c1f207a082326add4310ed8f2677fb73 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/sh
#
# $TeX Live for OpenBSD, 2024/03/21 $

TLBINDIR=$(dirname $0)
REL=../..
LSTFILE=$(mktemp)
AMFILE=$(mktemp)

if [[ ! -w ${TLBINDIR} ]]; then
    echo "You do not have write permissions to ${TLBINDIR}"
    exit 1
fi

if [[ ${tlobsd} -ne 1 ]];then
    echo "Please use 'tlobsd mksymlinks' instead of this command."
    exit 1
fi

which svn 2>&- > /dev/null
if [[ $? -ne 0 ]];then
    echo "Please install the subversion package."
    exit 1
fi

svn --force export svn://tug.org/texlive/trunk/Build/source/texk/texlive/linked_scripts/scripts.lst \
    ${LSTFILE} || exit 1

svn --force export svn://tug.org/texlive/trunk/Build/source/texk/texlive/linked_scripts/Makefile.am \
    ${AMFILE} || exit 1
bin_links=$(awk '/bin_links = \\/,/^$/' ${AMFILE} | awk NF | grep -v bin_links | sed 's,\\,,')

cd ${TLBINDIR} && \
    for s in $(cat ${LSTFILE} | grep -v \')
    do
	target=`basename $s | tr '[A-Z]' '[a-z]'`
	echo "$s" | grep 'memoize-.*\.' >/dev/null \
	    || echo "$s" | grep 'listings-ext.sh' >/dev/null \
	    || target=`echo $target | sed 's,\.[^/]*$,,'`; \
	    if [[ $1 == "remove" ]];then
		rm -f $target
	    else
		rm -f $target
		echo "creating link '$target' -> '$REL/texmf-dist/scripts/$s'"
		ln -s $REL/texmf-dist/scripts/$s $target || exit 1
	    fi
    done && \
	for s in ${bin_links}
	do
	    link=`echo $s | sed 's,.*:,,'`
	    file=`echo $s | sed 's,:.*,,'`
	    if [[ $1 == "remove" ]];then
		rm -f $link
	    else
		rm -f $link
		echo "creating link '$link' -> '$file'"
		ln -s $file $link || exit 1
	    fi
	done

if [[ $1 == "remove" ]]
then
    echo "all symlinks have been removed.  why did you do this?"
fi