From 38381bb6ef8c3b1333509617291502acea62ac7e Mon Sep 17 00:00:00 2001 From: tteckster Date: Wed, 22 Mar 2023 14:59:10 -0400 Subject: [PATCH] indentation --- misc/alpine-install.func | 53 +++++++++++++++++++++++----------------- misc/install.func | 37 +++++++++++++++++----------- 2 files changed, 54 insertions(+), 36 deletions(-) diff --git a/misc/alpine-install.func b/misc/alpine-install.func index ddc78877..f2f74a08 100644 --- a/misc/alpine-install.func +++ b/misc/alpine-install.func @@ -16,9 +16,15 @@ color() { } verb_ip6() { - if [ "$VERBOSE" = "yes" ]; then set -x; STD=""; else STD="silent"; fi - silent() { "$@" > /dev/null 2>&1; } - if [ "$DISABLEIPV6" == "yes" ]; then echo "net.ipv6.conf.all.disable_ipv6 = 1" >>/etc/sysctl.conf; $STD sysctl -p; fi + if [ "$VERBOSE" = "yes" ]; then + set -x + STD="" + else STD="silent"; fi + silent() { "$@" >/dev/null 2>&1; } + if [ "$DISABLEIPV6" == "yes" ]; then + echo "net.ipv6.conf.all.disable_ipv6 = 1" >>/etc/sysctl.conf + $STD sysctl -p + fi } catch_errors() { @@ -51,21 +57,21 @@ msg_error() { setting_up_container() { msg_info "Setting up Container OS" -while [ $i -gt 0 ]; do - if [ "$(ip addr show | grep 'inet ' | grep -v '127.0.0.1' | awk '{print $2}' | cut -d'/' -f1)" != "" ]; then - break - fi - echo 1>&2 -en "${CROSS}${RD} No Network! " - sleep $RETRY_EVERY - i=$((i-1)) -done + while [ $i -gt 0 ]; do + if [ "$(ip addr show | grep 'inet ' | grep -v '127.0.0.1' | awk '{print $2}' | cut -d'/' -f1)" != "" ]; then + break + fi + echo 1>&2 -en "${CROSS}${RD} No Network! " + sleep $RETRY_EVERY + i=$((i - 1)) + done -if [ "$(ip addr show | grep 'inet ' | grep -v '127.0.0.1' | awk '{print $2}' | cut -d'/' -f1)" = "" ]; then - echo 1>&2 -e "\n${CROSS}${RD} No Network After $RETRY_NUM Tries${CL}" - echo -e " 🖧 Check Network Settings" - exit 1 -fi -cat </etc/apk/repositories + if [ "$(ip addr show | grep 'inet ' | grep -v '127.0.0.1' | awk '{print $2}' | cut -d'/' -f1)" = "" ]; then + echo 1>&2 -e "\n${CROSS}${RD} No Network After $RETRY_NUM Tries${CL}" + echo -e " 🖧 Check Network Settings" + exit 1 + fi + cat </etc/apk/repositories https://dl-cdn.alpinelinux.org/alpine/edge/main https://dl-cdn.alpinelinux.org/alpine/edge/community https://dl-cdn.alpinelinux.org/alpine/edge/testing @@ -77,7 +83,7 @@ EOF network_check() { set +e trap - ERR - if ping -c 1 -W 1 1.1.1.1 &> /dev/null; then msg_ok "Internet Connected"; else + if ping -c 1 -W 1 1.1.1.1 &>/dev/null; then msg_ok "Internet Connected"; else msg_error "Internet NOT Connected" read -r -p "Would you like to continue anyway? " prompt if echo "$prompt" | grep -Eq "^(y|yes)$"; then @@ -101,7 +107,10 @@ update_os() { } motd_ssh() { -echo "export TERM='xterm-256color'" >>/root/.bashrc -echo -e "$APPLICATION LXC provided by https://tteck.github.io/Proxmox/\n" > /etc/motd -if [[ "${SSH_ROOT}" == "yes" ]]; then $STD rc-update add sshd; $STD /etc/init.d/sshd start; fi -} \ No newline at end of file + echo "export TERM='xterm-256color'" >>/root/.bashrc + echo -e "$APPLICATION LXC provided by https://tteck.github.io/Proxmox/\n" >/etc/motd + if [[ "${SSH_ROOT}" == "yes" ]]; then + $STD rc-update add sshd + $STD /etc/init.d/sshd start + fi +} diff --git a/misc/install.func b/misc/install.func index 47b35773..a2fa99e0 100644 --- a/misc/install.func +++ b/misc/install.func @@ -15,9 +15,15 @@ color() { } verb_ip6() { - if [ "$VERBOSE" = "yes" ]; then set -x; STD=""; else STD="silent"; fi - silent() { "$@" > /dev/null 2>&1; } - if [ "$DISABLEIPV6" == "yes" ]; then echo "net.ipv6.conf.all.disable_ipv6 = 1" >>/etc/sysctl.conf; $STD sysctl -p; fi + if [ "$VERBOSE" = "yes" ]; then + set -x + STD="" + else STD="silent"; fi + silent() { "$@" >/dev/null 2>&1; } + if [ "$DISABLEIPV6" == "yes" ]; then + echo "net.ipv6.conf.all.disable_ipv6 = 1" >>/etc/sysctl.conf + $STD sysctl -p + fi } catch_errors() { @@ -52,14 +58,14 @@ setting_up_container() { msg_info "Setting up Container OS" sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen locale-gen >/dev/null - echo $tz > /etc/timezone + echo $tz >/etc/timezone ln -sf /usr/share/zoneinfo/$tz /etc/localtime - for ((i=RETRY_NUM; i>0; i--)); do + for ((i = RETRY_NUM; i > 0; i--)); do if [ "$(hostname -I)" != "" ]; then break fi - echo 1>&2 -en "${CROSS}${RD} No Network! " - sleep $RETRY_EVERY + echo 1>&2 -en "${CROSS}${RD} No Network! " + sleep $RETRY_EVERY done if [ "$(hostname -I)" = "" ]; then echo 1>&2 -e "\n${CROSS}${RD} No Network After $RETRY_NUM Tries${CL}" @@ -73,7 +79,7 @@ setting_up_container() { network_check() { set +e trap - ERR - if ping -c 1 -W 1 1.1.1.1 &> /dev/null; then msg_ok "Internet Connected"; else + if ping -c 1 -W 1 1.1.1.1 &>/dev/null; then msg_ok "Internet Connected"; else msg_error "Internet NOT Connected" read -r -p "Would you like to continue anyway? " prompt if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then @@ -97,10 +103,13 @@ update_os() { } motd_ssh() { -echo "export TERM='xterm-256color'" >>/root/.bashrc -echo -e "$APPLICATION LXC provided by https://tteck.github.io/Proxmox/\n" > /etc/motd -chmod -x /etc/update-motd.d/* -if [[ "${SSH_ROOT}" == "yes" ]]; then sed -i "s/#PermitRootLogin prohibit-password/PermitRootLogin yes/g" /etc/ssh/sshd_config; systemctl restart sshd; fi + echo "export TERM='xterm-256color'" >>/root/.bashrc + echo -e "$APPLICATION LXC provided by https://tteck.github.io/Proxmox/\n" >/etc/motd + chmod -x /etc/update-motd.d/* + if [[ "${SSH_ROOT}" == "yes" ]]; then + sed -i "s/#PermitRootLogin prohibit-password/PermitRootLogin yes/g" /etc/ssh/sshd_config + systemctl restart sshd + fi } customize() { @@ -119,6 +128,6 @@ EOF root() { if ! getent shadow root | grep -q "^root:[^\!*]"; then - customize + customize fi -} \ No newline at end of file +}