Merge pull request #20 from ajschroeder/develop

merge develop into main
This commit is contained in:
TheHitman1977
2026-02-21 07:01:46 -06:00
committed by GitHub
19 changed files with 103 additions and 827 deletions

916
build.sh
View File

@@ -48,30 +48,85 @@ if [ "$debug_mode" = true ]; then
menu_message+=" \e[31m(Debug Mode)\e[0m" menu_message+=" \e[31m(Debug Mode)\e[0m"
fi fi
menu_option_1() { # Menu registry
INPUT_PATH="$SCRIPT_PATH"/builds/linux/almalinux/10/ # Format: key="Label|RelativeInputPath"
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"} declare -A MENU_ITEMS=(
[1]="AlmaLinux 10|linux/almalinux/10"
[2]="AlmaLinux 9|linux/almalinux/9"
[3]="AlmaLinux 8|linux/almalinux/8"
[4]="CentOS 10 Stream|linux/centos/10-stream"
[5]="CentOS 9 Stream|linux/centos/9-stream"
[6]="Debian 12 (Bookworm)|linux/debian/12"
[7]="Debian 12 (Bullseye)|linux/debian/11"
[8]="openSUSE Leap 15.6|linux/opensuse/leap-15-6"
[9]="openSUSE Leap 15.5|linux/opensuse/leap-15-5"
[10]="Oracle Linux 9|linux/oracle/9"
[11]="Oracle Linux 8|linux/oracle/8"
[12]="Rocky Linux 10|linux/rocky/10"
[13]="Rocky Linux 9|linux/rocky/9"
[14]="Rocky Linux 8|linux/rocky/8"
[15]="Ubuntu Server 25.04|linux/ubuntu/25-04"
[16]="Ubuntu Server 24.04 LTS|linux/ubuntu/24-04-lts"
[17]="Ubuntu Server 22.04|linux/ubuntu/22-04-lts"
[18]="Ubuntu Server 20.04|linux/ubuntu/20-04-lts"
[19]="Windows 11 - All|windows/desktop/11|"
[20]="Windows 11 - Enterprise|windows/desktop/11|--only proxmox-iso.windows-desktop-ent"
[21]="Windows 11 - Professional|windows/desktop/11|--only proxmox-iso.windows-desktop-pro"
[I]="Information|info"
[Q]="Quit|quit_program"
)
build_template() {
local label="$1"
local relative_path="$2"
local extra_args="$3"
INPUT_PATH="$SCRIPT_PATH/builds/$relative_path"
BUILD_PATH="${relative_path}"
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl" BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
echo -e "\nCONFIRM: Build a AlmaLinux 10 Template for Proxmox?" # List of required var files
echo -e "\nContinue? (y/n)" local var_files=(
read -r REPLY "$CONFIG_PATH/ansible.pkrvars.hcl"
if [[ ! $REPLY =~ ^[Yy]$ ]] "$CONFIG_PATH/build.pkrvars.hcl"
then "$CONFIG_PATH/common.pkrvars.hcl"
exit 1 "$CONFIG_PATH/linux-storage.pkrvars.hcl"
"$CONFIG_PATH/network.pkrvars.hcl"
"$CONFIG_PATH/proxmox.pkrvars.hcl"
"$CONFIG_PATH/$BUILD_VARS"
)
# Validate all var files exist
local missing_files=()
for file in "${var_files[@]}"; do
if [[ ! -f "$file" ]]; then
missing_files+=("$file")
fi
done
if [[ ${#missing_files[@]} -ne 0 ]]; then
echo "Error: The following required .pkrvars.hcl files are missing:"
for f in "${missing_files[@]}"; do
echo " - $f"
done
echo "Aborting build."
return 1
fi fi
### Build a AlmaLinux 10 Template for Proxmox. ### # Confirmation prompt
echo "Building a AlmaLinux 10 Template for Proxmox..." echo -e "\nCONFIRM: Build a $label Template for Proxmox?"
read -rp "Continue? (y/n) " REPLY
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo "Aborted."
return
fi
### Initialize HashiCorp Packer and required plugins. ### echo "Building a $label Template for Proxmox..."
echo "Initializing HashiCorp Packer and required plugins..." echo "Initializing HashiCorp Packer and required plugins..."
packer init "$INPUT_PATH" packer init "$INPUT_PATH"
### Start the Build. ### echo "Starting the build..."
echo "Starting the build...." packer build -force -on-error=ask $debug_option $extra_args \
echo "packer build -force -on-error=ask $debug_option"
packer build -force -on-error=ask $debug_option \
-var-file="$CONFIG_PATH/ansible.pkrvars.hcl" \ -var-file="$CONFIG_PATH/ansible.pkrvars.hcl" \
-var-file="$CONFIG_PATH/build.pkrvars.hcl" \ -var-file="$CONFIG_PATH/build.pkrvars.hcl" \
-var-file="$CONFIG_PATH/common.pkrvars.hcl" \ -var-file="$CONFIG_PATH/common.pkrvars.hcl" \
@@ -81,748 +136,24 @@ menu_option_1() {
-var-file="$CONFIG_PATH/$BUILD_VARS" \ -var-file="$CONFIG_PATH/$BUILD_VARS" \
"$INPUT_PATH" "$INPUT_PATH"
### All done. ###
echo "Done." echo "Done."
} }
menu_option_2() { dispatch_selection() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/almalinux/9/ entry="${MENU_ITEMS[$selection]}"
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"} if [[ -z "$entry" ]]; then
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl" echo "Invalid selection."
return
echo -e "\nCONFIRM: Build a AlmaLinux 9 Template for Proxmox?"
echo -e "\nContinue? (y/n)"
read -r REPLY
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 1
fi fi
### Build a AlmaLinux 9 Template for Proxmox. ### IFS='|' read -r label path_or_function extra_args <<< "$entry"
echo "Building a AlmaLinux 9 Template for Proxmox..."
### Initialize HashiCorp Packer and required plugins. ### # Decide if its a build or a function
echo "Initializing HashiCorp Packer and required plugins..." if [[ -d "$SCRIPT_PATH/builds/$path_or_function" ]]; then
packer init "$INPUT_PATH" build_template "$label" "$path_or_function" "$extra_args"
else
### Start the Build. ### $path_or_function
echo "Starting the build...."
echo "packer build -force -on-error=ask $debug_option"
packer build -force -on-error=ask $debug_option \
-var-file="$CONFIG_PATH/ansible.pkrvars.hcl" \
-var-file="$CONFIG_PATH/build.pkrvars.hcl" \
-var-file="$CONFIG_PATH/common.pkrvars.hcl" \
-var-file="$CONFIG_PATH/linux-storage.pkrvars.hcl" \
-var-file="$CONFIG_PATH/network.pkrvars.hcl" \
-var-file="$CONFIG_PATH/proxmox.pkrvars.hcl" \
-var-file="$CONFIG_PATH/$BUILD_VARS" \
"$INPUT_PATH"
### All done. ###
echo "Done."
}
menu_option_3() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/almalinux/8/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
echo -e "\nCONFIRM: Build a AlmaLinux 8 Template for Proxmox?"
echo -e "\nContinue? (y/n)"
read -r REPLY
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 1
fi fi
### Build a AlmaLinux 8 Template for Proxmox. ###
echo "Building a AlmaLinux 8 Template for Proxmox..."
### Initialize HashiCorp Packer and required plugins. ###
echo "Initializing HashiCorp Packer and required plugins..."
packer init "$INPUT_PATH"
### Start the Build. ###
echo "Starting the build...."
echo "packer build -force -on-error=ask $debug_option"
packer build -force -on-error=ask $debug_option \
-var-file="$CONFIG_PATH/ansible.pkrvars.hcl" \
-var-file="$CONFIG_PATH/build.pkrvars.hcl" \
-var-file="$CONFIG_PATH/common.pkrvars.hcl" \
-var-file="$CONFIG_PATH/linux-storage.pkrvars.hcl" \
-var-file="$CONFIG_PATH/network.pkrvars.hcl" \
-var-file="$CONFIG_PATH/proxmox.pkrvars.hcl" \
-var-file="$CONFIG_PATH/$BUILD_VARS" \
"$INPUT_PATH"
### All done. ###
echo "Done."
}
menu_option_4() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/centos/10-stream/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
echo -e "\nCONFIRM: Build a CentOS 10 Stream Template for Proxmox?"
echo -e "\nContinue? (y/n)"
read -r REPLY
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 1
fi
### Build a CentOS 10 Stream Template for Proxmox. ###
echo "Building a CentOS 10 Stream Template for Proxmox..."
### Initialize HashiCorp Packer and required plugins. ###
echo "Initializing HashiCorp Packer and required plugins..."
packer init "$INPUT_PATH"
### Start the Build. ###
echo "Starting the build...."
echo "packer build -force -on-error=ask $debug_option"
packer build -force -on-error=ask $debug_option \
-var-file="$CONFIG_PATH/ansible.pkrvars.hcl" \
-var-file="$CONFIG_PATH/build.pkrvars.hcl" \
-var-file="$CONFIG_PATH/common.pkrvars.hcl" \
-var-file="$CONFIG_PATH/linux-storage.pkrvars.hcl" \
-var-file="$CONFIG_PATH/network.pkrvars.hcl" \
-var-file="$CONFIG_PATH/proxmox.pkrvars.hcl" \
-var-file="$CONFIG_PATH/$BUILD_VARS" \
"$INPUT_PATH"
### All done. ###
echo "Done."
}
menu_option_5() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/centos/9-stream/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
echo -e "\nCONFIRM: Build a CentOS 9 Stream Template for Proxmox?"
echo -e "\nContinue? (y/n)"
read -r REPLY
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 1
fi
### Build a CentOS 9 Stream Template for Proxmox. ###
echo "Building a CentOS 9 Stream Template for Proxmox..."
### Initialize HashiCorp Packer and required plugins. ###
echo "Initializing HashiCorp Packer and required plugins..."
packer init "$INPUT_PATH"
### Start the Build. ###
echo "Starting the build...."
echo "packer build -force -on-error=ask $debug_option"
packer build -force -on-error=ask $debug_option \
-var-file="$CONFIG_PATH/ansible.pkrvars.hcl" \
-var-file="$CONFIG_PATH/build.pkrvars.hcl" \
-var-file="$CONFIG_PATH/common.pkrvars.hcl" \
-var-file="$CONFIG_PATH/linux-storage.pkrvars.hcl" \
-var-file="$CONFIG_PATH/network.pkrvars.hcl" \
-var-file="$CONFIG_PATH/proxmox.pkrvars.hcl" \
-var-file="$CONFIG_PATH/$BUILD_VARS" \
"$INPUT_PATH"
### All done. ###
echo "Done."
}
menu_option_6() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/debian/12/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
echo -e "\nCONFIRM: Build a Debian 12 (Bookworm) Template for Proxmox?"
echo -e "\nContinue? (y/n)"
read -r REPLY
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 1
fi
### Build a Debian 12 (Bookworm) for Proxmox. ###
echo "Building a Debian 12 (Bookworm) for Proxmox..."
### Initialize HashiCorp Packer and required plugins. ###
echo "Initializing HashiCorp Packer and required plugins..."
packer init "$INPUT_PATH"
### Start the Build. ###
echo "Starting the build...."
echo "packer build -force -on-error=ask $debug_option"
packer build -force -on-error=ask $debug_option \
-var-file="$CONFIG_PATH/ansible.pkrvars.hcl" \
-var-file="$CONFIG_PATH/build.pkrvars.hcl" \
-var-file="$CONFIG_PATH/common.pkrvars.hcl" \
-var-file="$CONFIG_PATH/linux-storage.pkrvars.hcl" \
-var-file="$CONFIG_PATH/network.pkrvars.hcl" \
-var-file="$CONFIG_PATH/proxmox.pkrvars.hcl" \
-var-file="$CONFIG_PATH/$BUILD_VARS" \
"$INPUT_PATH"
### All done. ###
echo "Done."
}
menu_option_7() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/debian/11/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
echo -e "\nCONFIRM: Build a Debian 11 (Bullseye) Template for Proxmox?"
echo -e "\nContinue? (y/n)"
read -r REPLY
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 1
fi
### Build a Debian 11 (Bullseye) for Proxmox. ###
echo "Building a Debian 11 (Bullseye) for Proxmox..."
### Initialize HashiCorp Packer and required plugins. ###
echo "Initializing HashiCorp Packer and required plugins..."
packer init "$INPUT_PATH"
### Start the Build. ###
echo "Starting the build...."
echo "packer build -force -on-error=ask $debug_option"
packer build -force -on-error=ask $debug_option \
-var-file="$CONFIG_PATH/ansible.pkrvars.hcl" \
-var-file="$CONFIG_PATH/build.pkrvars.hcl" \
-var-file="$CONFIG_PATH/common.pkrvars.hcl" \
-var-file="$CONFIG_PATH/linux-storage.pkrvars.hcl" \
-var-file="$CONFIG_PATH/network.pkrvars.hcl" \
-var-file="$CONFIG_PATH/proxmox.pkrvars.hcl" \
-var-file="$CONFIG_PATH/$BUILD_VARS" \
"$INPUT_PATH"
### All done. ###
echo "Done."
}
menu_option_8() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/opensuse/leap-15-6/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
echo -e "\nCONFIRM: Build a OpenSUSE Leap 15.6 Template for Proxmox?"
echo -e "\nContinue? (y/n)"
read -r REPLY
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 1
fi
### Build a OpenSUSE Leap 15.6 Template for Proxmox. ###
echo "Building a OpenSUSE Leap 15.6 Template for Proxmox..."
### Initialize HashiCorp Packer and required plugins. ###
echo "Initializing HashiCorp Packer and required plugins..."
packer init "$INPUT_PATH"
### Start the Build. ###
echo "Starting the build...."
echo "packer build -force -on-error=ask $debug_option"
packer build -force -on-error=ask $debug_option \
-var-file="$CONFIG_PATH/ansible.pkrvars.hcl" \
-var-file="$CONFIG_PATH/build.pkrvars.hcl" \
-var-file="$CONFIG_PATH/common.pkrvars.hcl" \
-var-file="$CONFIG_PATH/linux-storage.pkrvars.hcl" \
-var-file="$CONFIG_PATH/network.pkrvars.hcl" \
-var-file="$CONFIG_PATH/proxmox.pkrvars.hcl" \
-var-file="$CONFIG_PATH/$BUILD_VARS" \
"$INPUT_PATH"
### All done. ###
echo "Done."
}
menu_option_9() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/opensuse/leap-15-5/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
echo -e "\nCONFIRM: Build a OpenSUSE Leap 15.5 Template for Proxmox?"
echo -e "\nContinue? (y/n)"
read -r REPLY
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 1
fi
### Build a OpenSUSE Leap 15.5 Template for Proxmox. ###
echo "Building a OpenSUSE Leap 15.5 Template for Proxmox..."
### Initialize HashiCorp Packer and required plugins. ###
echo "Initializing HashiCorp Packer and required plugins..."
packer init "$INPUT_PATH"
### Start the Build. ###
echo "Starting the build...."
echo "packer build -force -on-error=ask $debug_option"
packer build -force -on-error=ask $debug_option \
-var-file="$CONFIG_PATH/ansible.pkrvars.hcl" \
-var-file="$CONFIG_PATH/build.pkrvars.hcl" \
-var-file="$CONFIG_PATH/common.pkrvars.hcl" \
-var-file="$CONFIG_PATH/linux-storage.pkrvars.hcl" \
-var-file="$CONFIG_PATH/network.pkrvars.hcl" \
-var-file="$CONFIG_PATH/proxmox.pkrvars.hcl" \
-var-file="$CONFIG_PATH/$BUILD_VARS" \
"$INPUT_PATH"
### All done. ###
echo "Done."
}
menu_option_10() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/oracle/9/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
echo -e "\nCONFIRM: Build a Oracle Linux 9 Template for Proxmox?"
echo -e "\nContinue? (y/n)"
read -r REPLY
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 1
fi
### Build a Oracle Linux 9 Template for Proxmox. ###
echo "Building a Oracle Linux 9 Template for Proxmox..."
### Initialize HashiCorp Packer and required plugins. ###
echo "Initializing HashiCorp Packer and required plugins..."
packer init "$INPUT_PATH"
### Start the Build. ###
echo "Starting the build...."
echo "packer build -force -on-error=ask $debug_option"
packer build -force -on-error=ask $debug_option \
-var-file="$CONFIG_PATH/ansible.pkrvars.hcl" \
-var-file="$CONFIG_PATH/build.pkrvars.hcl" \
-var-file="$CONFIG_PATH/common.pkrvars.hcl" \
-var-file="$CONFIG_PATH/linux-storage.pkrvars.hcl" \
-var-file="$CONFIG_PATH/network.pkrvars.hcl" \
-var-file="$CONFIG_PATH/proxmox.pkrvars.hcl" \
-var-file="$CONFIG_PATH/$BUILD_VARS" \
"$INPUT_PATH"
### All done. ###
echo "Done."
}
menu_option_11() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/oracle/8/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
echo -e "\nCONFIRM: Build a Oracle Linux 8 Template for Proxmox?"
echo -e "\nContinue? (y/n)"
read -r REPLY
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 1
fi
### Build a Oracle Linux 8 Template for Proxmox. ###
echo "Building a Oracle Linux 8 Template for Proxmox..."
### Initialize HashiCorp Packer and required plugins. ###
echo "Initializing HashiCorp Packer and required plugins..."
packer init "$INPUT_PATH"
### Start the Build. ###
echo "Starting the build...."
echo "packer build -force -on-error=ask $debug_option"
packer build -force -on-error=ask $debug_option \
-var-file="$CONFIG_PATH/ansible.pkrvars.hcl" \
-var-file="$CONFIG_PATH/build.pkrvars.hcl" \
-var-file="$CONFIG_PATH/common.pkrvars.hcl" \
-var-file="$CONFIG_PATH/linux-storage.pkrvars.hcl" \
-var-file="$CONFIG_PATH/network.pkrvars.hcl" \
-var-file="$CONFIG_PATH/proxmox.pkrvars.hcl" \
-var-file="$CONFIG_PATH/$BUILD_VARS" \
"$INPUT_PATH"
### All done. ###
echo "Done."
}
menu_option_12() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/rocky/10/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
echo -e "\nCONFIRM: Build a Rocky Linux 10 Template for Proxmox?"
echo -e "\nContinue? (y/n)"
read -r REPLY
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 1
fi
### Build a Rocky Linux 10 for Proxmox. ###
echo "Building a Rocky Linux 10 for Proxmox..."
### Initialize HashiCorp Packer and required plugins. ###
echo "Initializing HashiCorp Packer and required plugins..."
packer init "$INPUT_PATH"
### Start the Build. ###
echo "Starting the build...."
echo "packer build -force -on-error=ask $debug_option"
packer build -force -on-error=ask $debug_option \
-var-file="$CONFIG_PATH/ansible.pkrvars.hcl" \
-var-file="$CONFIG_PATH/build.pkrvars.hcl" \
-var-file="$CONFIG_PATH/common.pkrvars.hcl" \
-var-file="$CONFIG_PATH/linux-storage.pkrvars.hcl" \
-var-file="$CONFIG_PATH/network.pkrvars.hcl" \
-var-file="$CONFIG_PATH/proxmox.pkrvars.hcl" \
-var-file="$CONFIG_PATH/$BUILD_VARS" \
"$INPUT_PATH"
### All done. ###
echo "Done."
}
menu_option_13() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/rocky/9/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
echo -e "\nCONFIRM: Build a Rocky Linux 9 Template for Proxmox?"
echo -e "\nContinue? (y/n)"
read -r REPLY
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 1
fi
### Build a Rocky Linux 9 for Proxmox. ###
echo "Building a Rocky Linux 9 for Proxmox..."
### Initialize HashiCorp Packer and required plugins. ###
echo "Initializing HashiCorp Packer and required plugins..."
packer init "$INPUT_PATH"
### Start the Build. ###
echo "Starting the build...."
echo "packer build -force -on-error=ask $debug_option"
packer build -force -on-error=ask $debug_option \
-var-file="$CONFIG_PATH/ansible.pkrvars.hcl" \
-var-file="$CONFIG_PATH/build.pkrvars.hcl" \
-var-file="$CONFIG_PATH/common.pkrvars.hcl" \
-var-file="$CONFIG_PATH/linux-storage.pkrvars.hcl" \
-var-file="$CONFIG_PATH/network.pkrvars.hcl" \
-var-file="$CONFIG_PATH/proxmox.pkrvars.hcl" \
-var-file="$CONFIG_PATH/$BUILD_VARS" \
"$INPUT_PATH"
### All done. ###
echo "Done."
}
menu_option_14() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/rocky/8/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
echo -e "\nCONFIRM: Build a Rocky Linux 8 Template for Proxmox?"
echo -e "\nContinue? (y/n)"
read -r REPLY
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 1
fi
### Build a Rocky Linux 8 for Proxmox. ###
echo "Building a Rocky Linux 8 for Proxmox..."
### Initialize HashiCorp Packer and required plugins. ###
echo "Initializing HashiCorp Packer and required plugins..."
packer init "$INPUT_PATH"
### Start the Build. ###
echo "Starting the build...."
echo "packer build -force -on-error=ask $debug_option"
packer build -force -on-error=ask $debug_option \
-var-file="$CONFIG_PATH/ansible.pkrvars.hcl" \
-var-file="$CONFIG_PATH/build.pkrvars.hcl" \
-var-file="$CONFIG_PATH/common.pkrvars.hcl" \
-var-file="$CONFIG_PATH/linux-storage.pkrvars.hcl" \
-var-file="$CONFIG_PATH/network.pkrvars.hcl" \
-var-file="$CONFIG_PATH/proxmox.pkrvars.hcl" \
-var-file="$CONFIG_PATH/$BUILD_VARS" \
"$INPUT_PATH"
### All done. ###
echo "Done."
}
menu_option_15() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/ubuntu/25-04/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
echo -e "\nCONFIRM: Build a Ubuntu Server 25.04 Template for Proxmox?"
echo -e "\nContinue? (y/n)"
read -r REPLY
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 1
fi
### Build a Ubuntu Server 25.04 Template for Proxmox. ###
echo "Building a Ubuntu Server 25.04 Template for Proxmox..."
### Initialize HashiCorp Packer and required plugins. ###
echo "Initializing HashiCorp Packer and required plugins..."
packer init "$INPUT_PATH"
### Start the Build. ###
echo "Starting the build...."
echo "packer build -force -on-error=ask $debug_option"
packer build -force -on-error=ask $debug_option \
-var-file="$CONFIG_PATH/ansible.pkrvars.hcl" \
-var-file="$CONFIG_PATH/build.pkrvars.hcl" \
-var-file="$CONFIG_PATH/common.pkrvars.hcl" \
-var-file="$CONFIG_PATH/linux-storage.pkrvars.hcl" \
-var-file="$CONFIG_PATH/network.pkrvars.hcl" \
-var-file="$CONFIG_PATH/proxmox.pkrvars.hcl" \
-var-file="$CONFIG_PATH/$BUILD_VARS" \
"$INPUT_PATH"
### All done. ###
echo "Done."
}
menu_option_16() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/ubuntu/24-04-lts/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
echo -e "\nCONFIRM: Build a Ubuntu Server 24.04 LTS Template for Proxmox?"
echo -e "\nContinue? (y/n)"
read -r REPLY
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 1
fi
### Build a Ubuntu Server 24.04 LTS Template for Proxmox. ###
echo "Building a Ubuntu Server 24.04 LTS Template for Proxmox..."
### Initialize HashiCorp Packer and required plugins. ###
echo "Initializing HashiCorp Packer and required plugins..."
packer init "$INPUT_PATH"
### Start the Build. ###
echo "Starting the build...."
echo "packer build -force -on-error=ask $debug_option"
packer build -force -on-error=ask $debug_option \
-var-file="$CONFIG_PATH/ansible.pkrvars.hcl" \
-var-file="$CONFIG_PATH/build.pkrvars.hcl" \
-var-file="$CONFIG_PATH/common.pkrvars.hcl" \
-var-file="$CONFIG_PATH/linux-storage.pkrvars.hcl" \
-var-file="$CONFIG_PATH/network.pkrvars.hcl" \
-var-file="$CONFIG_PATH/proxmox.pkrvars.hcl" \
-var-file="$CONFIG_PATH/$BUILD_VARS" \
"$INPUT_PATH"
### All done. ###
echo "Done."
}
menu_option_17() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/ubuntu/22-04-lts/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
echo -e "\nCONFIRM: Build a Ubuntu Server 22.04 LTS Template for Proxmox?"
echo -e "\nContinue? (y/n)"
read -r REPLY
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 1
fi
### Build a Ubuntu Server 22.04 LTS Template for Proxmox. ###
echo "Building a Ubuntu Server 22.04 LTS Template for Proxmox..."
### Initialize HashiCorp Packer and required plugins. ###
echo "Initializing HashiCorp Packer and required plugins..."
packer init "$INPUT_PATH"
### Start the Build. ###
echo "Starting the build...."
echo "packer build -force -on-error=ask $debug_option"
packer build -force -on-error=ask $debug_option \
-var-file="$CONFIG_PATH/ansible.pkrvars.hcl" \
-var-file="$CONFIG_PATH/build.pkrvars.hcl" \
-var-file="$CONFIG_PATH/common.pkrvars.hcl" \
-var-file="$CONFIG_PATH/linux-storage.pkrvars.hcl" \
-var-file="$CONFIG_PATH/network.pkrvars.hcl" \
-var-file="$CONFIG_PATH/proxmox.pkrvars.hcl" \
-var-file="$CONFIG_PATH/$BUILD_VARS" \
"$INPUT_PATH"
### All done. ###
echo "Done."
}
menu_option_18() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/ubuntu/20-04-lts/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
echo -e "\nCONFIRM: Build a Ubuntu Server 20.04 LTS Template for Proxmox?"
echo -e "\nContinue? (y/n)"
read -r REPLY
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 1
fi
### Build a Ubuntu Server 20.04 LTS Template for Proxmox. ###
echo "Building a Ubuntu Server 20.04 LTS Template for Proxmox..."
### Initialize HashiCorp Packer and required plugins. ###
echo "Initializing HashiCorp Packer and required plugins..."
packer init "$INPUT_PATH"
### Start the Build. ###
echo "Starting the build...."
echo "packer build -force -on-error=ask $debug_option"
packer build -force -on-error=ask $debug_option \
-var-file="$CONFIG_PATH/ansible.pkrvars.hcl" \
-var-file="$CONFIG_PATH/build.pkrvars.hcl" \
-var-file="$CONFIG_PATH/common.pkrvars.hcl" \
-var-file="$CONFIG_PATH/linux-storage.pkrvars.hcl" \
-var-file="$CONFIG_PATH/network.pkrvars.hcl" \
-var-file="$CONFIG_PATH/proxmox.pkrvars.hcl" \
-var-file="$CONFIG_PATH/$BUILD_VARS" \
"$INPUT_PATH"
### All done. ###
echo "Done."
}
menu_option_19() {
INPUT_PATH="$SCRIPT_PATH"/builds/windows/desktop/11/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
echo -e "\nCONFIRM: Build all Windows 11 Templates for Proxmox?"
echo -e "\nContinue? (y/n)"
read -r REPLY
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 1
fi
### Build all Windows 11 Templates for Proxmox. ###
echo "Building all Windows 11 Templates for Proxmox..."
### Initialize HashiCorp Packer and required plugins. ###
echo "Initializing HashiCorp Packer and required plugins..."
packer init "$INPUT_PATH"
### Start the Build. ###
echo "Starting the build...."
echo "packer build -force -on-error=ask $debug_option"
packer build -force -on-error=ask $debug_option \
-var-file="$CONFIG_PATH/ansible.pkrvars.hcl" \
-var-file="$CONFIG_PATH/build.pkrvars.hcl" \
-var-file="$CONFIG_PATH/common.pkrvars.hcl" \
-var-file="$CONFIG_PATH/network.pkrvars.hcl" \
-var-file="$CONFIG_PATH/proxmox.pkrvars.hcl" \
-var-file="$CONFIG_PATH/$BUILD_VARS" \
"$INPUT_PATH"
### All done. ###
echo "Done."
}
menu_option_20() {
INPUT_PATH="$SCRIPT_PATH"/builds/windows/desktop/11/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
echo -e "\nCONFIRM: Build a Windows 11 - Enterprise Template for Proxmox?"
echo -e "\nContinue? (y/n)"
read -r REPLY
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 1
fi
### Build a Windows 11 - Enterprise Template for Proxmox. ###
echo "Building a Windows 11 - Enterprise Template for Proxmox..."
### Initialize HashiCorp Packer and required plugins. ###
echo "Initializing HashiCorp Packer and required plugins..."
packer init "$INPUT_PATH"
### Start the Build. ###
echo "Starting the build...."
echo "packer build -force -on-error=ask $debug_option"
packer build -force -on-error=ask $debug_option \
--only proxmox-iso.windows-desktop-ent \
-var-file="$CONFIG_PATH/ansible.pkrvars.hcl" \
-var-file="$CONFIG_PATH/build.pkrvars.hcl" \
-var-file="$CONFIG_PATH/common.pkrvars.hcl" \
-var-file="$CONFIG_PATH/network.pkrvars.hcl" \
-var-file="$CONFIG_PATH/proxmox.pkrvars.hcl" \
-var-file="$CONFIG_PATH/$BUILD_VARS" \
"$INPUT_PATH"
### All done. ###
echo "Done."
}
menu_option_21() {
INPUT_PATH="$SCRIPT_PATH"/builds/windows/desktop/11/
BUILD_PATH=${INPUT_PATH#"${SCRIPT_PATH}/builds/"}
BUILD_VARS="$(echo "${BUILD_PATH%/}" | tr -s '/' | tr '/' '-').pkrvars.hcl"
echo -e "\nCONFIRM: Build a Windows 11 - Professional Template for Proxmox?"
echo -e "\nContinue? (y/n)"
read -r REPLY
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 1
fi
### Build a Windows 11 - Professional Templates for Proxmox. ###
echo "Building a Windows 11 - Professional Template for Proxmox..."
### Initialize HashiCorp Packer and required plugins. ###
echo "Initializing HashiCorp Packer and required plugins..."
packer init "$INPUT_PATH"
### Start the Build. ###
echo "Starting the build...."
echo "packer build -force -on-error=ask $debug_option"
packer build -force -on-error=ask $debug_option \
--only proxmox-iso.windows-desktop-pro \
-var-file="$CONFIG_PATH/ansible.pkrvars.hcl" \
-var-file="$CONFIG_PATH/build.pkrvars.hcl" \
-var-file="$CONFIG_PATH/common.pkrvars.hcl" \
-var-file="$CONFIG_PATH/network.pkrvars.hcl" \
-var-file="$CONFIG_PATH/proxmox.pkrvars.hcl" \
-var-file="$CONFIG_PATH/$BUILD_VARS" \
"$INPUT_PATH"
### All done. ###
echo "Done."
} }
press_enter() { press_enter() {
@@ -839,11 +170,17 @@ info() {
read -r read -r
} }
incorrect_selection() { quit_program() {
echo "Invalid selection, please try again." echo "Exiting..."
exit 0
} }
until [ "$selection" = "0" ]; do read_selection() {
read -rp "Selection: " input
echo "${input^^}" # always uppercase
}
display_menu() {
clear clear
echo "" echo ""
echo " ____ __ ____ " echo " ____ __ ____ "
@@ -857,61 +194,18 @@ until [ "$selection" = "0" ]; do
echo -n " Select a HashiCorp Packer build for your hypervisor:" echo -n " Select a HashiCorp Packer build for your hypervisor:"
echo "" echo ""
echo "" echo ""
echo " Linux Distribution:"
echo "" for key in $(printf "%s\n" "${!MENU_ITEMS[@]}" | sort -n 2>/dev/null); do
echo " 1 - AlmaLinux 10" IFS='|' read -r label _ <<< "${MENU_ITEMS[$key]}"
echo " 2 - AlmaLinux 9" printf " %2s - %s\n" "$key" "$label"
echo " 3 - AlmaLinux 8" done
echo " 4 - CentOS 10 Stream" echo ""
echo " 5 - CentOS 9 Stream" selection=$(read_selection)
echo " 6 - Debian 12" }
echo " 7 - Debian 11"
echo " 8 - OpenSUSE Leap 15.6" while true; do
echo " 9 - OpenSUSE Leap 15.5" display_menu
echo " 10 - Oracle Linux 9" dispatch_selection
echo " 11 - Oracle Linux 8" echo ""
echo " 12 - Rocky Linux 10" read -rp "Press enter to continue..."
echo " 13 - Rocky Linux 9"
echo " 14 - Rocky Linux 8"
echo " 15 - Ubuntu Server 25.04"
echo " 16 - Ubuntu Server 24.04 LTS"
echo " 17 - Ubuntu Server 22.04 LTS"
echo " 18 - Ubuntu Server 20.04 LTS"
echo " 19 - Windows 11 - All"
echo " 20 - Windows 11 - Enterprise Only"
echo " 21 - Windows 11 - Professional Only"
echo ""
echo " Other:"
echo ""
echo " I - Information"
echo " Q - Quit"
echo ""
read -r selection
echo ""
case $selection in
1 ) clear ; menu_option_1 ; press_enter ;;
2 ) clear ; menu_option_2 ; press_enter ;;
3 ) clear ; menu_option_3 ; press_enter ;;
4 ) clear ; menu_option_4 ; press_enter ;;
5 ) clear ; menu_option_5 ; press_enter ;;
6 ) clear ; menu_option_6 ; press_enter ;;
7 ) clear ; menu_option_7 ; press_enter ;;
8 ) clear ; menu_option_8 ; press_enter ;;
9 ) clear ; menu_option_9 ; press_enter ;;
10) clear ; menu_option_10 ; press_enter ;;
11) clear ; menu_option_11 ; press_enter ;;
12) clear ; menu_option_12 ; press_enter ;;
13) clear ; menu_option_13 ; press_enter ;;
14) clear ; menu_option_14 ; press_enter ;;
15) clear ; menu_option_15 ; press_enter ;;
16) clear ; menu_option_16 ; press_enter ;;
17) clear ; menu_option_17 ; press_enter ;;
18) clear ; menu_option_18 ; press_enter ;;
19) clear ; menu_option_19 ; press_enter ;;
20) clear ; menu_option_20 ; press_enter ;;
21) clear ; menu_option_21 ; press_enter ;;
[Ii] ) clear ; info ; press_enter ;;
[Qq] ) clear ; exit ;;
* ) clear ; incorrect_selection ; press_enter ;;
esac
done done

