Skip to content

Commit 52e2934

Browse files
committed
Fix perms
Signed-off-by: Eric Nemchik <[email protected]>
1 parent b53571a commit 52e2934

File tree

4 files changed

+104
-104
lines changed
  • root/etc/s6-overlay/s6-rc.d
    • init-adduser
    • init-custom-files
    • init-envfile
    • init-migrations

4 files changed

+104
-104
lines changed
Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
1-
#!/usr/bin/with-contenv bash
2-
# shellcheck shell=bash
3-
4-
PUID=${PUID:-911}
5-
PGID=${PGID:-911}
6-
7-
groupmod -o -g "$PGID" abc
8-
usermod -o -u "$PUID" abc
9-
10-
cat /etc/s6-overlay/s6-rc.d/init-adduser/branding
11-
12-
if [[ -f /donate.txt ]]; then
13-
echo '
14-
To support the app dev(s) visit:'
15-
cat /donate.txt
16-
fi
17-
echo '
18-
To support LSIO projects visit:
19-
https://www.linuxserver.io/donate/
20-
21-
───────────────────────────────────────
22-
GID/UID
23-
───────────────────────────────────────'
24-
echo "
25-
User UID: $(id -u abc)
26-
User GID: $(id -g abc)
27-
───────────────────────────────────────
28-
"
29-
30-
lsiown abc:abc /app
31-
lsiown abc:abc /config
32-
lsiown abc:abc /defaults
1+
#!/usr/bin/with-contenv bash
2+
# shellcheck shell=bash
3+
4+
PUID=${PUID:-911}
5+
PGID=${PGID:-911}
6+
7+
groupmod -o -g "$PGID" abc
8+
usermod -o -u "$PUID" abc
9+
10+
cat /etc/s6-overlay/s6-rc.d/init-adduser/branding
11+
12+
if [[ -f /donate.txt ]]; then
13+
echo '
14+
To support the app dev(s) visit:'
15+
cat /donate.txt
16+
fi
17+
echo '
18+
To support LSIO projects visit:
19+
https://www.linuxserver.io/donate/
20+
21+
───────────────────────────────────────
22+
GID/UID
23+
───────────────────────────────────────'
24+
echo "
25+
User UID: $(id -u abc)
26+
User GID: $(id -g abc)
27+
───────────────────────────────────────
28+
"
29+
30+
lsiown abc:abc /app
31+
lsiown abc:abc /config
32+
lsiown abc:abc /defaults
Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
#!/usr/bin/with-contenv bash
2-
# shellcheck shell=bash
3-
4-
# Directories
5-
SCRIPTS_DIR="/custom-cont-init.d"
6-
7-
# Make sure custom init directory exists and has files in it
8-
if [[ -e "${SCRIPTS_DIR}" ]] && [[ -n "$(/bin/ls -A ${SCRIPTS_DIR} 2>/dev/null)" ]]; then
9-
echo "[custom-init] Files found, executing"
10-
for SCRIPT in "${SCRIPTS_DIR}"/*; do
11-
NAME="$(basename "${SCRIPT}")"
12-
if [[ -f "${SCRIPT}" ]]; then
13-
echo "[custom-init] ${NAME}: executing..."
14-
/bin/bash "${SCRIPT}"
15-
echo "[custom-init] ${NAME}: exited $?"
16-
elif [[ ! -f "${SCRIPT}" ]]; then
17-
echo "[custom-init] ${NAME}: is not a file"
18-
fi
19-
done
20-
else
21-
echo "[custom-init] No custom files found, skipping..."
22-
fi
1+
#!/usr/bin/with-contenv bash
2+
# shellcheck shell=bash
3+
4+
# Directories
5+
SCRIPTS_DIR="/custom-cont-init.d"
6+
7+
# Make sure custom init directory exists and has files in it
8+
if [[ -e "${SCRIPTS_DIR}" ]] && [[ -n "$(/bin/ls -A ${SCRIPTS_DIR} 2>/dev/null)" ]]; then
9+
echo "[custom-init] Files found, executing"
10+
for SCRIPT in "${SCRIPTS_DIR}"/*; do
11+
NAME="$(basename "${SCRIPT}")"
12+
if [[ -f "${SCRIPT}" ]]; then
13+
echo "[custom-init] ${NAME}: executing..."
14+
/bin/bash "${SCRIPT}"
15+
echo "[custom-init] ${NAME}: exited $?"
16+
elif [[ ! -f "${SCRIPT}" ]]; then
17+
echo "[custom-init] ${NAME}: is not a file"
18+
fi
19+
done
20+
else
21+
echo "[custom-init] No custom files found, skipping..."
22+
fi
Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
#!/usr/bin/with-contenv bash
2-
# shellcheck shell=bash
3-
4-
if find /run/s6/container_environment/*"FILE__"* -maxdepth 1 > /dev/null 2>&1; then
5-
for FILENAME in /run/s6/container_environment/*; do
6-
if [[ "${FILENAME##*/}" == "FILE__"* ]]; then
7-
SECRETFILE=$(cat "${FILENAME}")
8-
if [[ -f ${SECRETFILE} ]]; then
9-
FILESTRIP=${FILENAME//FILE__/}
10-
cat "${SECRETFILE}" >"${FILESTRIP}"
11-
echo "[env-init] ${FILESTRIP##*/} set from ${FILENAME##*/}"
12-
else
13-
echo "[env-init] cannot find secret in ${FILENAME##*/}"
14-
fi
15-
fi
16-
done
17-
fi
1+
#!/usr/bin/with-contenv bash
2+
# shellcheck shell=bash
3+
4+
if find /run/s6/container_environment/*"FILE__"* -maxdepth 1 > /dev/null 2>&1; then
5+
for FILENAME in /run/s6/container_environment/*; do
6+
if [[ "${FILENAME##*/}" == "FILE__"* ]]; then
7+
SECRETFILE=$(cat "${FILENAME}")
8+
if [[ -f ${SECRETFILE} ]]; then
9+
FILESTRIP=${FILENAME//FILE__/}
10+
cat "${SECRETFILE}" >"${FILESTRIP}"
11+
echo "[env-init] ${FILESTRIP##*/} set from ${FILENAME##*/}"
12+
else
13+
echo "[env-init] cannot find secret in ${FILENAME##*/}"
14+
fi
15+
fi
16+
done
17+
fi
Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
1-
#!/usr/bin/with-contenv bash
2-
# shellcheck shell=bash
3-
4-
MIGRATIONS_DIR="/migrations"
5-
MIGRATIONS_HISTORY="/config/.migrations"
6-
7-
echo "[migrations] started"
8-
9-
if [[ ! -d ${MIGRATIONS_DIR} ]]; then
10-
echo "[migrations] no migrations found"
11-
exit
12-
fi
13-
14-
for MIGRATION in $(find ${MIGRATIONS_DIR}/* | sort -n); do
15-
NAME="$(basename "${MIGRATION}")"
16-
if [[ -f ${MIGRATIONS_HISTORY} ]] && grep -Fxq "${NAME}" ${MIGRATIONS_HISTORY}; then
17-
echo "[migrations] ${NAME}: skipped"
18-
continue
19-
fi
20-
echo "[migrations] ${NAME}: executing..."
21-
chmod +x "${MIGRATION}"
22-
# Execute migration script in a subshell to prevent it from modifying the current environment
23-
("${MIGRATION}")
24-
EXIT_CODE=$?
25-
if [[ ${EXIT_CODE} -ne 0 ]]; then
26-
echo "[migrations] ${NAME}: failed with exit code ${EXIT_CODE}, contact support"
27-
exit "${EXIT_CODE}"
28-
fi
29-
echo "${NAME}" >>${MIGRATIONS_HISTORY}
30-
echo "[migrations] ${NAME}: succeeded"
31-
done
32-
33-
echo "[migrations] done"
1+
#!/usr/bin/with-contenv bash
2+
# shellcheck shell=bash
3+
4+
MIGRATIONS_DIR="/migrations"
5+
MIGRATIONS_HISTORY="/config/.migrations"
6+
7+
echo "[migrations] started"
8+
9+
if [[ ! -d ${MIGRATIONS_DIR} ]]; then
10+
echo "[migrations] no migrations found"
11+
exit
12+
fi
13+
14+
for MIGRATION in $(find ${MIGRATIONS_DIR}/* | sort -n); do
15+
NAME="$(basename "${MIGRATION}")"
16+
if [[ -f ${MIGRATIONS_HISTORY} ]] && grep -Fxq "${NAME}" ${MIGRATIONS_HISTORY}; then
17+
echo "[migrations] ${NAME}: skipped"
18+
continue
19+
fi
20+
echo "[migrations] ${NAME}: executing..."
21+
chmod +x "${MIGRATION}"
22+
# Execute migration script in a subshell to prevent it from modifying the current environment
23+
("${MIGRATION}")
24+
EXIT_CODE=$?
25+
if [[ ${EXIT_CODE} -ne 0 ]]; then
26+
echo "[migrations] ${NAME}: failed with exit code ${EXIT_CODE}, contact support"
27+
exit "${EXIT_CODE}"
28+
fi
29+
echo "${NAME}" >>${MIGRATIONS_HISTORY}
30+
echo "[migrations] ${NAME}: succeeded"
31+
done
32+
33+
echo "[migrations] done"

0 commit comments

Comments
 (0)