From be39ec164daa140255acd4840fe4231e14d3b6d3 Mon Sep 17 00:00:00 2001 From: Robert Alessi Date: Wed, 6 Mar 2024 12:23:41 +0100 Subject: makefile: check for forbidden dirs --- makefile | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) (limited to 'makefile') diff --git a/makefile b/makefile index bf37f4b..b127cfe 100644 --- a/makefile +++ b/makefile @@ -7,6 +7,9 @@ TLBINPATH!=which latex | sed 's/\/latex//' TMPSOURCE?="" UPDATING!=curl -s ${BINREPO}/status.txt | grep updating= | sed 's/.*=//' +DONT_TOUCH_DIRS:=${HOME}/bin /bin /sbin /usr/bin /usr/sbin /usr/X11R6/bin /usr/local/bin /usr/local/sbin + + .MAIN: update fetch: @@ -14,9 +17,9 @@ fetch: @echo "The binaries are being updated. Please re-run this command later." .else curl ${BINREPO}/amd64-openbsd${OPENBSD_VERSION}.tar.xz \ - > ${TMPDIR}/amd64-openbsd${OPENBSD_VERSION}.tar.xz + -o ${TMPDIR}/amd64-openbsd${OPENBSD_VERSION}.tar.xz curl ${BINREPO}/amd64-openbsd${OPENBSD_VERSION}.tar.xz.asc \ - > ${TMPDIR}/amd64-openbsd${OPENBSD_VERSION}.tar.xz.asc + -o ${TMPDIR}/amd64-openbsd${OPENBSD_VERSION}.tar.xz.asc gpg --verify ${TMPDIR}/amd64-openbsd${OPENBSD_VERSION}.tar.xz.asc unxz ${TMPDIR}/amd64-openbsd${OPENBSD_VERSION}.tar.xz mkdir ${TMPDIR}/bin \ @@ -33,11 +36,22 @@ update: @echo "The binaries are being updated. Please re-run this command later." .else curl ${BINREPO}/amd64-openbsd${OPENBSD_VERSION}.tar.xz \ - > ${TMPDIR}/amd64-openbsd${OPENBSD_VERSION}.tar.xz + -o ${TMPDIR}/amd64-openbsd${OPENBSD_VERSION}.tar.xz curl ${BINREPO}/amd64-openbsd${OPENBSD_VERSION}.tar.xz.asc \ - > ${TMPDIR}/amd64-openbsd${OPENBSD_VERSION}.tar.xz.asc + -o ${TMPDIR}/amd64-openbsd${OPENBSD_VERSION}.tar.xz.asc gpg --verify ${TMPDIR}/amd64-openbsd${OPENBSD_VERSION}.tar.xz.asc +.for DIR in ${DONT_TOUCH_DIRS} +.if "${DIR}" == ${TLBINPATH} + @echo "" + @echo "This program will never affect a system directory such as ${TLBINPATH}" + @echo "To complete the update, you must replace by hand your binaries" + @echo "with those in ${TMPDIR}/amd64-openbsd${OPENBSD_VERSION}.tar.xz" + @echo "Exiting now." + exit 1 +.endif +.endfor .if "${PREFIX}" == ${TLBINPATH} + @echo "" @echo "Looks good." @echo "Now do this to update the binaries:" @echo "1. Remove the binaries that are currently installed:" @@ -45,10 +59,17 @@ update: @echo "2. Run this command:" @echo " make TMPSOURCE=${TMPDIR} install" .else + @echo "" @echo "Looks like your TL binaries are in ${TLBINPATH}" - @echo "instead of ${PREFIX}" - @echo "To complete the update, you must replace by hand your binaries" - @echo "with those in ${TMPDIR}/amd64-openbsd${OPENBSD_VERSION}.tar.xz" + @echo "instead of the expected ${PREFIX}." + @echo "To complete the update, you must remove by hand your binaries." + @echo "******************************************************************************" + @echo "* CAUTION: You must first ensure that ${TLBINPATH} contains nothing" + @echo "* but the TeX Live binaries, otherwise you may damage your system permanently." + @echo "******************************************************************************" + @echo "Then do:" + @echo "1. doas rm ${TLBINPATH}/*" + @echo "2. make TMPSOURCE=${TMPDIR} PREFIX=${TLBINPATH} install" .endif .endif -- cgit v1.2.3