aboutsummaryrefslogtreecommitdiff
path: root/tlobsd
blob: 41cfe1e7ea7cc4d8fb6b2e2b8ead7b5b47945b30 (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
#!/bin/sh
#
# $TeX Live for OpenBSD, 2024/06/08 $

cmd=$@
export tlobsd=1

function help {
    TLBINPATH=$(which latex 2>/dev/null | sed 's/\/latex$//')
    echo -e "
Known actions to \033[1mtlobsd\033[0m:
  \033[4mhelp\033[0m\t\tPrints this page.
  \033[4mtlmgr\033[0m\t\tThis action accepts the exact same options and arguments as \033[4mtlmgr(1)\033[0m.
  \033[4mmksymlinks\033[0m\tUpdates all existing links in \033[4m${TLBINPATH}\033[0m
  \t\tand installs new links.
  \033[4mgetbiber\033[0m\tInstalls or updates biber executable for OpenBSD.
  \033[4mversion\033[0m\tGives version information.
"
}

# no $cmd
if [[ -z ${cmd} ]] || [[ ${cmd} == -* ]];then
    echo "$(basename $0): unknown action. Try \033[1m$(basename $0) help\033[0m."
    exit 1
# help
elif [[ $1 == "help" ]];then
    $cmd
# tlmgr
elif [[ $1 == "tlmgr" ]];then
    tempfile=`mktemp`
    $cmd
    if [[ $? -eq 0 ]] && [[ ${tempfile} -ot $(kpsewhich ls-R) ]];then
	tlobsd-mksymlinks 1> /dev/null
    fi
# symlinks
elif [[ $1 == "mksymlinks" ]];then
    tlobsd-mksymlinks $2
# getbiber
elif [[ $1 == "getbiber" ]];then
    tlobsd-getbiber
# version
elif [[ $1 == "version" ]];then
    TL_RELEASE=$(tlmgr version | awk 'FNR == 3 { print $0 }')
    TLOBSD_DATE=$(stat -t '%F' $(which tlobsd) | awk '{ gsub("\"", "", $10) }; { print $10 }')
    OPENBSD_VERSION=$(sysctl -n kern.version | awk 'FNR == 1 { print $2 }')
    echo "${TL_RELEASE} for OpenBSD ${OPENBSD_VERSION} (Compiled ${TLOBSD_DATE})."
# something that is unknown to tlobsd
else
    echo -e "\033[1m$1\033[0m is not known to \033[1m$(basename $0)\033[0m.  Try: \033[1m${cmd} --help\033[0m if you need it, or \033[1m$(basename $0) help\033[0m."
    exit 1
fi