mirror of
https://github.com/casjaysdevdocker/bind
synced 2025-12-01 10:13:00 -05:00
🗃️ Updated Dockerfile* and .env.scripts* 🗃️
Some checks failed
release-tag / release-image (push) Has been cancelled
Some checks failed
release-tag / release-image (push) Has been cancelled
Dockerfile rootfs/usr/local/bin/entrypoint.sh rootfs/usr/local/etc/docker/functions/entrypoint.sh
This commit is contained in:
@@ -254,6 +254,5 @@ EXPOSE ${SERVICE_PORT} ${ENV_PORTS}
|
|||||||
|
|
||||||
STOPSIGNAL SIGRTMIN+3
|
STOPSIGNAL SIGRTMIN+3
|
||||||
|
|
||||||
CMD [ "tail", "-f", "/dev/null" ]
|
|
||||||
ENTRYPOINT [ "tini", "-p", "SIGTERM","--", "/usr/local/bin/entrypoint.sh" ]
|
ENTRYPOINT [ "tini", "-p", "SIGTERM","--", "/usr/local/bin/entrypoint.sh" ]
|
||||||
HEALTHCHECK --start-period=10m --interval=5m --timeout=15s CMD [ "/usr/local/bin/entrypoint.sh", "healthcheck" ]
|
HEALTHCHECK --start-period=10m --interval=5m --timeout=15s CMD [ "/usr/local/bin/entrypoint.sh", "healthcheck" ]
|
||||||
|
|||||||
@@ -1,24 +1,24 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
##@Version : 202510311144-git
|
##@Version : GEN_SCRIPT_REPLACE_VERSION
|
||||||
# @@Author : Jason Hempstead
|
# @@Author : GEN_SCRIPT_REPLACE_AUTHOR
|
||||||
# @@Contact : jason@casjaysdev.pro
|
# @@Contact : GEN_SCRIPT_REPLACE_EMAIL
|
||||||
# @@License : WTFPL
|
# @@License : GEN_SCRIPT_REPLACE_LICENSE
|
||||||
# @@ReadME : entrypoint.sh --help
|
# @@ReadME : entrypoint.sh --help
|
||||||
# @@Copyright : Copyright: (c) 2025 Jason Hempstead, Casjays Developments
|
# @@Copyright : GEN_SCRIPT_REPLACE_COPYRIGHT
|
||||||
# @@Created : Friday, Oct 31, 2025 11:44 EDT
|
# @@Created : GEN_SCRIPT_REPLACE_DATE
|
||||||
# @@File : entrypoint.sh
|
# @@File : entrypoint.sh
|
||||||
# @@Description : Entrypoint file for bind
|
# @@Description : Entrypoint file for GEN_SCRIPT_REPLACE_APPNAME
|
||||||
# @@Changelog : New script
|
# @@Changelog : GEN_SCRIPT_REPLACE_CHANGELOG
|
||||||
# @@TODO : Better documentation
|
# @@TODO : GEN_SCRIPT_REPLACE_TODO
|
||||||
# @@Other :
|
# @@Other : GEN_SCRIPT_REPLACE_OTHER
|
||||||
# @@Resource :
|
# @@Resource : GEN_SCRIPT_REPLACE_RES
|
||||||
# @@Terminal App : no
|
# @@Terminal App : GEN_SCRIPT_REPLACE_TERMINAL
|
||||||
# @@sudo/root : no
|
# @@sudo/root : GEN_SCRIPT_REPLACE_SUDO
|
||||||
# @@Template : other/docker-entrypoint
|
# @@Template : other/docker-entrypoint
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2120,SC2155,SC2199,SC2317,SC2329
|
# shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2090,SC2115,SC2120,SC2155,SC2199,SC2229,SC2317,SC2329
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# run trap command on exit
|
# run trap command on exit
|
||||||
trap 'retVal=$?;[ "$SERVICE_IS_RUNNING" != "yes" ] && [ -f "$SERVICE_PID_FILE" ] && rm -Rf "$SERVICE_PID_FILE";exit $retVal' INT TERM PWR
|
trap 'retVal=$?;[ "$SERVICE_IS_RUNNING" != "yes" ] && [ -f "$SERVICE_PID_FILE" ] && rm -Rf "$SERVICE_PID_FILE";exit $retVal' INT TERM PWR
|
||||||
@@ -31,7 +31,7 @@ PATH="/usr/local/etc/docker/bin:/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin"
|
|||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# Set bash options
|
# Set bash options
|
||||||
SCRIPT_FILE="$0"
|
SCRIPT_FILE="$0"
|
||||||
CONTAINER_NAME="bind"
|
CONTAINER_NAME="GEN_SCRIPT_REPLACE_APPNAME"
|
||||||
SCRIPT_NAME="$(basename -- "$SCRIPT_FILE" 2>/dev/null)"
|
SCRIPT_NAME="$(basename -- "$SCRIPT_FILE" 2>/dev/null)"
|
||||||
CONTAINER_NAME="${ENV_CONTAINER_NAME:-$CONTAINER_NAME}"
|
CONTAINER_NAME="${ENV_CONTAINER_NAME:-$CONTAINER_NAME}"
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
@@ -84,8 +84,8 @@ SERVICE_UID="${SERVICE_UID:-0}" # set the user id
|
|||||||
SERVICE_GID="${SERVICE_GID:-0}" # set the group id
|
SERVICE_GID="${SERVICE_GID:-0}" # set the group id
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# User and group in which the service switches to - IE: nginx,apache,mysql,postgres
|
# User and group in which the service switches to - IE: nginx,apache,mysql,postgres
|
||||||
SERVICE_USER="${SERVICE_USER:-bind}" # execute command as another user
|
SERVICE_USER="${SERVICE_USER:-GEN_SCRIPT_REPLACE_APPNAME}" # execute command as another user
|
||||||
SERVICE_GROUP="${SERVICE_GROUP:-bind}" # Set the service group
|
SERVICE_GROUP="${SERVICE_GROUP:-GEN_SCRIPT_REPLACE_APPNAME}" # Set the service group
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# Secondary ports
|
# Secondary ports
|
||||||
SERVER_PORTS="" # specifiy other ports
|
SERVER_PORTS="" # specifiy other ports
|
||||||
@@ -95,7 +95,7 @@ WEB_SERVER_PORT="" # port : 80,443
|
|||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# Healthcheck variables
|
# Healthcheck variables
|
||||||
HEALTH_ENABLED="yes" # enable healthcheck [yes/no]
|
HEALTH_ENABLED="yes" # enable healthcheck [yes/no]
|
||||||
SERVICES_LIST="tini" # comma seperated list of processes for the healthcheck
|
SERVICES_LIST="tini" # comma separated list of processes for the healthcheck
|
||||||
HEALTH_ENDPOINTS="" # url endpoints: [http://localhost/health,http://localhost/test]
|
HEALTH_ENDPOINTS="" # url endpoints: [http://localhost/health,http://localhost/test]
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# Update path var
|
# Update path var
|
||||||
@@ -258,7 +258,7 @@ fi
|
|||||||
if [ "$ENTRYPOINT_FIRST_RUN" != "no" ]; then
|
if [ "$ENTRYPOINT_FIRST_RUN" != "no" ]; then
|
||||||
# Show start message
|
# Show start message
|
||||||
if [ "$CONFIG_DIR_INITIALIZED" = "no" ] || [ "$DATA_DIR_INITIALIZED" = "no" ]; then
|
if [ "$CONFIG_DIR_INITIALIZED" = "no" ] || [ "$DATA_DIR_INITIALIZED" = "no" ]; then
|
||||||
[ "$ENTRYPOINT_MESSAGE" = "yes" ] && echo "Executing entrypoint script for bind"
|
[ "$ENTRYPOINT_MESSAGE" = "yes" ] && echo "Executing entrypoint script for GEN_SCRIPT_REPLACE_APPNAME"
|
||||||
fi
|
fi
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# Set reusable variables
|
# Set reusable variables
|
||||||
@@ -371,11 +371,6 @@ else
|
|||||||
rm -f /run/__start_init_scripts.pid /run/init.d/*.pid /run/*.pid 2>/dev/null || true
|
rm -f /run/__start_init_scripts.pid /run/init.d/*.pid /run/*.pid 2>/dev/null || true
|
||||||
fi
|
fi
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
if [ ! -f "/run/__start_init_scripts.pid" ]; then
|
|
||||||
START_SERVICES="yes"
|
|
||||||
touch /run/__start_init_scripts.pid
|
|
||||||
fi
|
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
[ "$ENTRYPOINT_MESSAGE" = "yes" ] && __printf_space "40" "The containers ip address is:" "$CONTAINER_IP4_ADDRESS"
|
[ "$ENTRYPOINT_MESSAGE" = "yes" ] && __printf_space "40" "The containers ip address is:" "$CONTAINER_IP4_ADDRESS"
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# Show configured listing processes
|
# Show configured listing processes
|
||||||
@@ -400,26 +395,26 @@ __run_message
|
|||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# Just start services
|
# Just start services
|
||||||
START_SERVICES="${START_SERVICES:-SYSTEM_INIT}"
|
START_SERVICES="${START_SERVICES:-SYSTEM_INIT}"
|
||||||
[ "$1" = "sh" ] && START_SERVICES=no
|
|
||||||
[ "$1" = "shell" ] && START_SERVICES=no
|
|
||||||
[ "$1" = "init" ] && START_SERVICES=no
|
|
||||||
[ "$1" = "backup" ] && START_SERVICES=no
|
|
||||||
[ "$1" = "healthcheck" ] && START_SERVICES=no
|
|
||||||
[ "$1" = "cron" ] && START_SERVICES=no
|
|
||||||
[ "$1" = "tail" ] && START_SERVICES=no
|
|
||||||
[ "$1" = "logs" ] && START_SERVICES=no
|
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# Start all services if no pidfile
|
# Determine if we should start services based on command
|
||||||
|
# Only skip service start for the 'init' command
|
||||||
|
SKIP_SERVICE_START="no"
|
||||||
|
[ "$1" = "init" ] && SKIP_SERVICE_START="yes" && CONTAINER_INIT="yes"
|
||||||
|
[ "$2" = "init" ] && SKIP_SERVICE_START="yes" && CONTAINER_INIT="yes"
|
||||||
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
# Start all services if no pidfile and not skipping
|
||||||
if [ "$START_SERVICES" = "yes" ] || [ -z "$1" ]; then
|
if [ "$START_SERVICES" = "yes" ] || [ -z "$1" ]; then
|
||||||
|
if [ "$SKIP_SERVICE_START" = "no" ]; then
|
||||||
[ "$1" = "start" ] && shift 1
|
[ "$1" = "start" ] && shift 1
|
||||||
[ "$1" = "all" ] && shift 1
|
[ "$1" = "all" ] && shift 1
|
||||||
[ "$1" = "init" ] && export CONTAINER_INIT="yes"
|
rm -Rf "/run"/*/*pid 2>/dev/null || true
|
||||||
echo "$$" >"$ENTRYPOINT_PID_FILE"
|
echo "$$" >"$ENTRYPOINT_PID_FILE"
|
||||||
rm -Rf "/run"/*/*pid
|
|
||||||
__start_init_scripts "/usr/local/etc/docker/init.d"
|
__start_init_scripts "/usr/local/etc/docker/init.d"
|
||||||
START_SERVICES="no"
|
|
||||||
CONTAINER_INIT="${CONTAINER_INIT:-no}"
|
CONTAINER_INIT="${CONTAINER_INIT:-no}"
|
||||||
|
fi
|
||||||
|
START_SERVICES="no"
|
||||||
fi
|
fi
|
||||||
|
export START_SERVICES CONTAINER_INIT ENTRYPOINT_PID_FILE
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# Begin options
|
# Begin options
|
||||||
case "$1" in
|
case "$1" in
|
||||||
@@ -481,6 +476,11 @@ backup)
|
|||||||
# Docker healthcheck
|
# Docker healthcheck
|
||||||
healthcheck)
|
healthcheck)
|
||||||
shift 1
|
shift 1
|
||||||
|
case "$1" in
|
||||||
|
init | test)
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
arguments="$*"
|
arguments="$*"
|
||||||
healthStatus=0
|
healthStatus=0
|
||||||
healthEnabled="${HEALTH_ENABLED:-}"
|
healthEnabled="${HEALTH_ENABLED:-}"
|
||||||
@@ -497,7 +497,6 @@ healthcheck)
|
|||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
services="$(echo "$services" | tr ' ' '\n' | sort -u | grep -v '^$')"
|
services="$(echo "$services" | tr ' ' '\n' | sort -u | grep -v '^$')"
|
||||||
{ [ "$1" = "init" ] || [ "$1" = "test" ]; } && exit 0
|
|
||||||
for proc in $services; do
|
for proc in $services; do
|
||||||
if [ -n "$proc" ]; then
|
if [ -n "$proc" ]; then
|
||||||
if ! __pgrep "$proc"; then
|
if ! __pgrep "$proc"; then
|
||||||
@@ -526,6 +525,8 @@ healthcheck)
|
|||||||
[ -n "$healthMessage" ] && echo "$healthMessage"
|
[ -n "$healthMessage" ] && echo "$healthMessage"
|
||||||
exit $healthStatus
|
exit $healthStatus
|
||||||
;;
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
# show open ports
|
# show open ports
|
||||||
ports)
|
ports)
|
||||||
shift 1
|
shift 1
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
# @@sudo/root : no
|
# @@sudo/root : no
|
||||||
# @@Template : functions/docker-entrypoint
|
# @@Template : functions/docker-entrypoint
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2120,SC2155,SC2199,SC2317,SC2329
|
# shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2090,SC2115,SC2120,SC2155,SC2199,SC2229,SC2317,SC2329
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# setup debugging - https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html
|
# setup debugging - https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html
|
||||||
[ -f "/config/.debug" ] && [ -z "$DEBUGGER_OPTIONS" ] && export DEBUGGER_OPTIONS="$(<"/config/.debug")" || true
|
[ -f "/config/.debug" ] && [ -z "$DEBUGGER_OPTIONS" ] && export DEBUGGER_OPTIONS="$(<"/config/.debug")" || true
|
||||||
@@ -38,6 +38,7 @@ __printf_space() {
|
|||||||
printf '%s\n' "$message"
|
printf '%s\n' "$message"
|
||||||
}
|
}
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
__mkdir() { [ -n "$1" ] && mkdir -p "$@" || return 1; }
|
||||||
__rm() { [ -n "$1" ] && [ -e "$1" ] && rm -Rf "${1:?}"; }
|
__rm() { [ -n "$1" ] && [ -e "$1" ] && rm -Rf "${1:?}"; }
|
||||||
__grep_test() { grep -sh "$1" "$2" | grep -qwF "${3:-$1}" || return 1; }
|
__grep_test() { grep -sh "$1" "$2" | grep -qwF "${3:-$1}" || return 1; }
|
||||||
__netstat() { [ -f "$(type -P netstat)" ] && netstat "$@" || return 10; }
|
__netstat() { [ -f "$(type -P netstat)" ] && netstat "$@" || return 10; }
|
||||||
@@ -675,7 +676,7 @@ __create_service_user() {
|
|||||||
if [ -d "/etc/sudoers.d" ] && [ ! -f "/etc/sudoers.d/$create_user" ]; then
|
if [ -d "/etc/sudoers.d" ] && [ ! -f "/etc/sudoers.d/$create_user" ]; then
|
||||||
echo "$create_user ALL=(ALL) NOPASSWD: ALL" >"/etc/sudoers.d/$create_user"
|
echo "$create_user ALL=(ALL) NOPASSWD: ALL" >"/etc/sudoers.d/$create_user"
|
||||||
elif [ -f "/etc/sudoers" ] && ! grep -qs "$create_user" "/etc/sudoers"; then
|
elif [ -f "/etc/sudoers" ] && ! grep -qs "$create_user" "/etc/sudoers"; then
|
||||||
echo "$create_user ALL=(ALL) NOPASSWD: ALL" >"/etc/sudoers"
|
echo "$create_user ALL=(ALL) NOPASSWD: ALL" ? >>"/etc/sudoers"
|
||||||
fi
|
fi
|
||||||
exitStatus=0
|
exitStatus=0
|
||||||
SERVICE_UID="$create_uid"
|
SERVICE_UID="$create_uid"
|
||||||
@@ -786,8 +787,13 @@ __start_init_scripts() {
|
|||||||
initStatus="0"
|
initStatus="0"
|
||||||
__service_banner "🚫" "Service $service is disabled -" "skipping"
|
__service_banner "🚫" "Service $service is disabled -" "skipping"
|
||||||
unset SERVICE_DISABLED
|
unset SERVICE_DISABLED
|
||||||
|
# Continue to next service
|
||||||
|
elif [ "$CONTAINER_INIT" = "yes" ]; then
|
||||||
|
initStatus="0"
|
||||||
|
__service_banner "✅" "Service $service completed successfully -" "configuration service"
|
||||||
else
|
else
|
||||||
sleep 2
|
# Allow some time for service to initialize
|
||||||
|
sleep 1
|
||||||
# Check for service success indicators
|
# Check for service success indicators
|
||||||
local expected_pid_file="/run/init.d/$service.pid"
|
local expected_pid_file="/run/init.d/$service.pid"
|
||||||
if [ "$SERVICE_USES_PID" = "no" ]; then
|
if [ "$SERVICE_USES_PID" = "no" ]; then
|
||||||
@@ -804,7 +810,6 @@ __start_init_scripts() {
|
|||||||
# Service uses PID tracking - verify actual running processes
|
# Service uses PID tracking - verify actual running processes
|
||||||
set +e # Temporarily disable exit on error
|
set +e # Temporarily disable exit on error
|
||||||
retPID=""
|
retPID=""
|
||||||
|
|
||||||
# First, try to find actual running process with various name patterns
|
# First, try to find actual running process with various name patterns
|
||||||
for name_variant in "$service" "${service}84" "${service}d" "$(echo "$service" | sed 's/-//g')" "$(echo "$service" | tr -d '-')"; do
|
for name_variant in "$service" "${service}84" "${service}d" "$(echo "$service" | sed 's/-//g')" "$(echo "$service" | tr -d '-')"; do
|
||||||
if [ -z "$retPID" ]; then
|
if [ -z "$retPID" ]; then
|
||||||
@@ -812,9 +817,7 @@ __start_init_scripts() {
|
|||||||
[ -n "$retPID" ] && found_process="$name_variant" && break
|
[ -n "$retPID" ] && found_process="$name_variant" && break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
set -e # Re-enable exit on error
|
set -e # Re-enable exit on error
|
||||||
|
|
||||||
if [ -n "$retPID" ] && [ "$retPID" != "0" ]; then
|
if [ -n "$retPID" ] && [ "$retPID" != "0" ]; then
|
||||||
# Found actual running process
|
# Found actual running process
|
||||||
initStatus="0"
|
initStatus="0"
|
||||||
@@ -1264,24 +1267,26 @@ __check_service() {
|
|||||||
}
|
}
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
__switch_to_user() {
|
__switch_to_user() {
|
||||||
if [ "$RUNAS_USER" = "root" ]; then
|
# Use SERVICE_USER if set, otherwise fall back to RUNAS_USER
|
||||||
|
local switch_user="${SERVICE_USER:-$RUNAS_USER}"
|
||||||
|
if [ "$switch_user" = "root" ]; then
|
||||||
su_exec=""
|
su_exec=""
|
||||||
su_cmd() { eval "$@" || return 1; }
|
su_cmd() { eval "$@" || return 1; }
|
||||||
elif [ "$(builtin type -P gosu)" ]; then
|
elif [ "$(builtin type -P gosu)" ]; then
|
||||||
su_exec="gosu $RUNAS_USER"
|
su_exec="gosu $switch_user"
|
||||||
su_cmd() { $su_exec "$@" || return 1; }
|
su_cmd() { $su_exec "$@" || return 1; }
|
||||||
elif [ "$(builtin type -P runuser)" ]; then
|
elif [ "$(builtin type -P runuser)" ]; then
|
||||||
su_exec="runuser -u $RUNAS_USER"
|
su_exec="runuser -u $switch_user"
|
||||||
su_cmd() { $su_exec "$@" || return 1; }
|
su_cmd() { $su_exec "$@" || return 1; }
|
||||||
elif [ "$(builtin type -P sudo)" ]; then
|
elif [ "$(builtin type -P sudo)" ]; then
|
||||||
su_exec="sudo -u $RUNAS_USER"
|
su_exec="sudo -u $switch_user"
|
||||||
su_cmd() { $su_exec "$@" || return 1; }
|
su_cmd() { $su_exec "$@" || return 1; }
|
||||||
elif [ "$(builtin type -P su)" ]; then
|
elif [ "$(builtin type -P su)" ]; then
|
||||||
su_exec="su -s /bin/sh - $RUNAS_USER"
|
su_exec="su -s /bin/sh - $switch_user"
|
||||||
su_cmd() { $su_exec -c "$@" || return 1; }
|
su_cmd() { $su_exec -c "$@" || return 1; }
|
||||||
else
|
else
|
||||||
su_exec=""
|
su_exec=""
|
||||||
su_cmd() { echo "Can not switch to $RUNAS_USER: attempting to run as root" && eval "$@" || return 1; }
|
su_cmd() { echo "Can not switch to $switch_user: attempting to run as root" && eval "$@" || return 1; }
|
||||||
fi
|
fi
|
||||||
export su_exec
|
export su_exec
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user