use venv in init mods package install

This commit is contained in:
aptalca 2023-05-15 16:38:33 -04:00
parent 643409d275
commit 39642821ec
No known key found for this signature in database
GPG key ID: BE36CFFB9FD85548

View file

@ -1,6 +1,17 @@
#!/usr/bin/with-contenv bash #!/usr/bin/with-contenv bash
# shellcheck shell=bash # shellcheck shell=bash
if [[ -f "/mod-pip-packages-to-install.list" ]]; then
IFS=' ' read -ra PIP_PACKAGES <<< "$(tr '\n' ' ' < /mod-pip-packages-to-install.list)"
if [[ ${#PIP_PACKAGES[@]} -ne 0 ]] && [[ ${PIP_PACKAGES[*]} != "" ]]; then
if [[ -f /usr/bin/apt ]]; then
echo "python3-venv" >> /mod-repo-packages-to-install.list
elif [[ -f /sbin/apk ]]; then
echo "python3" >> /mod-repo-packages-to-install.list
fi
fi
fi
if [[ -f "/mod-repo-packages-to-install.list" ]]; then if [[ -f "/mod-repo-packages-to-install.list" ]]; then
IFS=' ' read -ra REPO_PACKAGES <<< "$(tr '\n' ' ' < /mod-repo-packages-to-install.list)" IFS=' ' read -ra REPO_PACKAGES <<< "$(tr '\n' ' ' < /mod-repo-packages-to-install.list)"
if [[ ${#REPO_PACKAGES[@]} -ne 0 ]] && [[ ${REPO_PACKAGES[*]} != "" ]]; then if [[ ${#REPO_PACKAGES[@]} -ne 0 ]] && [[ ${REPO_PACKAGES[*]} != "" ]]; then
@ -21,6 +32,10 @@ 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
echo "**** Creating venv ****"
python3 -m venv /lsiopy
fi
python3 -m pip install -U pip wheel setuptools python3 -m pip install -U pip wheel setuptools
PIP_ARGS=() PIP_ARGS=()
if [[ -f /usr/bin/apt ]]; then if [[ -f /usr/bin/apt ]]; then