Update build.func

provide the option for users to switch between Debian and Ubuntu distributions
This commit is contained in:
tteckster 2023-04-23 18:09:32 -04:00 committed by GitHub
parent 4744ccb562
commit 34d311371c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 48 additions and 19 deletions

View File

@ -79,9 +79,8 @@ ssh_check() {
} }
echo_default() { echo_default() {
if [ "$var_os" == "ubuntu" ]; then echo -e "${DGN}Using Distribution: ${BGN}$var_os${CL}"
echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}" echo -e "${DGN}Using $var_os Version: ${BGN}$var_version${CL}"
fi
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}" echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}" echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
@ -113,26 +112,56 @@ exit-script() {
} }
advanced_settings() { advanced_settings() {
if [ "$var_os" != "alpine" ]; then
var_os=""
while [ -z "$var_os" ]; do
if var_os=$(whiptail --title "DISTRIBUTION" --radiolist "Choose" 10 58 2 \
"debian" "" OFF \
"ubuntu" "" OFF \
3>&1 1>&2 2>&3); then
if [ -n "$var_os" ]; then
echo -e "${DGN}Using Distribution: ${BGN}$var_os${CL}"
fi
else
exit-script
fi
done
fi
if [ "$var_os" == "debian" ]; then
var_version="11"
fi
if [ "$var_os" == "ubuntu" ]; then if [ "$var_os" == "ubuntu" ]; then
if var_version=$(whiptail --title "UBUNTU VERSION" --radiolist "Choose Version" 10 58 3 \ var_version=""
"20.04" "Focal" ON \ while [ -z "$var_version" ]; do
"22.04" "Jammy" OFF \ if var_version=$(whiptail --title "UBUNTU VERSION" --radiolist "Choose Version" 10 58 3 \
"22.10" "Kinetic" OFF \ "20.04" "Focal" OFF \
"22.04" "Jammy" OFF \
"22.10" "Kinetic" OFF \
3>&1 1>&2 2>&3); then
if [ -n "$var_version" ]; then
echo -e "${DGN}Using Ubuntu Version: ${BGN}$var_version${CL}"
fi
else
exit-script
fi
done
fi
CT_TYPE=""
while [ -z "$CT_TYPE" ]; do
if CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 10 58 2 \
"1" "Unprivileged" OFF \
"0" "Privileged" OFF \
3>&1 1>&2 2>&3); then 3>&1 1>&2 2>&3); then
echo -e "${DGN}Using Ubuntu Version: ${BGN}$var_version${CL}" if [ -n "$CT_TYPE" ]; then
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
fi
else else
exit-script exit-script
fi fi
fi done
if CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 10 58 2 \
"1" "Unprivileged" ON \
"0" "Privileged" OFF \
3>&1 1>&2 2>&3); then
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
else
exit-script
fi
if PW1=$(whiptail --inputbox "\nSet Root Password (needed for root ssh access)" 9 58 --title "PASSWORD(leave blank for automatic login)" 3>&1 1>&2 2>&3); then if PW1=$(whiptail --inputbox "\nSet Root Password (needed for root ssh access)" 9 58 --title "PASSWORD(leave blank for automatic login)" 3>&1 1>&2 2>&3); then
if [ -z $PW1 ]; then if [ -z $PW1 ]; then
@ -468,7 +497,7 @@ EOF
sleep 2 sleep 2
pct exec "$CTID" -- ash -c "apk add bash >/dev/null" pct exec "$CTID" -- ash -c "apk add bash >/dev/null"
fi fi
lxc-attach -n "$CTID" -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$var_install.sh)" || exit lxc-attach -n "$CTID" -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/dev/install/$var_install.sh)" || exit
} }