Merge pull request #969 from linuxserver/mod-scripts-contenv

This commit is contained in:
Adam 2024-10-24 19:55:59 +01:00 committed by GitHub
commit 0198da8db7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 20 additions and 3 deletions

View File

@ -1,11 +1,11 @@
#!/command/with-contenv bash
# shellcheck shell=bash
# Use /command/with-contenv shebang because /usr/bin/with-contenv is created in this script
# Use /command/with-contenv shebang because /usr/bin/with-contenv is created in this script for older bases
# Version 3
# 2022-09-25 - Initial Release
MOD_SCRIPT_VER="3.20240928"
MOD_SCRIPT_VER="3.20241018"
# Define custom folder paths
SCRIPTS_DIR="/custom-cont-init.d"
@ -490,7 +490,9 @@ fi
if [[ -z ${LSIO_READ_ONLY_FS} ]] && [[ -z ${LSIO_NON_ROOT_USER} ]]; then
# Run alias creation functions
create_with_contenv_alias
if [[ ! -f "/usr/bin/with-contenv" ]]; then
create_with_contenv_alias
fi
if [[ -d "${SCRIPTS_DIR}" ]] || [[ -d "${SERVICES_DIR}" ]]; then
tamper_check

15
with-contenv.v1 Normal file
View File

@ -0,0 +1,15 @@
#!/bin/bash
# Use /bin/bash shebang because we don't want the container environment in here
# Version 1
# 2024-10-18 - Initial Release
WITHCONTENV_VER="1.20241018"
if [[ -f /run/s6/container_environment/UMASK ]] &&
{ [[ "$(pwdx $$)" =~ "/run/s6/legacy-services/" ]] ||
[[ "$(pwdx $$)" =~ "/run/s6/services/" ]] ||
[[ "$(pwdx $$)" =~ "/servicedirs/svc-" ]]; }; then
umask "$(cat /run/s6/container_environment/UMASK)"
fi
exec /command/with-contenv "$@"