From 39642821ec6d4eeadadb605e9f372a80c9ec1ab9 Mon Sep 17 00:00:00 2001 From: aptalca <541623+aptalca@users.noreply.github.com> Date: Mon, 15 May 2023 16:38:33 -0400 Subject: [PATCH 1/2] use venv in init mods package install --- .../s6-rc.d/init-mods-package-install/run | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/root/etc/s6-overlay/s6-rc.d/init-mods-package-install/run b/root/etc/s6-overlay/s6-rc.d/init-mods-package-install/run index 90b4b2e8..f54077e4 100755 --- a/root/etc/s6-overlay/s6-rc.d/init-mods-package-install/run +++ b/root/etc/s6-overlay/s6-rc.d/init-mods-package-install/run @@ -1,6 +1,17 @@ #!/usr/bin/with-contenv 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 IFS=' ' read -ra REPO_PACKAGES <<< "$(tr '\n' ' ' < /mod-repo-packages-to-install.list)" 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)" if [[ ${#PIP_PACKAGES[@]} -ne 0 ]] && [[ ${PIP_PACKAGES[*]} != "" ]]; then 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 PIP_ARGS=() if [[ -f /usr/bin/apt ]]; then From 15496c0fca0bf49ea0fbe59d508546f0ca3944b1 Mon Sep 17 00:00:00 2001 From: TheSpad Date: Tue, 16 May 2023 10:49:38 +0100 Subject: [PATCH 2/2] Externalise package check --- Dockerfile | 2 + Dockerfile.aarch64 | 2 + .../s6-rc.d/init-mods-package-install/run | 59 ------------------- 3 files changed, 4 insertions(+), 59 deletions(-) delete mode 100755 root/etc/s6-overlay/s6-rc.d/init-mods-package-install/run diff --git a/Dockerfile b/Dockerfile index 5089a599..26ebe7ce 100644 --- a/Dockerfile +++ b/Dockerfile @@ -51,10 +51,12 @@ COPY --from=rootfs-stage /root-out/ / ARG BUILD_DATE ARG VERSION ARG MODS_VERSION="v3" +ARG PKG_INST_VERSION="v1" LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}" LABEL maintainer="TheLamer" ADD --chmod=744 "https://raw.githubusercontent.com/linuxserver/docker-mods/mod-scripts/docker-mods.${MODS_VERSION}" "/docker-mods" +ADD --chmod=744 "https://raw.githubusercontent.com/linuxserver/docker-mods/mod-scripts/package-install.${PKG_INST_VERSION}" "/etc/s6-overlay/s6-rc.d/init-mods-package-install/run" # environment variables ENV PS1="$(whoami)@$(hostname):$(pwd)\\$ " \ diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index 191115ca..05b56a56 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -51,10 +51,12 @@ COPY --from=rootfs-stage /root-out/ / ARG BUILD_DATE ARG VERSION ARG MODS_VERSION="v3" +ARG PKG_INST_VERSION="v1" LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}" LABEL maintainer="TheLamer" ADD --chmod=744 "https://raw.githubusercontent.com/linuxserver/docker-mods/mod-scripts/docker-mods.${MODS_VERSION}" "/docker-mods" +ADD --chmod=744 "https://raw.githubusercontent.com/linuxserver/docker-mods/mod-scripts/package-install.${PKG_INST_VERSION}" "/etc/s6-overlay/s6-rc.d/init-mods-package-install/run" # environment variables ENV PS1="$(whoami)@$(hostname):$(pwd)\\$ " \ diff --git a/root/etc/s6-overlay/s6-rc.d/init-mods-package-install/run b/root/etc/s6-overlay/s6-rc.d/init-mods-package-install/run deleted file mode 100755 index f54077e4..00000000 --- a/root/etc/s6-overlay/s6-rc.d/init-mods-package-install/run +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/with-contenv 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 - IFS=' ' read -ra REPO_PACKAGES <<< "$(tr '\n' ' ' < /mod-repo-packages-to-install.list)" - if [[ ${#REPO_PACKAGES[@]} -ne 0 ]] && [[ ${REPO_PACKAGES[*]} != "" ]]; then - echo "[mod-init] **** Installing all mod packages ****" - if [[ -f /usr/bin/apt ]]; then - export DEBIAN_FRONTEND="noninteractive" - apt-get update - apt-get install -y --no-install-recommends \ - "${REPO_PACKAGES[@]}" - elif [[ -f /sbin/apk ]]; then - apk add --no-cache \ - "${REPO_PACKAGES[@]}" - fi - fi -fi - -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 - 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 - PIP_ARGS=() - if [[ -f /usr/bin/apt ]]; then - PIP_ARGS+=("-f" "https://wheel-index.linuxserver.io/ubuntu/") - elif [[ -f /sbin/apk ]]; then - 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/") - else - PIP_ARGS+=("-f" "https://wheel-index.linuxserver.io/alpine-${ALPINE_VER}/") - fi - fi - python3 -m pip install \ - "${PIP_ARGS[@]}" \ - "${PIP_PACKAGES[@]}" - fi -fi - -rm -rf \ - /mod-repo-packages-to-install.list \ - /mod-pip-packages-to-install.list