diff options
Diffstat (limited to 'tlobsd-getbiber')
-rw-r--r-- | tlobsd-getbiber | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/tlobsd-getbiber b/tlobsd-getbiber new file mode 100644 index 0000000..e5a7944 --- /dev/null +++ b/tlobsd-getbiber | |||
@@ -0,0 +1,77 @@ | |||
1 | #!/bin/sh | ||
2 | # | ||
3 | # $TeX Live for OpenBSD, 2024/06/08 $ | ||
4 | |||
5 | TLBINDIR=$(dirname $0) | ||
6 | BINREPO=https://www.ekdosis.org/texlive | ||
7 | TMPDIR=$(mktemp -d) | ||
8 | OPENBSD_VERSION=$(sysctl -n kern.version | awk 'FNR == 1 { print $2 }' | sed 's/\.//') | ||
9 | UPDATING=$(curl -s ${BINREPO}/status.txt | grep updating= | sed 's/.*=//') | ||
10 | |||
11 | if [[ ! -w ${TLBINDIR} ]]; then | ||
12 | echo "You do not have write permissions to ${TLBINDIR}" | ||
13 | exit 1 | ||
14 | fi | ||
15 | |||
16 | if [[ ${tlobsd} -ne 1 ]];then | ||
17 | echo "Please use 'tlobsd getbiber' instead of this command." | ||
18 | exit 1 | ||
19 | fi | ||
20 | |||
21 | |||
22 | if [[ ${UPDATING} == "yes" ]];then | ||
23 | echo "The binaries are being updated. Please re-run this command later." | ||
24 | else | ||
25 | curl ${BINREPO}/biber-openbsd${OPENBSD_VERSION}.xz \ | ||
26 | -o ${TMPDIR}/biber-openbsd${OPENBSD_VERSION}.xz | ||
27 | curl ${BINREPO}/biber-openbsd${OPENBSD_VERSION}.xz.asc \ | ||
28 | -o ${TMPDIR}/biber-openbsd${OPENBSD_VERSION}.xz.asc | ||
29 | gpg --verify ${TMPDIR}/biber-openbsd${OPENBSD_VERSION}.xz.asc | ||
30 | if [[ $? -eq 0 ]];then | ||
31 | unxz ${TMPDIR}/biber-openbsd${OPENBSD_VERSION}.xz | ||
32 | cp ${TMPDIR}/biber-openbsd${OPENBSD_VERSION} ${TLBINDIR}/biber | ||
33 | chmod +x ${TLBINDIR}/biber | ||
34 | echo "Installation complete." | ||
35 | else | ||
36 | echo "" | ||
37 | echo "The signature could not be verified." | ||
38 | echo " Please import the public key used to sign biber-openbsd${OPENBSD_VERSION}.xz" | ||
39 | echo " as described on the TeX Live for OpenBSD web page, or verify this file from" | ||
40 | echo " the user account that was used to install TeX Live for OpenBSD. (Assumably," | ||
41 | echo " this user has already imported the public key into his keyring. Any user" | ||
42 | echo " whose keyring contains the public key of TeX Live for OpenBSD can be used.)" | ||
43 | echo "" | ||
44 | echo " The file to be verified can be found here: ${TMPDIR}/biber-openbsd${OPENBSD_VERSION}.xz." | ||
45 | echo "" | ||
46 | echo " Would you like me to attempt to verify the file from an account that has" | ||
47 | echo " the public key in its keyring?" | ||
48 | echo "" | ||
49 | read whattodo?"[Y]es/[C]ontinue without verifying/[A]bort installation) [Y]: " | ||
50 | [[ "${whattodo}" == '' ]] && whattodo=y | ||
51 | case $whattodo in | ||
52 | [yY] ) | ||
53 | read username?"Enter any user name whose keyring contains the public key of TeX Live for OpenBSD: " | ||
54 | chmod 755 ${TMPDIR} | ||
55 | doas -u ${username} gpg --verify ${TMPDIR}/biber-openbsd${OPENBSD_VERSION}.xz.asc | ||
56 | if [[ $? -eq 0 ]];then | ||
57 | unxz ${TMPDIR}/biber-openbsd${OPENBSD_VERSION}.xz | ||
58 | cp ${TMPDIR}/biber-openbsd${OPENBSD_VERSION} ${TLBINDIR}/biber | ||
59 | chmod +x ${TLBINDIR}/biber | ||
60 | echo "Installation complete." | ||
61 | else | ||
62 | exit 1 | ||
63 | fi | ||
64 | ;; | ||
65 | [cC] ) | ||
66 | unxz ${TMPDIR}/biber-openbsd${OPENBSD_VERSION}.xz | ||
67 | cp ${TMPDIR}/biber-openbsd${OPENBSD_VERSION} ${TLBINDIR}/biber | ||
68 | chmod +x ${TLBINDIR}/biber | ||
69 | echo "Installation complete." | ||
70 | ;; | ||
71 | * ) | ||
72 | echo "Aborting..." | ||
73 | exit 1 | ||
74 | ;; | ||
75 | esac | ||
76 | fi | ||
77 | fi | ||