View File

@@ -142,7 +142,6 @@ source "proxmox-iso" "linux-almalinux" {
ssh_username = "${var.build_username}" ssh_username = "${var.build_username}"
ssh_password = "${var.build_password}" ssh_password = "${var.build_password}"
ssh_timeout = "${var.timeout}" ssh_timeout = "${var.timeout}"
ssh_port = "22"
qemu_agent = true qemu_agent = true
network_adapters { network_adapters {

View File

@@ -142,7 +142,6 @@ source "proxmox-iso" "linux-almalinux" {
ssh_username = "${var.build_username}" ssh_username = "${var.build_username}"
ssh_password = "${var.build_password}" ssh_password = "${var.build_password}"
ssh_timeout = "${var.timeout}" ssh_timeout = "${var.timeout}"
ssh_port = "22"
qemu_agent = true qemu_agent = true
network_adapters { network_adapters {

View File

@@ -142,7 +142,6 @@ source "proxmox-iso" "linux-almalinux" {
ssh_username = "${var.build_username}" ssh_username = "${var.build_username}"
ssh_password = "${var.build_password}" ssh_password = "${var.build_password}"
ssh_timeout = "${var.timeout}" ssh_timeout = "${var.timeout}"
ssh_port = "22"
qemu_agent = true qemu_agent = true
network_adapters { network_adapters {

View File

@@ -141,7 +141,6 @@ source "proxmox-iso" "linux-centos-stream" {
ssh_username = "${var.build_username}" ssh_username = "${var.build_username}"
ssh_password = "${var.build_password}" ssh_password = "${var.build_password}"
ssh_timeout = "${var.timeout}" ssh_timeout = "${var.timeout}"
ssh_port = "22"
qemu_agent = true qemu_agent = true
network_adapters { network_adapters {

View File

@@ -141,7 +141,6 @@ source "proxmox-iso" "linux-centos-stream" {
ssh_username = "${var.build_username}" ssh_username = "${var.build_username}"
ssh_password = "${var.build_password}" ssh_password = "${var.build_password}"
ssh_timeout = "${var.timeout}" ssh_timeout = "${var.timeout}"
ssh_port = "22"
qemu_agent = true qemu_agent = true
network_adapters { network_adapters {

View File

@@ -164,7 +164,6 @@ source "proxmox-iso" "debian" {
ssh_username = "${var.build_username}" ssh_username = "${var.build_username}"
ssh_password = "${var.build_password}" ssh_password = "${var.build_password}"
ssh_timeout = "${var.timeout}" ssh_timeout = "${var.timeout}"
ssh_port = "22"
qemu_agent = true qemu_agent = true
network_adapters { network_adapters {

View File

@@ -163,7 +163,6 @@ source "proxmox-iso" "debian" {
ssh_username = "${var.build_username}" ssh_username = "${var.build_username}"
ssh_password = "${var.build_password}" ssh_password = "${var.build_password}"
ssh_timeout = "${var.timeout}" ssh_timeout = "${var.timeout}"
ssh_port = "22"
qemu_agent = true qemu_agent = true
network_adapters { network_adapters {

View File

@@ -146,7 +146,6 @@ source "proxmox-iso" "linux-opensuse-leap" {
ssh_username = "${var.build_username}" ssh_username = "${var.build_username}"
ssh_password = "${var.build_password}" ssh_password = "${var.build_password}"
ssh_timeout = "${var.timeout}" ssh_timeout = "${var.timeout}"
ssh_port = "22"
qemu_agent = true qemu_agent = true
network_adapters { network_adapters {

View File

@@ -139,7 +139,6 @@ source "proxmox-iso" "linux-opensuse-leap" {
ssh_username = "${var.build_username}" ssh_username = "${var.build_username}"
ssh_password = "${var.build_password}" ssh_password = "${var.build_password}"
ssh_timeout = "${var.timeout}" ssh_timeout = "${var.timeout}"
ssh_port = "22"
qemu_agent = true qemu_agent = true
network_adapters { network_adapters {

View File

@@ -142,7 +142,6 @@ source "proxmox-iso" "linux-oracle" {
ssh_username = "${var.build_username}" ssh_username = "${var.build_username}"
ssh_password = "${var.build_password}" ssh_password = "${var.build_password}"
ssh_timeout = "${var.timeout}" ssh_timeout = "${var.timeout}"
ssh_port = "22"
qemu_agent = true qemu_agent = true
network_adapters { network_adapters {

View File

@@ -142,7 +142,6 @@ source "proxmox-iso" "linux-oracle" {
ssh_username = "${var.build_username}" ssh_username = "${var.build_username}"
ssh_password = "${var.build_password}" ssh_password = "${var.build_password}"
ssh_timeout = "${var.timeout}" ssh_timeout = "${var.timeout}"
ssh_port = "22"
qemu_agent = true qemu_agent = true
network_adapters { network_adapters {

View File

@@ -142,7 +142,6 @@ source "proxmox-iso" "linux-rocky" {
ssh_username = "${var.build_username}" ssh_username = "${var.build_username}"
ssh_password = "${var.build_password}" ssh_password = "${var.build_password}"
ssh_timeout = "${var.timeout}" ssh_timeout = "${var.timeout}"
ssh_port = "22"
qemu_agent = true qemu_agent = true
network_adapters { network_adapters {

View File

@@ -142,7 +142,6 @@ source "proxmox-iso" "linux-rocky" {
ssh_username = "${var.build_username}" ssh_username = "${var.build_username}"
ssh_password = "${var.build_password}" ssh_password = "${var.build_password}"
ssh_timeout = "${var.timeout}" ssh_timeout = "${var.timeout}"
ssh_port = "22"
qemu_agent = true qemu_agent = true
network_adapters { network_adapters {

View File

@@ -142,7 +142,6 @@ source "proxmox-iso" "linux-rocky" {
ssh_username = "${var.build_username}" ssh_username = "${var.build_username}"
ssh_password = "${var.build_password}" ssh_password = "${var.build_password}"
ssh_timeout = "${var.timeout}" ssh_timeout = "${var.timeout}"
ssh_port = "22"
qemu_agent = true qemu_agent = true
network_adapters { network_adapters {

View File

@@ -149,7 +149,6 @@ source "proxmox-iso" "ubuntu" {
ssh_username = "${var.build_username}" ssh_username = "${var.build_username}"
ssh_password = "${var.build_password}" ssh_password = "${var.build_password}"
ssh_timeout = "${var.timeout}" ssh_timeout = "${var.timeout}"
ssh_port = "22"
qemu_agent = true qemu_agent = true
network_adapters { network_adapters {

View File

@@ -145,7 +145,6 @@ source "proxmox-iso" "ubuntu" {
ssh_username = "${var.build_username}" ssh_username = "${var.build_username}"
ssh_password = "${var.build_password}" ssh_password = "${var.build_password}"
ssh_timeout = "${var.timeout}" ssh_timeout = "${var.timeout}"
ssh_port = "22"
qemu_agent = true qemu_agent = true
network_adapters { network_adapters {

View File

@@ -145,7 +145,6 @@ source "proxmox-iso" "ubuntu" {
ssh_username = "${var.build_username}" ssh_username = "${var.build_username}"
ssh_password = "${var.build_password}" ssh_password = "${var.build_password}"
ssh_timeout = "${var.timeout}" ssh_timeout = "${var.timeout}"
ssh_port = "22"
qemu_agent = true qemu_agent = true
network_adapters { network_adapters {

View File

@@ -145,7 +145,6 @@ source "proxmox-iso" "ubuntu" {
ssh_username = "${var.build_username}" ssh_username = "${var.build_username}"
ssh_password = "${var.build_password}" ssh_password = "${var.build_password}"
ssh_timeout = "${var.timeout}" ssh_timeout = "${var.timeout}"
ssh_port = "22"
qemu_agent = true qemu_agent = true
network_adapters { network_adapters {