80 lines
2.1 KiB
Bash
Executable File
80 lines
2.1 KiB
Bash
Executable File
#!/bin/bash
|
|
### Copyright 1999-2025. WebPros International GmbH. All rights reserved.
|
|
#
|
|
|
|
#
|
|
# Plesk script
|
|
#
|
|
|
|
|
|
|
|
#default values
|
|
|
|
### Copyright 1999-2025. WebPros International GmbH. All rights reserved.
|
|
reexec_with_clean_env()
|
|
{
|
|
# Usage: call this function as 'reexec_with_clean_env "$@"' at the start of a script.
|
|
# Don't use with scripts that require sensitive environment variables.
|
|
# Don't put the call under any input/output redirection.
|
|
# Purpose: make sure the script is executed with a sane environment.
|
|
|
|
local lc="`get_default_locale`"
|
|
export LANG="$lc" LC_MESSAGES="$lc" LC_ALL="$lc"
|
|
export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
|
|
umask 022
|
|
|
|
PLESK_SCRIPT_COMMAND_LINE="$0 $*"
|
|
[ -z "$PLESK_INSTALLER_ENV_CLEANED" ] || { unset PLESK_INSTALLER_ENV_CLEANED; return 0; }
|
|
[ -n "$BASH" ] || exec /bin/bash "$0" "$@"
|
|
|
|
# N.B.: the following code requires Bash. On Dash it would cause syntax error upon parse w/o eval.
|
|
eval '
|
|
local extra_vars=() # list of variables to preserve
|
|
for var in "${!PLESK_@}"; do # enumerate all PLESK_* variables
|
|
extra_vars+=("$var=${!var}")
|
|
done
|
|
extra_vars+=("PLESK_INSTALLER_ENV_CLEANED=1")
|
|
|
|
# Exec self with clean env except for extra_vars, shell opts, and arguments.
|
|
exec /usr/bin/env -i "${extra_vars[@]}" /bin/bash ${-:+-$-} "$0" "$@" || {
|
|
echo "Failed to reexec self ($0) with clean environment" >&2
|
|
exit 91 # Just some relatively unique error code
|
|
}
|
|
'
|
|
}
|
|
|
|
get_default_locale()
|
|
{
|
|
# Note that CentOS 7 typically doesn't have C.UTF-8
|
|
for lc in "C.UTF-8" "en_US.UTF-8" "C"; do
|
|
if [ -z "`LC_ALL=$lc locale 2>&1 >/dev/null`" ]; then
|
|
echo "$lc"
|
|
return 0
|
|
fi
|
|
done
|
|
echo "C"
|
|
}
|
|
|
|
#!/bin/bash
|
|
### Copyright 1999-2025. WebPros International GmbH. All rights reserved.
|
|
|
|
reexec_with_clean_env "$@"
|
|
|
|
out()
|
|
{
|
|
echo "$*"
|
|
}
|
|
|
|
print_banner()
|
|
{
|
|
out
|
|
out "This server is powered by Plesk."
|
|
out
|
|
out "Run the 'plesk login' command and log in by browsing either of the links received in the output."
|
|
out "Use the 'plesk' command to manage the server. Run 'plesk help' for more info."
|
|
out
|
|
}
|
|
|
|
print_banner
|
|
exit 0
|