From 9de2ccdbdfae05aba07e0b54b60403934182e364 Mon Sep 17 00:00:00 2001 From: Ricardo Pardini Date: Fri, 11 Aug 2023 10:24:35 +0200 Subject: [PATCH] start-end: undo unintentional damage done to `python`/`python2` compatibility symlinks inside the `BIN_WORK_DIR` --- lib/functions/main/start-end.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/lib/functions/main/start-end.sh b/lib/functions/main/start-end.sh index 386dbe7c6f..1ead926943 100644 --- a/lib/functions/main/start-end.sh +++ b/lib/functions/main/start-end.sh @@ -64,6 +64,25 @@ function prepare_host_init() { prepare_host # this has its own logging sections, and is possibly interactive. fi + # Create a directory inside WORKDIR with a "python" symlink to "/usr/bin/python2"; add it to PATH first. + # -> what if there is no python2? bookworm/sid, currently. not long until more + # ---> just try to use python3 and hope it works. it probably won't. + BIN_WORK_DIR="${WORKDIR}/bin" + # No cleanup of this is necessary, since it's inside WORKDIR. + mkdir -p "${BIN_WORK_DIR}" + if [[ -f "/usr/bin/python2" ]]; then + display_alert "Found python2" "symlinking to ${BIN_WORK_DIR}/python" "debug" + ln -s "/usr/bin/python2" "${BIN_WORK_DIR}/python" + elif [[ -f "/usr/bin/python3" ]]; then + display_alert "Found python3" "symlinking to ${BIN_WORK_DIR}/python and ${BIN_WORK_DIR}/python2" "debug" + ln -s "/usr/bin/python3" "${BIN_WORK_DIR}/python" + ln -s "/usr/bin/python3" "${BIN_WORK_DIR}/python2" + else + display_alert "No python2 or python3 found" "this is a problem" "error" + fi + declare -g PATH="${BIN_WORK_DIR}:${PATH}" + + return 0 } function main_default_end_build() {