rodzic
9ab0ba6aee
commit
bcc82acd52
14
Dockerfile
14
Dockerfile
|
@ -9,7 +9,6 @@ RUN \
|
||||||
apk add --no-cache \
|
apk add --no-cache \
|
||||||
bash \
|
bash \
|
||||||
curl \
|
curl \
|
||||||
patch \
|
|
||||||
tar \
|
tar \
|
||||||
tzdata \
|
tzdata \
|
||||||
xz
|
xz
|
||||||
|
@ -25,7 +24,7 @@ RUN \
|
||||||
/root-out
|
/root-out
|
||||||
|
|
||||||
# set version for s6 overlay
|
# 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"
|
ARG S6_OVERLAY_ARCH="x86_64"
|
||||||
|
|
||||||
# add s6 overlay
|
# 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
|
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
|
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
|
# Runtime stage
|
||||||
FROM scratch
|
FROM scratch
|
||||||
COPY --from=rootfs-stage /root-out/ /
|
COPY --from=rootfs-stage /root-out/ /
|
||||||
|
@ -61,7 +53,9 @@ ENV HOME="/root" \
|
||||||
LANGUAGE="en_US.UTF-8" \
|
LANGUAGE="en_US.UTF-8" \
|
||||||
LANG="en_US.UTF-8" \
|
LANG="en_US.UTF-8" \
|
||||||
TERM="xterm" \
|
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
|
||||||
COPY sources.list /etc/apt/
|
COPY sources.list /etc/apt/
|
||||||
|
|
|
@ -9,7 +9,6 @@ RUN \
|
||||||
apk add --no-cache \
|
apk add --no-cache \
|
||||||
bash \
|
bash \
|
||||||
curl \
|
curl \
|
||||||
patch \
|
|
||||||
tar \
|
tar \
|
||||||
tzdata \
|
tzdata \
|
||||||
xz
|
xz
|
||||||
|
@ -25,7 +24,7 @@ RUN \
|
||||||
/root-out
|
/root-out
|
||||||
|
|
||||||
# set version for s6 overlay
|
# 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"
|
ARG S6_OVERLAY_ARCH="aarch64"
|
||||||
|
|
||||||
# add s6 overlay
|
# 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
|
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
|
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
|
# Runtime stage
|
||||||
FROM scratch
|
FROM scratch
|
||||||
COPY --from=rootfs-stage /root-out/ /
|
COPY --from=rootfs-stage /root-out/ /
|
||||||
|
@ -61,7 +53,9 @@ ENV HOME="/root" \
|
||||||
LANGUAGE="en_US.UTF-8" \
|
LANGUAGE="en_US.UTF-8" \
|
||||||
LANG="en_US.UTF-8" \
|
LANG="en_US.UTF-8" \
|
||||||
TERM="xterm" \
|
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
|
||||||
COPY sources.list.arm /etc/apt/sources.list
|
COPY sources.list.arm /etc/apt/sources.list
|
||||||
|
|
|
@ -9,7 +9,6 @@ RUN \
|
||||||
apk add --no-cache \
|
apk add --no-cache \
|
||||||
bash \
|
bash \
|
||||||
curl \
|
curl \
|
||||||
patch \
|
|
||||||
tar \
|
tar \
|
||||||
tzdata \
|
tzdata \
|
||||||
xz
|
xz
|
||||||
|
@ -25,7 +24,7 @@ RUN \
|
||||||
/root-out
|
/root-out
|
||||||
|
|
||||||
# set version for s6 overlay
|
# 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"
|
ARG S6_OVERLAY_ARCH="armhf"
|
||||||
|
|
||||||
# add s6 overlay
|
# 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
|
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
|
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
|
# Runtime stage
|
||||||
FROM scratch
|
FROM scratch
|
||||||
COPY --from=rootfs-stage /root-out/ /
|
COPY --from=rootfs-stage /root-out/ /
|
||||||
|
@ -61,7 +53,9 @@ ENV HOME="/root" \
|
||||||
LANGUAGE="en_US.UTF-8" \
|
LANGUAGE="en_US.UTF-8" \
|
||||||
LANG="en_US.UTF-8" \
|
LANG="en_US.UTF-8" \
|
||||||
TERM="xterm" \
|
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
|
||||||
COPY sources.list.arm /etc/apt/sources.list
|
COPY sources.list.arm /etc/apt/sources.list
|
||||||
|
|
|
@ -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
|
|
|
@ -1,6 +1,11 @@
|
||||||
#!/usr/bin/with-contenv bash
|
#!/usr/bin/with-contenv bash
|
||||||
# shellcheck shell=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 executable bit on cont-init and services built into the image
|
||||||
set_legacy_executable_bits() {
|
set_legacy_executable_bits() {
|
||||||
mkdir -p /etc/{cont-init.d,services.d}
|
mkdir -p /etc/{cont-init.d,services.d}
|
||||||
|
@ -31,7 +36,7 @@ tamper_check() {
|
||||||
tamper_check_legacy() {
|
tamper_check_legacy() {
|
||||||
# Tamper check custom script locations
|
# Tamper check custom script locations
|
||||||
if [[ -d "${SCRIPTS_DIR_OLD}" ]] && [[ -n "$(find ${SCRIPTS_DIR_OLD} ! -user root)" ]]; then
|
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=$(
|
randstr=$(
|
||||||
tr </dev/urandom -dc _A-Z-a-z-0-9 | head -c8
|
tr </dev/urandom -dc _A-Z-a-z-0-9 | head -c8
|
||||||
echo
|
echo
|
||||||
|
@ -264,11 +269,6 @@ run_mods() {
|
||||||
|
|
||||||
# Main script loop
|
# 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
|
if [ ! -d "/custom-cont-init.d" ] && [ ! -d "/custom-services.d" ]; then
|
||||||
# Tamper check legacy custom folders
|
# Tamper check legacy custom folders
|
||||||
tamper_check_legacy
|
tamper_check_legacy
|
||||||
|
|
|
@ -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
|
|
|
@ -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"
|
|
|
@ -1,4 +1,5 @@
|
||||||
#!/usr/bin/with-contenv bash
|
#!/usr/bin/with-contenv bash
|
||||||
|
# shellcheck shell=bash
|
||||||
|
|
||||||
PUID=${PUID:-911}
|
PUID=${PUID:-911}
|
||||||
PGID=${PGID:-911}
|
PGID=${PGID:-911}
|
||||||
|
@ -37,7 +38,7 @@ User gid: $(id -g abc)
|
||||||
time32="$(date +%Y)"
|
time32="$(date +%Y)"
|
||||||
|
|
||||||
if [[ "${time32}" == "1970" || "${time32}" == "1969" ]] && [ "$(uname -m)" == "armv7l" ]; then
|
if [[ "${time32}" == "1970" || "${time32}" == "1969" ]] && [ "$(uname -m)" == "armv7l" ]; then
|
||||||
echo '
|
echo '
|
||||||
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
|
||||||
Your DockerHost is running an outdated version of libseccomp
|
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
|
fi
|
||||||
|
|
||||||
chown abc:abc /app
|
chown abc:abc /app
|
|
@ -0,0 +1 @@
|
||||||
|
oneshot
|
|
@ -0,0 +1 @@
|
||||||
|
/etc/s6-overlay/s6-rc.d/init-adduser/run
|
|
@ -0,0 +1 @@
|
||||||
|
oneshot
|
|
@ -0,0 +1 @@
|
||||||
|
# This file doesn't do anything, it's just the end of the downstream image init process
|
|
@ -0,0 +1 @@
|
||||||
|
oneshot
|
|
@ -0,0 +1 @@
|
||||||
|
# This file doesn't do anything, it's just the start of the downstream image init process
|
|
@ -4,8 +4,8 @@
|
||||||
# Directories
|
# Directories
|
||||||
SCRIPTS_DIR_OLD="/config/custom-cont-init.d"
|
SCRIPTS_DIR_OLD="/config/custom-cont-init.d"
|
||||||
SCRIPTS_DIR="/custom-cont-init.d"
|
SCRIPTS_DIR="/custom-cont-init.d"
|
||||||
|
|
||||||
SERVICES_DIR_OLD="/config/custom-services.d"
|
SERVICES_DIR_OLD="/config/custom-services.d"
|
||||||
SERVICES_DIR="/custom-services.d"
|
|
||||||
|
|
||||||
# chown legacy folders if they exist
|
# chown legacy folders if they exist
|
||||||
if [[ -e "${SCRIPTS_DIR_OLD}" ]]; then
|
if [[ -e "${SCRIPTS_DIR_OLD}" ]]; then
|
||||||
|
@ -32,10 +32,10 @@ if [[ -e "${SCRIPTS_DIR}" ]] && [[ -n "$(/bin/ls -A ${SCRIPTS_DIR} 2>/dev/null)"
|
||||||
done
|
done
|
||||||
|
|
||||||
# Remove legacy folder if it's empty
|
# Remove legacy folder if it's empty
|
||||||
if [[ -e "${SCRIPTS_DIR}" ]] && [[ -z "$(/bin/ls -A ${SCRIPTS_DIR} 2>/dev/null)" ]]; then
|
if [[ -e "${SCRIPTS_DIR_OLD}" ]] && [[ -z "$(/bin/ls -A ${SCRIPTS_DIR_OLD} 2>/dev/null)" ]]; then
|
||||||
echo "[custom-init] Legacy service folder ${SCRIPTS_DIR} is empty, deleting..."
|
echo "[custom-init] Legacy files folder ${SCRIPTS_DIR_OLD} is empty, deleting..."
|
||||||
rm -rf "${SCRIPTS_DIR}"
|
rm -rf "${SCRIPTS_DIR_OLD}"
|
||||||
fi
|
fi
|
||||||
elif [[ -e "${SCRIPTS_DIR_OLD}" ]] && [[ -n "$(/bin/ls -A ${SCRIPTS_DIR_OLD} 2>/dev/null)" ]]; then
|
elif [[ -e "${SCRIPTS_DIR_OLD}" ]] && [[ -n "$(/bin/ls -A ${SCRIPTS_DIR_OLD} 2>/dev/null)" ]]; then
|
||||||
echo "[custom-init] Files found, executing"
|
echo "[custom-init] Files found, executing"
|
||||||
for SCRIPT in "${SCRIPTS_DIR_OLD}"/*; do
|
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
|
else
|
||||||
echo "[custom-init] No custom files found, skipping..."
|
echo "[custom-init] No custom files found, skipping..."
|
||||||
fi
|
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
|
|
|
@ -0,0 +1 @@
|
||||||
|
oneshot
|
|
@ -0,0 +1 @@
|
||||||
|
/etc/s6-overlay/s6-rc.d/init-custom-files/run
|
|
@ -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
|
|
@ -0,0 +1 @@
|
||||||
|
oneshot
|
|
@ -0,0 +1 @@
|
||||||
|
/etc/s6-overlay/s6-rc.d/init-envfile/run
|
|
@ -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"
|
|
@ -0,0 +1 @@
|
||||||
|
oneshot
|
|
@ -0,0 +1 @@
|
||||||
|
/etc/s6-overlay/s6-rc.d/init-migrations/run
|
|
@ -4,7 +4,7 @@
|
||||||
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
|
||||||
echo "**** Installing all mod packages ****"
|
echo "[mod-init] **** Installing all mod packages ****"
|
||||||
if [[ -f /usr/bin/apt ]]; then
|
if [[ -f /usr/bin/apt ]]; then
|
||||||
export DEBIAN_FRONTEND="noninteractive"
|
export DEBIAN_FRONTEND="noninteractive"
|
||||||
apt-get update
|
apt-get update
|
||||||
|
@ -20,7 +20,7 @@ fi
|
||||||
if [[ -f "/mod-pip-packages-to-install.list" ]]; then
|
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 "**** Installing all pip packages ****"
|
echo "[mod-init] **** Installing all pip packages ****"
|
||||||
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
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
oneshot
|
|
@ -0,0 +1 @@
|
||||||
|
# This file doesn't do anything, it's just the end of the mod init process
|
|
@ -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
|
|
@ -0,0 +1 @@
|
||||||
|
oneshot
|
|
@ -0,0 +1 @@
|
||||||
|
/etc/s6-overlay/s6-rc.d/init-script-check/run
|
|
@ -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
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
#! /bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
if [[ -f /var/run/s6/container_environment/UMASK ]] && \
|
if [[ -f /var/run/s6/container_environment/UMASK ]] &&
|
||||||
{ [[ "$(pwdx $$)" =~ "/run/s6/legacy-services/" ]] || \
|
{ [[ "$(pwdx $$)" =~ "/run/s6/legacy-services/" ]] ||
|
||||||
[[ "$(pwdx $$)" =~ "/run/s6/services/" ]] || \
|
[[ "$(pwdx $$)" =~ "/run/s6/services/" ]] ||
|
||||||
[[ "$(pwdx $$)" =~ "/servicedirs/svc-" ]]; }; then
|
[[ "$(pwdx $$)" =~ "/servicedirs/svc-" ]]; }; then
|
||||||
umask $(cat /var/run/s6/container_environment/UMASK)
|
umask "$(cat /var/run/s6/container_environment/UMASK)"
|
||||||
fi
|
fi
|
||||||
exec /command/with-contenv "$@"
|
exec /command/with-contenv "$@"
|
||||||
|
|
Ładowanie…
Reference in New Issue