11#! /usr/bin/env bash
22# Copyright (c) 2021-2025 community-scripts ORG
3- # Author: Michel Roegl-Brunner ( michelroegl-brunner)
3+ # Author: michelroegl-brunner
44# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
55
66color () {
77 return
88}
9+
10+ SCRIPT_NAME=" ${BASH_SOURCE[0]:- unknown_script} "
911catch_errors () {
10- set -Eeuo pipefail
12+ set -Euoe pipefail
1113 trap ' error_handler $LINENO "$BASH_COMMAND"' ERR
1214}
1315
14-
1516error_handler () {
1617 local line_number=" $1 "
1718 local command=" $2 "
18- SCRIPT_NAME=$( basename " $0 " )
19- local error_message=" $SCRIPT_NAME : Failure in line $line_number while executing command $command "
19+ local error_message=" $SCRIPT_NAME : Failure in line $line_number while executing command '$command '"
2020 echo -e " \n$error_message "
21- exit 200
21+ exit 300
2222}
23+
2324verb_ip6 () {
24- STD=" "
25- return
25+ STD=" silent"
26+ silent () {
27+ " $@ " > /dev/null 2>&1 || error_handler " ${BASH_LINENO[0]} " " $* "
28+ }
2629}
2730
2831msg_info () {
@@ -40,11 +43,9 @@ msg_error() {
4043 local msg=" $1 "
4144 echo -e " ${msg} \n"
4245}
43-
44- RETRY_NUM=10
45- RETRY_EVERY=3
46+ RETRY_NUM=10
47+ RETRY_EVERY=3
4648setting_up_container () {
47-
4849 sed -i " /$LANG / s/\(^# \)//" /etc/locale.gen
4950 locale_line=$( grep -v ' ^#' /etc/locale.gen | grep -E ' ^[a-zA-Z]' | awk ' {print $1}' | head -n 1)
5051 echo " LANG=${locale_line} " > /etc/default/locale
@@ -57,6 +58,7 @@ setting_up_container() {
5758 if [ " $( hostname -I) " != " " ]; then
5859 break
5960 fi
61+ echo 1>&2 -en " No Network! "
6062 sleep $RETRY_EVERY
6163 done
6264 if [ " $( hostname -I) " = " " ]; then
@@ -66,6 +68,8 @@ setting_up_container() {
6668 fi
6769 rm -rf /usr/lib/python3.* /EXTERNALLY-MANAGED
6870 systemctl disable -q --now systemd-networkd-wait-online.service
71+ msg_ok " Set up Container OS"
72+ msg_ok " Network Connected: $( hostname -I) "
6973}
7074
7175network_check () {
@@ -75,10 +79,11 @@ network_check() {
7579}
7680
7781update_os () {
78- export DEBIAN_FRONTEND=noninteractive
79- apt-get update > /dev/null 2>&1
80- apt-get -o Dpkg::Options::=" --force-confold" -y dist-upgrade > /dev/null 2>&1
81- rm -rf /usr/lib/python3.* /EXTERNALLY-MANAGED
82+ msg_info " Updating Container OS"
83+ apt-get update
84+ apt-get -o Dpkg::Options::=" --force-confold" -y dist-upgrade
85+ rm -rf /usr/lib/python3.* /EXTERNALLY-MANAGED
86+ msg_ok " Updated Container OS"
8287}
8388
8489motd_ssh () {
@@ -87,6 +92,4 @@ motd_ssh() {
8792
8893customize () {
8994 return
90- }
91-
92-
95+ }
0 commit comments