mirror of
https://github.com/tteck/Proxmox.git
synced 2025-02-15 06:09:15 +01:00
more pruning & code refactoring (#1011)
* improve error handling to show more details * improve the way it checks for root password * consistant getty_override * streamline verbose mode * remove v4 scripts * small tweaks
This commit is contained in:
parent
7cbbb1b38a
commit
c8aa5a029d
280 changed files with 2486 additions and 33413 deletions
|
@ -33,20 +33,14 @@ BFR="\\r\\033[K"
|
|||
HOLD="-"
|
||||
CM="${GN}✓${CL}"
|
||||
CROSS="${RD}✗${CL}"
|
||||
set -o errexit
|
||||
set -o errtrace
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
shopt -s expand_aliases
|
||||
alias die='EXIT=$? LINE=$LINENO error_exit'
|
||||
trap die ERR
|
||||
function error_exit() {
|
||||
trap - ERR
|
||||
local reason="Unknown failure occurred."
|
||||
local msg="${1:-$reason}"
|
||||
local flag="${RD}‼ ERROR ${CL}$EXIT@$LINE"
|
||||
echo -e "$flag $msg" 1>&2
|
||||
exit $EXIT
|
||||
set -Eeuo pipefail
|
||||
trap 'error_handler $LINENO "$BASH_COMMAND"' ERR
|
||||
function error_handler() {
|
||||
local exit_code="$?"
|
||||
local line_number="$1"
|
||||
local command="$2"
|
||||
local error_message="${RD}[ERROR]${CL} in line ${RD}$line_number${CL}: exit code ${RD}$exit_code${CL}: while executing command ${YW}$command${CL}"
|
||||
echo -e "\n$error_message\n"
|
||||
}
|
||||
|
||||
function msg_info() {
|
||||
|
@ -143,7 +137,6 @@ function default_settings() {
|
|||
SSH="no"
|
||||
echo -e "${DGN}Enable Verbose Mode: ${BGN}No${CL}"
|
||||
VERB="no"
|
||||
VERB2="silent"
|
||||
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
||||
}
|
||||
function advanced_settings() {
|
||||
|
@ -318,7 +311,6 @@ function advanced_settings() {
|
|||
else
|
||||
echo -e "${DGN}Enable Verbose Mode: ${BGN}No${CL}"
|
||||
VERB="no"
|
||||
VERB2="silent"
|
||||
fi
|
||||
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
||||
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
||||
|
@ -472,7 +464,6 @@ TEMP_DIR=$(mktemp -d)
|
|||
pushd $TEMP_DIR >/dev/null
|
||||
export DISABLEIPV6=$DISABLEIP6
|
||||
export VERBOSE=$VERB
|
||||
export STD=$VERB2
|
||||
export SSH_ROOT=${SSH}
|
||||
export CTID=$CT_ID
|
||||
export PCT_OSTYPE=$var_os
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue