Don't create venv if pip is already installed

This commit is contained in:
TheSpad
2023-05-23 11:40:45 +01:00
parent 0484bdbe55
commit 71e6618292
+2 -6
View File
@@ -42,7 +42,7 @@ if [[ -f "/mod-pip-packages-to-install.list" ]]; then
IFS=' ' read -ra PIP_PACKAGES <<< "$(tr '\n' ' ' < /mod-pip-packages-to-install.list)" IFS=' ' read -ra PIP_PACKAGES <<< "$(tr '\n' ' ' < /mod-pip-packages-to-install.list)"
if [[ ${#PIP_PACKAGES[@]} -ne 0 ]] && [[ ${PIP_PACKAGES[*]} != "" ]]; then if [[ ${#PIP_PACKAGES[@]} -ne 0 ]] && [[ ${PIP_PACKAGES[*]} != "" ]]; then
echo "[mod-init] **** Installing all pip packages ****" echo "[mod-init] **** Installing all pip packages ****"
if [[ ! -d /lsiopy/bin ]]; then if ! command -v pip; then
echo "**** Creating venv ****" echo "**** Creating venv ****"
python3 -m venv /lsiopy python3 -m venv /lsiopy
fi fi
@@ -52,11 +52,7 @@ if [[ -f "/mod-pip-packages-to-install.list" ]]; then
PIP_ARGS+=("-f" "https://wheel-index.linuxserver.io/ubuntu/") PIP_ARGS+=("-f" "https://wheel-index.linuxserver.io/ubuntu/")
elif [[ -f /sbin/apk ]]; then elif [[ -f /sbin/apk ]]; then
ALPINE_VER=$(grep main /etc/apk/repositories | sed 's|.*alpine/v||' | sed 's|/main.*||') ALPINE_VER=$(grep main /etc/apk/repositories | sed 's|.*alpine/v||' | sed 's|/main.*||')
if [[ "${ALPINE_VER}" = "3.14" ]]; then PIP_ARGS+=("-f" "https://wheel-index.linuxserver.io/alpine-${ALPINE_VER}/")
PIP_ARGS+=("-f" "https://wheel-index.linuxserver.io/alpine/")
else
PIP_ARGS+=("-f" "https://wheel-index.linuxserver.io/alpine-${ALPINE_VER}/")
fi
fi fi
python3 -m pip install \ python3 -m pip install \
"${PIP_ARGS[@]}" \ "${PIP_ARGS[@]}" \