Make Jammy Fully v3 Compliant (#111)

pull/121/head jammy-cd65f39a-ls40
Adam 2022-09-11 17:59:55 +01:00 zatwierdzone przez GitHub
rodzic 9ab0ba6aee
commit bcc82acd52
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
56 zmienionych plików z 125 dodań i 130 usunięć

Wyświetl plik

@ -9,7 +9,6 @@ RUN \
apk add --no-cache \
bash \
curl \
patch \
tar \
tzdata \
xz
@ -25,7 +24,7 @@ RUN \
/root-out
# set version for s6 overlay
ARG S6_OVERLAY_VERSION="3.1.0.1"
ARG S6_OVERLAY_VERSION="3.1.2.1"
ARG S6_OVERLAY_ARCH="x86_64"
# add s6 overlay
@ -40,13 +39,6 @@ RUN tar -C /root-out -Jxpf /tmp/s6-overlay-symlinks-noarch.tar.xz
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-symlinks-arch.tar.xz /tmp
RUN tar -C /root-out -Jxpf /tmp/s6-overlay-symlinks-arch.tar.xz
# copy ci-checks
COPY ci-check/ /root-out/package/admin/s6-overlay-${S6_OVERLAY_VERSION}/etc/s6-rc/sources/top/contents.d
# patch cont-init for docker-mods
COPY patch/ /tmp/patch
RUN patch -u /root-out/package/admin/s6-overlay-${S6_OVERLAY_VERSION}/etc/s6-linux-init/skel/rc.init -i /tmp/patch/package/admin/s6-overlay-@VERSION@/etc/s6-linux-init/skel/rc.init.patch
# Runtime stage
FROM scratch
COPY --from=rootfs-stage /root-out/ /
@ -61,7 +53,9 @@ ENV HOME="/root" \
LANGUAGE="en_US.UTF-8" \
LANG="en_US.UTF-8" \
TERM="xterm" \
S6_CMD_WAIT_FOR_SERVICES_MAXTIME="0"
S6_CMD_WAIT_FOR_SERVICES_MAXTIME="0" \
S6_VERBOSITY=1 \
S6_STAGE2_HOOK=/docker-mods
# copy sources
COPY sources.list /etc/apt/

Wyświetl plik

@ -9,7 +9,6 @@ RUN \
apk add --no-cache \
bash \
curl \
patch \
tar \
tzdata \
xz
@ -25,7 +24,7 @@ RUN \
/root-out
# set version for s6 overlay
ARG S6_OVERLAY_VERSION="3.1.0.1"
ARG S6_OVERLAY_VERSION="3.1.2.1"
ARG S6_OVERLAY_ARCH="aarch64"
# add s6 overlay
@ -40,13 +39,6 @@ RUN tar -C /root-out -Jxpf /tmp/s6-overlay-symlinks-noarch.tar.xz
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-symlinks-arch.tar.xz /tmp
RUN tar -C /root-out -Jxpf /tmp/s6-overlay-symlinks-arch.tar.xz
# copy ci-checks
COPY ci-check/ /root-out/package/admin/s6-overlay-${S6_OVERLAY_VERSION}/etc/s6-rc/sources/top/contents.d
# patch cont-init for docker-mods
COPY patch/ /tmp/patch
RUN patch -u /root-out/package/admin/s6-overlay-${S6_OVERLAY_VERSION}/etc/s6-linux-init/skel/rc.init -i /tmp/patch/package/admin/s6-overlay-@VERSION@/etc/s6-linux-init/skel/rc.init.patch
# Runtime stage
FROM scratch
COPY --from=rootfs-stage /root-out/ /
@ -61,7 +53,9 @@ ENV HOME="/root" \
LANGUAGE="en_US.UTF-8" \
LANG="en_US.UTF-8" \
TERM="xterm" \
S6_CMD_WAIT_FOR_SERVICES_MAXTIME="0"
S6_CMD_WAIT_FOR_SERVICES_MAXTIME="0" \
S6_VERBOSITY=1 \
S6_STAGE2_HOOK=/docker-mods
# copy sources
COPY sources.list.arm /etc/apt/sources.list

Wyświetl plik

@ -9,7 +9,6 @@ RUN \
apk add --no-cache \
bash \
curl \
patch \
tar \
tzdata \
xz
@ -25,7 +24,7 @@ RUN \
/root-out
# set version for s6 overlay
ARG S6_OVERLAY_VERSION="3.1.0.1"
ARG S6_OVERLAY_VERSION="3.1.2.1"
ARG S6_OVERLAY_ARCH="armhf"
# add s6 overlay
@ -40,13 +39,6 @@ RUN tar -C /root-out -Jxpf /tmp/s6-overlay-symlinks-noarch.tar.xz
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-symlinks-arch.tar.xz /tmp
RUN tar -C /root-out -Jxpf /tmp/s6-overlay-symlinks-arch.tar.xz
# copy ci-checks
COPY ci-check/ /root-out/package/admin/s6-overlay-${S6_OVERLAY_VERSION}/etc/s6-rc/sources/top/contents.d
# patch cont-init for docker-mods
COPY patch/ /tmp/patch
RUN patch -u /root-out/package/admin/s6-overlay-${S6_OVERLAY_VERSION}/etc/s6-linux-init/skel/rc.init -i /tmp/patch/package/admin/s6-overlay-@VERSION@/etc/s6-linux-init/skel/rc.init.patch
# Runtime stage
FROM scratch
COPY --from=rootfs-stage /root-out/ /
@ -61,7 +53,9 @@ ENV HOME="/root" \
LANGUAGE="en_US.UTF-8" \
LANG="en_US.UTF-8" \
TERM="xterm" \
S6_CMD_WAIT_FOR_SERVICES_MAXTIME="0"
S6_CMD_WAIT_FOR_SERVICES_MAXTIME="0" \
S6_VERBOSITY=1 \
S6_STAGE2_HOOK=/docker-mods
# copy sources
COPY sources.list.arm /etc/apt/sources.list

Wyświetl plik

@ -1,11 +0,0 @@
--- rc.init 2022-05-20 17:41:11.195721000 -0500
+++ rc.init.patched 2022-05-20 17:41:37.646586700 -0500
@@ -6,6 +6,8 @@
s6-chmod 0755 /run/s6/container_environment
fi
+/docker-mods
+
if profile=`printcontenv S6_RUNTIME_PROFILE` ; then
etc="/etc/cont-profile.d/$profile"
else

Wyświetl plik

@ -1,6 +1,11 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash
SCRIPTS_DIR_OLD="/config/custom-cont-init.d"
SCRIPTS_DIR="/custom-cont-init.d"
SERVICES_DIR_OLD="/config/custom-services.d"
SERVICES_DIR="/custom-services.d"
# Set executable bit on cont-init and services built into the image
set_legacy_executable_bits() {
mkdir -p /etc/{cont-init.d,services.d}
@ -31,7 +36,7 @@ tamper_check() {
tamper_check_legacy() {
# Tamper check custom script locations
if [[ -d "${SCRIPTS_DIR_OLD}" ]] && [[ -n "$(find ${SCRIPTS_DIR_OLD} ! -user root)" ]]; then
echo "**** Potential tampering with custom scripts detected ****"
echo "[custom-init] **** Potential tampering with custom scripts detected ****"
randstr=$(
tr </dev/urandom -dc _A-Z-a-z-0-9 | head -c8
echo
@ -264,11 +269,6 @@ run_mods() {
# Main script loop
SCRIPTS_DIR_OLD="/config/custom-cont-init.d"
SCRIPTS_DIR="/custom-cont-init.d"
SERVICES_DIR_OLD="/config/custom-services.d"
SERVICES_DIR="/custom-services.d"
if [ ! -d "/custom-cont-init.d" ] && [ ! -d "/custom-services.d" ]; then
# Tamper check legacy custom folders
tamper_check_legacy

Wyświetl plik

@ -1,16 +0,0 @@
#! /bin/bash
if [[ "$(ls /var/run/s6/container_environment/ | xargs)" == *"FILE__"* ]]; then
for FILENAME in /var/run/s6/container_environment/*; do
if [[ "${FILENAME##*/}" == "FILE__"* ]]; then
SECRETFILE=$(cat ${FILENAME})
if [[ -f ${SECRETFILE} ]]; then
FILESTRIP=${FILENAME//FILE__/}
cat ${SECRETFILE} > ${FILESTRIP}
echo "[env-init] ${FILESTRIP##*/} set from ${FILENAME##*/}"
else
echo "[env-init] cannot find secret in ${FILENAME##*/}"
fi
fi
done
fi

Wyświetl plik

@ -1,30 +0,0 @@
#!/bin/bash
MIGRATIONS_DIR="/migrations"
MIGRATIONS_HISTORY="/config/.migrations"
echo "[migrations] started"
if [[ ! -d ${MIGRATIONS_DIR} ]]; then
echo "[migrations] no migrations found"
exit
fi
for MIGRATION in $(find ${MIGRATIONS_DIR}/* | sort -n); do
NAME="$(basename "${MIGRATION}")"
if [[ -f ${MIGRATIONS_HISTORY} ]] && grep -Fxq "${NAME}" ${MIGRATIONS_HISTORY}; then
echo "[migrations] ${NAME}: skipped"
continue
fi
echo "[migrations] ${NAME}: executing..."
chmod +x "${MIGRATION}"
EXIT_CODE=$(/bin/bash "${MIGRATION}"; echo $?)
if [[ ${EXIT_CODE} -ne 0 ]]; then
echo "[migrations] ${NAME}: failed with exit code ${EXIT_CODE}, contact support"
exit "${EXIT_CODE}"
fi
echo "${NAME}" >> ${MIGRATIONS_HISTORY}
echo "[migrations] ${NAME}: succeeded"
done
echo "[migrations] done"

Wyświetl plik

@ -1,4 +1,5 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash
PUID=${PUID:-911}
PGID=${PGID:-911}
@ -37,7 +38,7 @@ User gid: $(id -g abc)
time32="$(date +%Y)"
if [[ "${time32}" == "1970" || "${time32}" == "1969" ]] && [ "$(uname -m)" == "armv7l" ]; then
echo '
echo '
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Your DockerHost is running an outdated version of libseccomp
@ -48,7 +49,7 @@ Apps will not behave correctly without this
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
'
sleep infinity
sleep infinity
fi
chown abc:abc /app

Wyświetl plik

@ -0,0 +1 @@
oneshot

Wyświetl plik

@ -0,0 +1 @@
/etc/s6-overlay/s6-rc.d/init-adduser/run

Wyświetl plik

@ -0,0 +1 @@
oneshot

Wyświetl plik

@ -0,0 +1 @@
# This file doesn't do anything, it's just the end of the downstream image init process

Wyświetl plik

@ -0,0 +1 @@
oneshot

Wyświetl plik

@ -0,0 +1 @@
# This file doesn't do anything, it's just the start of the downstream image init process

Wyświetl plik

@ -4,8 +4,8 @@
# Directories
SCRIPTS_DIR_OLD="/config/custom-cont-init.d"
SCRIPTS_DIR="/custom-cont-init.d"
SERVICES_DIR_OLD="/config/custom-services.d"
SERVICES_DIR="/custom-services.d"
# chown legacy folders if they exist
if [[ -e "${SCRIPTS_DIR_OLD}" ]]; then
@ -32,10 +32,10 @@ if [[ -e "${SCRIPTS_DIR}" ]] && [[ -n "$(/bin/ls -A ${SCRIPTS_DIR} 2>/dev/null)"
done
# Remove legacy folder if it's empty
if [[ -e "${SCRIPTS_DIR}" ]] && [[ -z "$(/bin/ls -A ${SCRIPTS_DIR} 2>/dev/null)" ]]; then
echo "[custom-init] Legacy service folder ${SCRIPTS_DIR} is empty, deleting..."
rm -rf "${SCRIPTS_DIR}"
fi
if [[ -e "${SCRIPTS_DIR_OLD}" ]] && [[ -z "$(/bin/ls -A ${SCRIPTS_DIR_OLD} 2>/dev/null)" ]]; then
echo "[custom-init] Legacy files folder ${SCRIPTS_DIR_OLD} is empty, deleting..."
rm -rf "${SCRIPTS_DIR_OLD}"
fi
elif [[ -e "${SCRIPTS_DIR_OLD}" ]] && [[ -n "$(/bin/ls -A ${SCRIPTS_DIR_OLD} 2>/dev/null)" ]]; then
echo "[custom-init] Files found, executing"
for SCRIPT in "${SCRIPTS_DIR_OLD}"/*; do
@ -54,24 +54,3 @@ elif [[ -e "${SCRIPTS_DIR_OLD}" ]] && [[ -z "$(/bin/ls -A ${SCRIPTS_DIR_OLD} 2>/
else
echo "[custom-init] No custom files found, skipping..."
fi
if [[ -n "$(/bin/ls -A "${SCRIPTS_DIR_OLD}" 2>/dev/null)" ]] ||
[[ -n "$(/bin/ls -A "${SERVICES_DIR_OLD}" 2>/dev/null)" ]]; then
cat << EOF | tee {${SCRIPTS_DIR_OLD}/README.txt,${SERVICES_DIR_OLD}/README.txt} 2>/dev/null
********************************************************
********************************************************
* *
* !!!! *
* Custom scripts or services found in legacy locations *
* !!!! *
* Please move your custom scripts and services *
* to ${SCRIPTS_DIR} and ${SERVICES_DIR} *
* respectively to ensure they continue working. *
* *
* Visit https://linuxserver.io/custom for more info. *
* *
********************************************************
********************************************************
EOF
fi
exit 0

Wyświetl plik

@ -0,0 +1 @@
oneshot

Wyświetl plik

@ -0,0 +1 @@
/etc/s6-overlay/s6-rc.d/init-custom-files/run

Wyświetl plik

@ -0,0 +1,17 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash
if find /var/run/s6/container_environment/*"FILE__"* -maxdepth 1 > /dev/null 2>&1; then
for FILENAME in /var/run/s6/container_environment/*; do
if [[ "${FILENAME##*/}" == "FILE__"* ]]; then
SECRETFILE=$(cat "${FILENAME}")
if [[ -f ${SECRETFILE} ]]; then
FILESTRIP=${FILENAME//FILE__/}
cat "${SECRETFILE}" >"${FILESTRIP}"
echo "[env-init] ${FILESTRIP##*/} set from ${FILENAME##*/}"
else
echo "[env-init] cannot find secret in ${FILENAME##*/}"
fi
fi
done
fi

Wyświetl plik

@ -0,0 +1 @@
oneshot

Wyświetl plik

@ -0,0 +1 @@
/etc/s6-overlay/s6-rc.d/init-envfile/run

Wyświetl plik

@ -0,0 +1,34 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash
MIGRATIONS_DIR="/migrations"
MIGRATIONS_HISTORY="/config/.migrations"
echo "[migrations] started"
if [[ ! -d ${MIGRATIONS_DIR} ]]; then
echo "[migrations] no migrations found"
exit
fi
for MIGRATION in $(find ${MIGRATIONS_DIR}/* | sort -n); do
NAME="$(basename "${MIGRATION}")"
if [[ -f ${MIGRATIONS_HISTORY} ]] && grep -Fxq "${NAME}" ${MIGRATIONS_HISTORY}; then
echo "[migrations] ${NAME}: skipped"
continue
fi
echo "[migrations] ${NAME}: executing..."
chmod +x "${MIGRATION}"
EXIT_CODE=$(
/bin/bash "${MIGRATION}"
echo $?
)
if [[ ${EXIT_CODE} -ne 0 ]]; then
echo "[migrations] ${NAME}: failed with exit code ${EXIT_CODE}, contact support"
exit "${EXIT_CODE}"
fi
echo "${NAME}" >>${MIGRATIONS_HISTORY}
echo "[migrations] ${NAME}: succeeded"
done
echo "[migrations] done"

Wyświetl plik

@ -0,0 +1 @@
oneshot

Wyświetl plik

@ -0,0 +1 @@
/etc/s6-overlay/s6-rc.d/init-migrations/run

Wyświetl plik

@ -4,7 +4,7 @@
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 "**** Installing all mod packages ****"
echo "[mod-init] **** Installing all mod packages ****"
if [[ -f /usr/bin/apt ]]; then
export DEBIAN_FRONTEND="noninteractive"
apt-get update
@ -20,7 +20,7 @@ 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 "**** Installing all pip packages ****"
echo "[mod-init] **** Installing all pip packages ****"
python3 -m pip install -U pip wheel setuptools
PIP_ARGS=()
if [[ -f /usr/bin/apt ]]; then

Wyświetl plik

@ -0,0 +1 @@
oneshot

Wyświetl plik

@ -0,0 +1 @@
# This file doesn't do anything, it's just the end of the mod init process

Wyświetl plik

@ -0,0 +1,23 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash
if [[ -n "$(/bin/ls -A "/config/custom-cont-init.d" 2>/dev/null)" ]] ||
[[ -n "$(/bin/ls -A "/config/custom-services.d" 2>/dev/null)" ]]; then
cat << EOF | tee /config/custom-cont-init.d/README.txt 2>/dev/null
********************************************************
********************************************************
* *
* !!!! *
* Custom scripts or services found in legacy locations *
* !!!! *
* Please move your custom scripts and services *
* to /custom-cont-init.d and /custom-services.d *
* respectively to ensure they continue working. *
* *
* Visit https://linuxserver.io/custom for more info. *
* *
********************************************************
********************************************************
EOF
fi
exit 0

Wyświetl plik

@ -0,0 +1 @@
oneshot

Wyświetl plik

@ -0,0 +1 @@
/etc/s6-overlay/s6-rc.d/init-script-check/run

Wyświetl plik

@ -1 +1 @@
# This file doesn't do anything, it's just the start of the service init process
# This file doesn't do anything, it just signals that services can start

Wyświetl plik

@ -1,9 +1,9 @@
#! /bin/bash
#!/bin/bash
if [[ -f /var/run/s6/container_environment/UMASK ]] && \
{ [[ "$(pwdx $$)" =~ "/run/s6/legacy-services/" ]] || \
[[ "$(pwdx $$)" =~ "/run/s6/services/" ]] || \
[[ "$(pwdx $$)" =~ "/servicedirs/svc-" ]]; }; then
umask $(cat /var/run/s6/container_environment/UMASK)
if [[ -f /var/run/s6/container_environment/UMASK ]] &&
{ [[ "$(pwdx $$)" =~ "/run/s6/legacy-services/" ]] ||
[[ "$(pwdx $$)" =~ "/run/s6/services/" ]] ||
[[ "$(pwdx $$)" =~ "/servicedirs/svc-" ]]; }; then
umask "$(cat /var/run/s6/container_environment/UMASK)"
fi
exec /command/with-contenv "$@"