correct exit codes

This commit is contained in:
MickLesk
2026-08-03 10:28:52 +02:00
parent 1ac9af2add
commit b3550b99e0
5 changed files with 9 additions and 9 deletions
+5 -5
View File
@@ -134,7 +134,7 @@ function select_storage() {
;; ;;
*) *)
msg_error "Invalid storage class." msg_error "Invalid storage class."
exit 1 exit 112
;; ;;
esac esac
@@ -156,7 +156,7 @@ function select_storage() {
if [ $((${#MENU[@]} / 3)) -eq 0 ]; then if [ $((${#MENU[@]} / 3)) -eq 0 ]; then
msg_warn "'$CONTENT_LABEL' needs to be selected for at least one storage location." msg_warn "'$CONTENT_LABEL' needs to be selected for at least one storage location."
msg_error "Unable to detect valid storage location." msg_error "Unable to detect valid storage location."
exit 1 if [[ "$CONTENT" == "rootdir" ]]; then exit 119; else exit 120; fi
elif [ $((${#MENU[@]} / 3)) -eq 1 ]; then elif [ $((${#MENU[@]} / 3)) -eq 1 ]; then
printf ${MENU[0]} printf ${MENU[0]}
else else
@@ -167,7 +167,7 @@ function select_storage() {
16 $(($MSG_MAX_LENGTH + 23)) 6 \ 16 $(($MSG_MAX_LENGTH + 23)) 6 \
"${MENU[@]}" 3>&1 1>&2 2>&3) || { "${MENU[@]}" 3>&1 1>&2 2>&3) || {
msg_error "Menu aborted." msg_error "Menu aborted."
exit 1 exit 254
} }
done done
printf $STORAGE printf $STORAGE
@@ -186,7 +186,7 @@ msg_info "Using '$CONTAINER_STORAGE' for container storage."
msg_info "Downloading LXC template (Patience)" msg_info "Downloading LXC template (Patience)"
pveam download $TEMPLATE_STORAGE $TEMPLATE >/dev/null || { pveam download $TEMPLATE_STORAGE $TEMPLATE >/dev/null || {
msg_error "A problem occured while downloading the LXC template." msg_error "A problem occured while downloading the LXC template."
exit 1 exit 222
} }
msg_ok "Downloaded LXC template" msg_ok "Downloaded LXC template"
@@ -198,7 +198,7 @@ PCT_OPTIONS=(${PCT_OPTIONS[@]:-${DEFAULT_PCT_OPTIONS[@]}})
msg_info "Creating LXC container" msg_info "Creating LXC container"
pct create $CTID ${TEMPLATE_STORAGE}:vztmpl/${TEMPLATE} "${PCT_OPTIONS[@]}" >/dev/null || { pct create $CTID ${TEMPLATE_STORAGE}:vztmpl/${TEMPLATE} "${PCT_OPTIONS[@]}" >/dev/null || {
msg_error "A problem occured while trying to create container." msg_error "A problem occured while trying to create container."
exit 1 exit 209
} }
msg_ok "Created LXC container" msg_ok "Created LXC container"
+1 -1
View File
@@ -96,7 +96,7 @@ EOF
systemctl restart code-server@"$USER" systemctl restart code-server@"$USER"
if ! systemctl is-active --quiet code-server@"$USER"; then if ! systemctl is-active --quiet code-server@"$USER"; then
msg_error "code-server service failed to start." msg_error "code-server service failed to start."
exit 1 exit 150
fi fi
msg_ok "Installed ${APP}" msg_ok "Installed ${APP}"
+1 -1
View File
@@ -75,7 +75,7 @@ function install() {
msg_ok "Created user 'brew'" msg_ok "Created user 'brew'"
else else
msg_error "Cannot install Homebrew without a non-root user. Exiting." msg_error "Cannot install Homebrew without a non-root user. Exiting."
exit 1 exit 254
fi fi
fi fi
msg_ok "Detected User: $BREW_USER" msg_ok "Detected User: $BREW_USER"
+1 -1
View File
@@ -150,7 +150,7 @@ function ensure_openssl() {
$STD apt-get install -y openssl $STD apt-get install -y openssl
else else
msg_error "openssl is required but could not be installed automatically." msg_error "openssl is required but could not be installed automatically."
exit 10 exit 237
fi fi
msg_ok "Installed openssl" msg_ok "Installed openssl"
} }
+1 -1
View File
@@ -40,7 +40,7 @@ detect_codename() {
CODENAME="${VERSION_CODENAME:-}" CODENAME="${VERSION_CODENAME:-}"
if [[ -z "$CODENAME" ]]; then if [[ -z "$CODENAME" ]]; then
msg_error "Could not detect Debian codename." msg_error "Could not detect Debian codename."
exit 71 exit 238
fi fi
echo "$CODENAME" echo "$CODENAME"
} }