From: Plom Heller Date: Mon, 3 Aug 2026 07:30:19 +0000 (+0200) Subject: Allow install.sh APP_NAME no_deps for apps without dependencies. X-Git-Url: https://plomlompom.com/repos/%22https:/validator.w3.org/booking/%7Broute%7D?a=commitdiff_plain;ds=sidebyside;p=plomlib Allow install.sh APP_NAME no_deps for apps without dependencies. --- diff --git a/sh/install.sh b/sh/install.sh index 1127276..7c264ce 100755 --- a/sh/install.sh +++ b/sh/install.sh @@ -8,9 +8,14 @@ mkdir -p "${PATH_APP_SHARE}" cp -rL ./src/* "${PATH_APP_SHARE}/" PATH_LOCAL_BIN=~/.local/bin +PATH_RUN=plomlib/sh/install/run mkdir -p "${PATH_LOCAL_BIN}" PATH_TARGET_BIN="${PATH_LOCAL_BIN}/${APP_NAME}" -cat plomlib/sh/run | sed "s/PLEASE_DO_REPLACE_ME/${APP_NAME}/g" > "${PATH_TARGET_BIN}" +cat "${PATH_RUN}.top" | sed "s/PLEASE_DO_REPLACE_ME/${APP_NAME}/g" > "${PATH_TARGET_BIN}" +if [ "$2" != "no_deps" ]; then + cat "${PATH_RUN}.venv" >> "${PATH_TARGET_BIN}" +fi +cat "${PATH_RUN}.bottom" >> "${PATH_TARGET_BIN}" chmod u+x "${PATH_TARGET_BIN}" echo "Installed executable to ${PATH_TARGET_BIN}, app files to ${PATH_APP_SHARE}." diff --git a/sh/install/run.bottom b/sh/install/run.bottom new file mode 100644 index 0000000..c3f8826 --- /dev/null +++ b/sh/install/run.bottom @@ -0,0 +1,3 @@ +export PYTHONPATH="${PATH_APP_SHARE}:${PYTHONPATH}" +cd "${PATH_APP_SHARE}" +./run.py $@ diff --git a/sh/install/run.top b/sh/install/run.top new file mode 100644 index 0000000..2856fe3 --- /dev/null +++ b/sh/install/run.top @@ -0,0 +1,8 @@ +#!/usr/bin/sh +set -e + +APP_NAME=PLEASE_DO_REPLACE_ME + +PATH_APP_SHARE=~/.local/share/"${APP_NAME}" +PATH_VENV="${PATH_APP_SHARE}/venv" + diff --git a/sh/install/run.venv b/sh/install/run.venv new file mode 100644 index 0000000..00563c7 --- /dev/null +++ b/sh/install/run.venv @@ -0,0 +1,11 @@ +PATH_VENV="${PATH_APP_SHARE}/venv" + +python3 -m venv "${PATH_VENV}" +. "${PATH_VENV}/bin/activate" + +if [ "$1" = "install_deps" ]; then + echo "Checking dependencies." + pip3 install -r "${PATH_APP_SHARE}/requirements.txt" + exit 0 +fi + diff --git a/sh/run b/sh/run deleted file mode 100644 index fc89619..0000000 --- a/sh/run +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/sh -set -e - -APP_NAME=PLEASE_DO_REPLACE_ME - -PATH_APP_SHARE=~/.local/share/"${APP_NAME}" -PATH_VENV="${PATH_APP_SHARE}/venv" - -python3 -m venv "${PATH_VENV}" -. "${PATH_VENV}/bin/activate" - -if [ "$1" = "install_deps" ]; then - echo "Checking dependencies." - pip3 install -r "${PATH_APP_SHARE}/requirements.txt" - exit 0 -fi - -export PYTHONPATH="${PATH_APP_SHARE}:${PYTHONPATH}" -cd "${PATH_APP_SHARE}" -./run.py $@