Changes to config file logic
This commit is contained in:
parent
3199c4565d
commit
247957d40e
@ -30,7 +30,7 @@ curl -fsSL "https://downloads.asterisk.org/pub/telephony/asterisk/${RELEASE}" -o
|
|||||||
mkdir -p /opt/asterisk
|
mkdir -p /opt/asterisk
|
||||||
tar zxf "$temp_file" --strip-components=1 -C /opt/asterisk
|
tar zxf "$temp_file" --strip-components=1 -C /opt/asterisk
|
||||||
cd /opt/asterisk
|
cd /opt/asterisk
|
||||||
msg_ok "Done downloading Asterisk"
|
msg_ok "Downloaded Asterisk"
|
||||||
|
|
||||||
msg_info "Installing Asterisk"
|
msg_info "Installing Asterisk"
|
||||||
$STD ./contrib/scripts/install_prereq install
|
$STD ./contrib/scripts/install_prereq install
|
||||||
|
@ -772,7 +772,6 @@ config_file() {
|
|||||||
exit
|
exit
|
||||||
else
|
else
|
||||||
echo -e "${INFO}${BOLD}${DGN}Using config File: ${BGN}$CONFIG_FILE${CL}"
|
echo -e "${INFO}${BOLD}${DGN}Using config File: ${BGN}$CONFIG_FILE${CL}"
|
||||||
base_settings
|
|
||||||
source "$CONFIG_FILE"
|
source "$CONFIG_FILE"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -813,8 +812,11 @@ config_file() {
|
|||||||
msg_error "Invalid Container ID format. Needs to be 0000-9999 or 0-9999, was ${CT_ID}"
|
msg_error "Invalid Container ID format. Needs to be 0000-9999 or 0-9999, was ${CT_ID}"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
msg_error "Container ID cannot be empty"
|
||||||
|
exit
|
||||||
fi
|
fi
|
||||||
|
if [[ -n "$CT_TYPE" ]]; then
|
||||||
if [[ "$CT_TYPE" -eq 0 ]]; then
|
if [[ "$CT_TYPE" -eq 0 ]]; then
|
||||||
CT_TYPE_DESC="Privileged"
|
CT_TYPE_DESC="Privileged"
|
||||||
elif [[ "$CT_TYPE" -eq 1 ]]; then
|
elif [[ "$CT_TYPE" -eq 1 ]]; then
|
||||||
@ -824,9 +826,12 @@ config_file() {
|
|||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
echo -e "${CONTAINERTYPE}${BOLD}${DGN}Container Type: ${BGN}$CT_TYPE_DESC${CL}"
|
echo -e "${CONTAINERTYPE}${BOLD}${DGN}Container Type: ${BGN}$CT_TYPE_DESC${CL}"
|
||||||
|
else
|
||||||
|
msg_error "Container Type cannot be empty"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ ! -z "$PW" ]]; then
|
if [[ -n "$PW" ]]; then
|
||||||
|
|
||||||
if [[ "$PW" == *" "* ]]; then
|
if [[ "$PW" == *" "* ]]; then
|
||||||
msg_error "Password cannot be empty"
|
msg_error "Password cannot be empty"
|
||||||
exit
|
exit
|
||||||
@ -841,9 +846,8 @@ config_file() {
|
|||||||
PW=""
|
PW=""
|
||||||
echo -e "${VERIFYPW}${BOLD}${DGN}Root Password: ${BGN}Automatic Login${CL}"
|
echo -e "${VERIFYPW}${BOLD}${DGN}Root Password: ${BGN}Automatic Login${CL}"
|
||||||
fi
|
fi
|
||||||
echo -e "${CONTAINERID}${BOLD}${DGN}Container ID: ${BGN}$CT_ID${CL}"
|
|
||||||
|
|
||||||
if [[ ! -z "$HN" ]]; then
|
if [[ -n "$HN" ]]; then
|
||||||
echo -e "${HOSTNAME}${BOLD}${DGN}Hostname: ${BGN}$HN${CL}"
|
echo -e "${HOSTNAME}${BOLD}${DGN}Hostname: ${BGN}$HN${CL}"
|
||||||
else
|
else
|
||||||
msg_error "Hostname cannot be empty"
|
msg_error "Hostname cannot be empty"
|
||||||
@ -862,7 +866,7 @@ config_file() {
|
|||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -z "$CORE_COUNT" ]]; then
|
if [[ -n "$CORE_COUNT" ]]; then
|
||||||
if [[ "$CORE_COUNT" =~ ^-?[0-9]+$ ]]; then
|
if [[ "$CORE_COUNT" =~ ^-?[0-9]+$ ]]; then
|
||||||
echo -e "${CPUCORE}${BOLD}${DGN}CPU Cores: ${BGN}${CORE_COUNT}${CL}"
|
echo -e "${CPUCORE}${BOLD}${DGN}CPU Cores: ${BGN}${CORE_COUNT}${CL}"
|
||||||
else
|
else
|
||||||
@ -874,7 +878,7 @@ config_file() {
|
|||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -z "$RAM_SIZE" ]]; then
|
if [[ -n "$RAM_SIZE" ]]; then
|
||||||
if [[ "$RAM_SIZE" =~ ^-?[0-9]+$ ]]; then
|
if [[ "$RAM_SIZE" =~ ^-?[0-9]+$ ]]; then
|
||||||
echo -e "${RAMSIZE}${BOLD}${DGN}RAM Size: ${BGN}${RAM_SIZE} MiB${CL}"
|
echo -e "${RAMSIZE}${BOLD}${DGN}RAM Size: ${BGN}${RAM_SIZE} MiB${CL}"
|
||||||
else
|
else
|
||||||
@ -914,7 +918,7 @@ config_file() {
|
|||||||
IFS=$OLD_IFS
|
IFS=$OLD_IFS
|
||||||
BRIDGES=$(echo "$BRIDGES" | grep -v '^\s*$' | sort | uniq)
|
BRIDGES=$(echo "$BRIDGES" | grep -v '^\s*$' | sort | uniq)
|
||||||
|
|
||||||
if [[ ! -z "$BRG" ]]; then
|
if [[ -n "$BRG" ]]; then
|
||||||
if echo "$BRIDGES" | grep -q "${BRG}"; then
|
if echo "$BRIDGES" | grep -q "${BRG}"; then
|
||||||
echo -e "${BRIDGE}${BOLD}${DGN}Bridge: ${BGN}$BRG${CL}"
|
echo -e "${BRIDGE}${BOLD}${DGN}Bridge: ${BGN}$BRG${CL}"
|
||||||
else
|
else
|
||||||
@ -929,7 +933,7 @@ config_file() {
|
|||||||
local ip_cidr_regex='^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})/([0-9]{1,2})$'
|
local ip_cidr_regex='^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})/([0-9]{1,2})$'
|
||||||
local ip_regex='^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$'
|
local ip_regex='^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$'
|
||||||
|
|
||||||
if [[ ! -z $NET ]]; then
|
if [[ -n $NET ]]; then
|
||||||
if [ "$NET" == "dhcp" ]; then
|
if [ "$NET" == "dhcp" ]; then
|
||||||
echo -e "${NETWORK}${BOLD}${DGN}IP Address: ${BGN}DHCP${CL}"
|
echo -e "${NETWORK}${BOLD}${DGN}IP Address: ${BGN}DHCP${CL}"
|
||||||
echo -e "${GATEWAY}${BOLD}${DGN}Gateway IP Address: ${BGN}Default${CL}"
|
echo -e "${GATEWAY}${BOLD}${DGN}Gateway IP Address: ${BGN}Default${CL}"
|
||||||
@ -954,7 +958,7 @@ config_file() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [[ ! -z "$APT_CACHER_IP" ]]; then
|
if [[ -n "$APT_CACHER_IP" ]]; then
|
||||||
if [[ "$APT_CACHER_IP" =~ $ip_regex ]]; then
|
if [[ "$APT_CACHER_IP" =~ $ip_regex ]]; then
|
||||||
APT_CACHER="yes"
|
APT_CACHER="yes"
|
||||||
echo -e "${NETWORK}${BOLD}${DGN}APT-CACHER IP Address: ${BGN}$APT_CACHER_IP${CL}"
|
echo -e "${NETWORK}${BOLD}${DGN}APT-CACHER IP Address: ${BGN}$APT_CACHER_IP${CL}"
|
||||||
@ -973,7 +977,7 @@ config_file() {
|
|||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -z "$MTU" ]]; then
|
if [[ -n "$MTU" ]]; then
|
||||||
if [[ "$MTU" =~ ^-?[0-9]+$ ]]; then
|
if [[ "$MTU" =~ ^-?[0-9]+$ ]]; then
|
||||||
echo -e "${DEFAULT}${BOLD}${DGN}Interface MTU Size: ${BGN}$MTU${CL}"
|
echo -e "${DEFAULT}${BOLD}${DGN}Interface MTU Size: ${BGN}$MTU${CL}"
|
||||||
MTU=",mtu=$MTU"
|
MTU=",mtu=$MTU"
|
||||||
@ -987,7 +991,7 @@ config_file() {
|
|||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -z "$SD" ]]; then
|
if [[ -n "$SD" ]]; then
|
||||||
echo -e "${SEARCH}${BOLD}${DGN}DNS Search Domain: ${BGN}$SD${CL}"
|
echo -e "${SEARCH}${BOLD}${DGN}DNS Search Domain: ${BGN}$SD${CL}"
|
||||||
SD="-searchdomain=$SD"
|
SD="-searchdomain=$SD"
|
||||||
else
|
else
|
||||||
@ -995,7 +999,7 @@ config_file() {
|
|||||||
echo -e "${SEARCH}${BOLD}${DGN}DNS Search Domain: ${BGN}HOST${CL}"
|
echo -e "${SEARCH}${BOLD}${DGN}DNS Search Domain: ${BGN}HOST${CL}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -z "$NS" ]]; then
|
if [[ -n "$NS" ]]; then
|
||||||
if [[ "$NS" =~ $ip_regex ]]; then
|
if [[ "$NS" =~ $ip_regex ]]; then
|
||||||
echo -e "${NETWORK}${BOLD}${DGN}DNS Server IP Address: ${BGN}$NS${CL}"
|
echo -e "${NETWORK}${BOLD}${DGN}DNS Server IP Address: ${BGN}$NS${CL}"
|
||||||
NS="-nameserver=$NS"
|
NS="-nameserver=$NS"
|
||||||
@ -1008,7 +1012,7 @@ config_file() {
|
|||||||
echo -e "${NETWORK}${BOLD}${DGN}DNS Server IP Address: ${BGN}HOST${CL}"
|
echo -e "${NETWORK}${BOLD}${DGN}DNS Server IP Address: ${BGN}HOST${CL}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -z "$MAC" ]]; then
|
if [[ -n "$MAC" ]]; then
|
||||||
if [[ "$MAC" =~ ^([A-Fa-f0-9]{2}:){5}[A-Fa-f0-9]{2}$ ]]; then
|
if [[ "$MAC" =~ ^([A-Fa-f0-9]{2}:){5}[A-Fa-f0-9]{2}$ ]]; then
|
||||||
echo -e "${MACADDRESS}${BOLD}${DGN}MAC Address: ${BGN}$MAC${CL}"
|
echo -e "${MACADDRESS}${BOLD}${DGN}MAC Address: ${BGN}$MAC${CL}"
|
||||||
MAC=",hwaddr=$MAC"
|
MAC=",hwaddr=$MAC"
|
||||||
@ -1016,9 +1020,11 @@ config_file() {
|
|||||||
msg_error "MAC Address must be in the format xx:xx:xx:xx:xx:xx, was ${MAC}"
|
msg_error "MAC Address must be in the format xx:xx:xx:xx:xx:xx, was ${MAC}"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
msg_error "MAC Address cannot be empty"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -z "$VLAN" ]]; then
|
if [[ -n "$VLAN" ]]; then
|
||||||
if [[ "$VLAN" =~ ^-?[0-9]+$ ]]; then
|
if [[ "$VLAN" =~ ^-?[0-9]+$ ]]; then
|
||||||
echo -e "${VLANTAG}${BOLD}${DGN}Vlan: ${BGN}$VLAN${CL}"
|
echo -e "${VLANTAG}${BOLD}${DGN}Vlan: ${BGN}$VLAN${CL}"
|
||||||
VLAN=",tag=$VLAN"
|
VLAN=",tag=$VLAN"
|
||||||
@ -1028,10 +1034,11 @@ config_file() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -z "$TAGS" ]]; then
|
if [[ -n "$TAGS" ]]; then
|
||||||
echo -e "${NETWORK}${BOLD}${DGN}Tags: ${BGN}$TAGS${CL}"
|
echo -e "${NETWORK}${BOLD}${DGN}Tags: ${BGN}$TAGS${CL}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ -n "$SSH" ]]; then
|
||||||
if [[ "$SSH" == "yes" ]]; then
|
if [[ "$SSH" == "yes" ]]; then
|
||||||
echo -e "${ROOTSSH}${BOLD}${DGN}Root SSH Access: ${BGN}$SSH${CL}"
|
echo -e "${ROOTSSH}${BOLD}${DGN}Root SSH Access: ${BGN}$SSH${CL}"
|
||||||
if [[ ! -z "$SSH_AUTHORIZED_KEY" ]]; then
|
if [[ ! -z "$SSH_AUTHORIZED_KEY" ]]; then
|
||||||
@ -1045,7 +1052,12 @@ config_file() {
|
|||||||
msg_error "SSH needs to be 'yes' or 'no', was ${SSH}"
|
msg_error "SSH needs to be 'yes' or 'no', was ${SSH}"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
SSH="no"
|
||||||
|
echo -e "${ROOTSSH}${BOLD}${DGN}Root SSH Access: ${BGN}$SSH${CL}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n "$VERBOSE" ]]; then
|
||||||
if [[ "$VERBOSE" == "yes" ]]; then
|
if [[ "$VERBOSE" == "yes" ]]; then
|
||||||
echo -e "${SEARCH}${BOLD}${DGN}Verbose Mode: ${BGN}$VERBOSE${CL}"
|
echo -e "${SEARCH}${BOLD}${DGN}Verbose Mode: ${BGN}$VERBOSE${CL}"
|
||||||
elif [[ "$VERBOSE" == "no" ]]; then
|
elif [[ "$VERBOSE" == "no" ]]; then
|
||||||
@ -1054,6 +1066,10 @@ config_file() {
|
|||||||
msg_error "Verbose Mode needs to be 'yes' or 'no', was ${VERBOSE}"
|
msg_error "Verbose Mode needs to be 'yes' or 'no', was ${VERBOSE}"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
VERBOSE="no"
|
||||||
|
echo -e "${SEARCH}${BOLD}${DGN}Verbose Mode: ${BGN}No${CL}"
|
||||||
|
fi
|
||||||
|
|
||||||
if (whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "ADVANCED SETTINGS WITH CONFIG FILE COMPLETE" --yesno "Ready to create ${APP} LXC?" 10 58); then
|
if (whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "ADVANCED SETTINGS WITH CONFIG FILE COMPLETE" --yesno "Ready to create ${APP} LXC?" 10 58); then
|
||||||
echo -e "${CREATING}${BOLD}${RD}Creating a ${APP} LXC using the above settings${CL}"
|
echo -e "${CREATING}${BOLD}${RD}Creating a ${APP} LXC using the above settings${CL}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user