Refactor AlmaLinux VM installer & lobehub setup
Modernize and simplify VM installer and lobehub installation flows. Key changes: - install/lobehub-install.sh: consolidated apt invocation, replaced manual ParadeDB .deb download with fetch_and_deploy_gh_release helper, added postgresql pg_search preload configuration and restart, moved pnpm installation into setup_nodejs via NODE_MODULE, and adjusted build env handling. - vm/almalinux-10-vm.sh: major refactor to source shared functions from COMMUNITY_SCRIPTS_URL, add load_functions, centralize cloud-init handling (configure_cloudinit_ssh_keys / setup_cloud_init), replace many custom UI/helper functions with standardized helpers and exit_script, update traps and error handling, simplify prompts/defaults, use $STD for apt operations, and streamline image customization and VM creation flow. - Added vm/headers/almalinux-10-vm containing the VM header art and title. These changes centralize common logic, improve cloud-init integration, reduce duplicated code, and make maintenance easier.
This commit is contained in:
@@ -14,36 +14,28 @@ network_check
|
||||
update_os
|
||||
|
||||
msg_info "Installing Dependencies"
|
||||
$STD apt install -y \
|
||||
build-essential
|
||||
$STD apt install -y build-essential
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
PG_VERSION="17" PG_MODULES="pgvector" setup_postgresql
|
||||
|
||||
msg_info "Installing pg_search from ParadeDB"
|
||||
ARCH=$(dpkg --print-architecture)
|
||||
CODENAME=$(. /etc/os-release && echo "${VERSION_CODENAME:-bookworm}")
|
||||
PDB_VERSION=$(curl -fsSL "https://api.github.com/repos/paradedb/paradedb/releases/latest" | grep -oP '"tag_name":\s*"\K[^"]+')
|
||||
PDB_VERSION_NUM="${PDB_VERSION#v}"
|
||||
DEB_NAME="postgresql-17-pg-search_${PDB_VERSION_NUM}-1PARADEDB-${CODENAME}_${ARCH}.deb"
|
||||
DEB_URL="https://github.com/paradedb/paradedb/releases/download/${PDB_VERSION}/${DEB_NAME}"
|
||||
curl -fsSL -o "/tmp/${DEB_NAME}" "$DEB_URL"
|
||||
dpkg -i "/tmp/${DEB_NAME}" >/dev/null 2>&1 || $STD apt install -f -y
|
||||
rm -f "/tmp/${DEB_NAME}"
|
||||
msg_ok "Installed pg_search from ParadeDB"
|
||||
fetch_and_deploy_gh_release "paradedb" "paradedb/paradedb" "binary" "latest" "" "postgresql-17-pg-search_*-1PARADEDB-${CODENAME}_$(dpkg --print-architecture).deb"
|
||||
|
||||
msg_info "Configuring pg_search preload library"
|
||||
if ! grep -q "shared_preload_libraries.*pg_search" /etc/postgresql/17/main/postgresql.conf; then
|
||||
echo "shared_preload_libraries = 'pg_search'" >>/etc/postgresql/17/main/postgresql.conf
|
||||
fi
|
||||
systemctl restart postgresql
|
||||
msg_ok "Configured pg_search preload library"
|
||||
|
||||
PG_DB_NAME="lobehub" PG_DB_USER="lobehub" PG_DB_EXTENSIONS="vector,pg_search" setup_postgresql_db
|
||||
NODE_VERSION="24" setup_nodejs
|
||||
|
||||
msg_info "Installing pnpm"
|
||||
$STD npm install -g pnpm
|
||||
msg_ok "Installed pnpm"
|
||||
NODE_VERSION="24" NODE_MODULE="pnpm" setup_nodejs
|
||||
|
||||
fetch_and_deploy_gh_release "lobehub" "lobehub/lobehub" "tarball"
|
||||
|
||||
msg_info "Building Application"
|
||||
cd /opt/lobehub
|
||||
export NODE_OPTIONS="--max-old-space-size=8192"
|
||||
export DATABASE_URL="postgres://${PG_DB_USER}:${PG_DB_PASS}@localhost:5432/${PG_DB_NAME}"
|
||||
export DATABASE_DRIVER="node"
|
||||
export KEY_VAULTS_SECRET="$(openssl rand -base64 32)"
|
||||
@@ -51,7 +43,6 @@ export AUTH_SECRET="$(openssl rand -base64 32)"
|
||||
export APP_URL="http://localhost:3210"
|
||||
$STD pnpm install
|
||||
$STD pnpm run build:docker
|
||||
unset NODE_OPTIONS
|
||||
msg_ok "Built Application"
|
||||
|
||||
msg_info "Configuring Application"
|
||||
|
||||
@@ -2,221 +2,51 @@
|
||||
|
||||
# Copyright (c) 2021-2026 community-scripts ORG
|
||||
# Author: Agent-Fennec
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
|
||||
|
||||
source /dev/stdin <<<$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/api.func)
|
||||
COMMUNITY_SCRIPTS_URL="${COMMUNITY_SCRIPTS_URL:-https://git.community-scripts.org/community-scripts/ProxmoxVED/raw/branch/main}"
|
||||
source <(curl -fsSL "$COMMUNITY_SCRIPTS_URL/misc/api.func")
|
||||
source <(curl -fsSL "$COMMUNITY_SCRIPTS_URL/misc/vm-core.func")
|
||||
source <(curl -fsSL "$COMMUNITY_SCRIPTS_URL/misc/cloud-init.func") || true
|
||||
load_functions
|
||||
|
||||
function header_info() {
|
||||
clear
|
||||
cat <<"EOF"
|
||||
|
||||
█████╗ ██╗ ███╗ ███╗ █████╗ ██╗ ██╗███╗ ██╗██╗ ██╗██╗ ██╗
|
||||
██╔══██╗██║ ████╗ ████║██╔══██╗██║ ██║████╗ ██║██║ ██║╚██╗██╔╝
|
||||
███████║██║ ██╔████╔██║███████║██║ ██║██╔██╗ ██║██║ ██║ ╚███╔╝
|
||||
██╔══██║██║ ██║╚██╔╝██║██╔══██║██║ ██║██║╚██╗██║██║ ██║ ██╔██╗
|
||||
██║ ██║███████╗██║ ╚═╝ ██║██║ ██║███████╗██║██║ ╚████║╚██████╔╝██╔╝ ██╗
|
||||
╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝
|
||||
|
||||
AlmaLinux 10 Installer
|
||||
(Heliotrope Lion)
|
||||
|
||||
EOF
|
||||
}
|
||||
header_info
|
||||
echo -e "\n Loading..."
|
||||
GEN_MAC=02:$(openssl rand -hex 5 | awk '{print toupper($0)}' | sed 's/\(..\)/\1:/g; s/.$//')
|
||||
RANDOM_UUID="$(cat /proc/sys/kernel/random/uuid)"
|
||||
METHOD=""
|
||||
APP="AlmaLinux 10 VM"
|
||||
APP_TYPE="vm"
|
||||
NSAPP="almalinux10vm"
|
||||
var_os="almalinux"
|
||||
var_version="10"
|
||||
|
||||
YW=$(echo "\033[33m")
|
||||
BL=$(echo "\033[36m")
|
||||
RD=$(echo "\033[01;31m")
|
||||
BGN=$(echo "\033[4;92m")
|
||||
GN=$(echo "\033[1;92m")
|
||||
DGN=$(echo "\033[32m")
|
||||
CL=$(echo "\033[m")
|
||||
|
||||
CL=$(echo "\033[m")
|
||||
BOLD=$(echo "\033[1m")
|
||||
BFR="\\r\\033[K"
|
||||
HOLD=" "
|
||||
TAB=" "
|
||||
|
||||
CM="${TAB}✔️${TAB}${CL}"
|
||||
CROSS="${TAB}✖️${TAB}${CL}"
|
||||
INFO="${TAB}💡${TAB}${CL}"
|
||||
OS="${TAB}🖥️${TAB}${CL}"
|
||||
CONTAINERTYPE="${TAB}📦${TAB}${CL}"
|
||||
DISKSIZE="${TAB}💾${TAB}${CL}"
|
||||
CPUCORE="${TAB}🧠${TAB}${CL}"
|
||||
RAMSIZE="${TAB}🛠️${TAB}${CL}"
|
||||
CONTAINERID="${TAB}🆔${TAB}${CL}"
|
||||
HOSTNAME="${TAB}🏠${TAB}${CL}"
|
||||
BRIDGE="${TAB}🌉${TAB}${CL}"
|
||||
GATEWAY="${TAB}🌐${TAB}${CL}"
|
||||
DEFAULT="${TAB}⚙️${TAB}${CL}"
|
||||
MACADDRESS="${TAB}🔗${TAB}${CL}"
|
||||
VLANTAG="${TAB}🏷️${TAB}${CL}"
|
||||
CREATING="${TAB}🚀${TAB}${CL}"
|
||||
ADVANCED="${TAB}🧩${TAB}${CL}"
|
||||
|
||||
GEN_MAC=02:$(openssl rand -hex 5 | awk '{print toupper($0)}' | sed 's/\(..\)/\1:/g; s/.$//')
|
||||
RANDOM_UUID="$(cat /proc/sys/kernel/random/uuid)"
|
||||
METHOD=""
|
||||
THIN="discard=on,ssd=1,"
|
||||
|
||||
set -e
|
||||
trap 'error_handler $LINENO "$BASH_COMMAND"' ERR
|
||||
trap cleanup EXIT
|
||||
trap 'post_update_to_api "failed" "130"' SIGINT
|
||||
trap 'post_update_to_api "failed" "143"' SIGTERM
|
||||
trap 'post_update_to_api "failed" "INTERRUPTED"' SIGINT
|
||||
trap 'post_update_to_api "failed" "TERMINATED"' SIGTERM
|
||||
|
||||
function error_handler() {
|
||||
local exit_code="$?"
|
||||
local line_number="$1"
|
||||
local command="$2"
|
||||
local error_message="${RD}[ERROR]${CL} in line ${RD}$line_number${CL}: exit code ${RD}$exit_code${CL}: while executing command ${YW}$command${CL}"
|
||||
post_update_to_api "failed" "${exit_code}"
|
||||
post_update_to_api "failed" "${command}"
|
||||
echo -e "\n$error_message\n"
|
||||
cleanup_vmid
|
||||
}
|
||||
|
||||
function get_valid_nextid() {
|
||||
local try_id
|
||||
try_id=$(pvesh get /cluster/nextid)
|
||||
while true; do
|
||||
if [ -f "/etc/pve/qemu-server/${try_id}.conf" ] || [ -f "/etc/pve/lxc/${try_id}.conf" ]; then
|
||||
try_id=$((try_id + 1))
|
||||
continue
|
||||
fi
|
||||
if lvs --noheadings -o lv_name | grep -qE "(^|[-_])${try_id}($|[-_])"; then
|
||||
try_id=$((try_id + 1))
|
||||
continue
|
||||
fi
|
||||
break
|
||||
done
|
||||
echo "$try_id"
|
||||
}
|
||||
|
||||
function cleanup_vmid() {
|
||||
if qm status "$VMID" &>/dev/null; then
|
||||
qm stop "$VMID" &>/dev/null
|
||||
qm destroy "$VMID" &>/dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
function cleanup() {
|
||||
local exit_code=$?
|
||||
popd 2>/dev/null || true
|
||||
if [[ "${POST_TO_API_DONE:-}" == "true" && "${POST_UPDATE_DONE:-}" != "true" ]]; then
|
||||
if [[ $exit_code -eq 0 ]]; then
|
||||
post_update_to_api "done" "none" || true
|
||||
else
|
||||
post_update_to_api "failed" "$exit_code" || true
|
||||
fi
|
||||
fi
|
||||
rm -rf "$TEMP_DIR"
|
||||
rm -f "${WORK_FILE:-}"
|
||||
}
|
||||
|
||||
TEMP_DIR=$(mktemp -d)
|
||||
pushd "$TEMP_DIR" >/dev/null
|
||||
if whiptail --backtitle "Proxmox VE Helper Scripts" --title "AlmaLinux 10 VM" --yesno "This will create a New AlmaLinux 10 VM. Proceed?" 10 58; then
|
||||
:
|
||||
else
|
||||
header_info && echo -e "${CROSS}${RD}User exited script${CL}\n" && exit
|
||||
header_info && exit_script
|
||||
fi
|
||||
|
||||
function msg_info() {
|
||||
local msg="$1"
|
||||
echo -ne "${TAB}${YW}${HOLD}${msg}${HOLD}"
|
||||
}
|
||||
|
||||
function msg_ok() {
|
||||
local msg="$1"
|
||||
echo -e "${BFR}${CM}${GN}${msg}${CL}"
|
||||
}
|
||||
|
||||
function msg_error() {
|
||||
local msg="$1"
|
||||
echo -e "${BFR}${CROSS}${RD}${msg}${CL}"
|
||||
}
|
||||
|
||||
function check_root() {
|
||||
if [[ "$(id -u)" -ne 0 || $(ps -o comm= -p $PPID) == "sudo" ]]; then
|
||||
clear
|
||||
msg_error "Please run this script as root."
|
||||
echo -e "\nExiting..."
|
||||
sleep 2
|
||||
exit
|
||||
fi
|
||||
}
|
||||
|
||||
# This function checks the version of Proxmox Virtual Environment (PVE) and exits if the version is not supported.
|
||||
# Supported: Proxmox VE 8.0.x – 8.9.x, 9.0 and 9.1
|
||||
pve_check() {
|
||||
local PVE_VER
|
||||
PVE_VER="$(pveversion | awk -F'/' '{print $2}' | awk -F'-' '{print $1}')"
|
||||
|
||||
# Check for Proxmox VE 8.x: allow 8.0–8.9
|
||||
if [[ "$PVE_VER" =~ ^8\.([0-9]+) ]]; then
|
||||
local MINOR="${BASH_REMATCH[1]}"
|
||||
if ((MINOR < 0 || MINOR > 9)); then
|
||||
msg_error "This version of Proxmox VE is not supported."
|
||||
msg_error "Supported: Proxmox VE version 8.0 – 8.9"
|
||||
exit 1
|
||||
fi
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Check for Proxmox VE 9.x: allow 9.0 and 9.1
|
||||
if [[ "$PVE_VER" =~ ^9\.([0-9]+) ]]; then
|
||||
local MINOR="${BASH_REMATCH[1]}"
|
||||
if ((MINOR < 0 || MINOR > 1)); then
|
||||
msg_error "This version of Proxmox VE is not supported."
|
||||
msg_error "Supported: Proxmox VE version 9.0 – 9.1"
|
||||
exit 1
|
||||
fi
|
||||
return 0
|
||||
fi
|
||||
|
||||
# All other unsupported versions
|
||||
msg_error "This version of Proxmox VE is not supported."
|
||||
msg_error "Supported versions: Proxmox VE 8.0 – 8.x or 9.0 – 9.1"
|
||||
exit 1
|
||||
}
|
||||
|
||||
function arch_check() {
|
||||
if [ "$(dpkg --print-architecture)" != "amd64" ]; then
|
||||
echo -e "\n ${INFO}${YWB}This script will not work with PiMox! \n"
|
||||
echo -e "\n ${YWB}Visit https://github.com/asylumexp/Proxmox for ARM64 support. \n"
|
||||
echo -e "Exiting..."
|
||||
sleep 2
|
||||
exit
|
||||
fi
|
||||
}
|
||||
|
||||
function ssh_check() {
|
||||
if command -v pveversion >/dev/null 2>&1; then
|
||||
if [ -n "${SSH_CLIENT:+x}" ]; then
|
||||
if whiptail --backtitle "Proxmox VE Helper Scripts" --defaultno --title "SSH DETECTED" --yesno "It's suggested to use the Proxmox shell instead of SSH, since SSH can create issues while gathering variables. Would you like to proceed with using SSH?" 10 62; then
|
||||
echo "you've been warned"
|
||||
else
|
||||
clear
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function exit-script() {
|
||||
clear
|
||||
echo -e "\n${CROSS}${RD}User exited script${CL}\n"
|
||||
popd >/dev/null 2>&1 || true
|
||||
rm -rf "${TEMP_DIR:-}"
|
||||
rm -f "${WORK_FILE:-}"
|
||||
exec bash
|
||||
}
|
||||
|
||||
function default_settings() {
|
||||
configure_cloudinit_ssh_keys || true
|
||||
VMID=$(get_valid_nextid)
|
||||
FORMAT=""
|
||||
MACHINE=" -machine q35"
|
||||
@@ -264,7 +94,7 @@ function advanced_settings() {
|
||||
echo -e "${CONTAINERID}${BOLD}${DGN}Virtual Machine ID: ${BGN}$VMID${CL}"
|
||||
break
|
||||
else
|
||||
exit-script
|
||||
exit_script
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -282,10 +112,10 @@ function advanced_settings() {
|
||||
MACHINE=" -machine q35"
|
||||
fi
|
||||
else
|
||||
exit-script
|
||||
exit_script
|
||||
fi
|
||||
|
||||
if DISK_SIZE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set Disk Size in GiB (e.g., 10, 20)" 8 58 "$DISK_SIZE" --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then
|
||||
if DISK_SIZE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set Disk Size in GiB (e.g., 10, 20)" 8 58 "10" --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then
|
||||
DISK_SIZE=$(echo "$DISK_SIZE" | tr -d ' ')
|
||||
if [[ "$DISK_SIZE" =~ ^[0-9]+$ ]]; then
|
||||
DISK_SIZE="${DISK_SIZE}G"
|
||||
@@ -294,10 +124,10 @@ function advanced_settings() {
|
||||
echo -e "${DISKSIZE}${BOLD}${DGN}Disk Size: ${BGN}$DISK_SIZE${CL}"
|
||||
else
|
||||
echo -e "${DISKSIZE}${BOLD}${RD}Invalid Disk Size. Please use a number (e.g., 10 or 10G).${CL}"
|
||||
exit-script
|
||||
exit_script
|
||||
fi
|
||||
else
|
||||
exit-script
|
||||
exit_script
|
||||
fi
|
||||
|
||||
if DISK_CACHE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "DISK CACHE" --radiolist "Choose" --cancel-button Exit-Script 10 58 2 \
|
||||
@@ -312,7 +142,7 @@ function advanced_settings() {
|
||||
DISK_CACHE=""
|
||||
fi
|
||||
else
|
||||
exit-script
|
||||
exit_script
|
||||
fi
|
||||
|
||||
if VM_NAME=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set Hostname" 8 58 almalinux --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then
|
||||
@@ -320,13 +150,10 @@ function advanced_settings() {
|
||||
HN="almalinux"
|
||||
else
|
||||
HN=$(echo "${VM_NAME,,}" | tr -cs 'a-z0-9-' '-' | sed 's/^-//;s/-$//')
|
||||
if [ "$HN" != "${VM_NAME,,}" ]; then
|
||||
whiptail --backtitle "Proxmox VE Helper Scripts" --title "HOSTNAME ADJUSTED" --msgbox "Invalid characters detected. Hostname has been adjusted to:\n\n $HN" 10 58
|
||||
fi
|
||||
fi
|
||||
echo -e "${HOSTNAME}${BOLD}${DGN}Hostname: ${BGN}$HN${CL}"
|
||||
else
|
||||
exit-script
|
||||
exit_script
|
||||
fi
|
||||
|
||||
if CPU_TYPE1=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "CPU MODEL" --radiolist "Choose" --cancel-button Exit-Script 10 58 2 \
|
||||
@@ -341,7 +168,7 @@ function advanced_settings() {
|
||||
CPU_TYPE=" -cpu x86-64-v3"
|
||||
fi
|
||||
else
|
||||
exit-script
|
||||
exit_script
|
||||
fi
|
||||
|
||||
while true; do
|
||||
@@ -353,7 +180,7 @@ function advanced_settings() {
|
||||
fi
|
||||
whiptail --backtitle "Proxmox VE Helper Scripts" --title "INVALID INPUT" --msgbox "CPU Cores must be a positive integer (e.g., 2)." 8 58
|
||||
else
|
||||
exit-script
|
||||
exit_script
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -366,17 +193,15 @@ function advanced_settings() {
|
||||
fi
|
||||
whiptail --backtitle "Proxmox VE Helper Scripts" --title "INVALID INPUT" --msgbox "RAM Size must be a positive integer in MiB (e.g., 2048)." 8 58
|
||||
else
|
||||
exit-script
|
||||
exit_script
|
||||
fi
|
||||
done
|
||||
|
||||
if BRG=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then
|
||||
if [ -z "$BRG" ]; then
|
||||
BRG="vmbr0"
|
||||
fi
|
||||
if [ -z "$BRG" ]; then BRG="vmbr0"; fi
|
||||
echo -e "${BRIDGE}${BOLD}${DGN}Bridge: ${BGN}$BRG${CL}"
|
||||
else
|
||||
exit-script
|
||||
exit_script
|
||||
fi
|
||||
|
||||
while true; do
|
||||
@@ -391,9 +216,9 @@ function advanced_settings() {
|
||||
echo -e "${MACADDRESS}${BOLD}${DGN}MAC Address: ${BGN}$MAC${CL}"
|
||||
break
|
||||
fi
|
||||
whiptail --backtitle "Proxmox VE Helper Scripts" --title "INVALID INPUT" --msgbox "Invalid MAC address format. Use XX:XX:XX:XX:XX:XX (e.g., AA:BB:CC:DD:EE:FF)." 8 58
|
||||
whiptail --backtitle "Proxmox VE Helper Scripts" --title "INVALID INPUT" --msgbox "Invalid MAC address format. Use XX:XX:XX:XX:XX:XX." 8 58
|
||||
else
|
||||
exit-script
|
||||
exit_script
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -410,9 +235,9 @@ function advanced_settings() {
|
||||
echo -e "${VLANTAG}${BOLD}${DGN}VLAN: ${BGN}$VLAN1${CL}"
|
||||
break
|
||||
fi
|
||||
whiptail --backtitle "Proxmox VE Helper Scripts" --title "INVALID INPUT" --msgbox "VLAN must be a number between 1 and 4094, or leave blank for default." 8 58
|
||||
whiptail --backtitle "Proxmox VE Helper Scripts" --title "INVALID INPUT" --msgbox "VLAN must be a number between 1 and 4094, or leave blank." 8 58
|
||||
else
|
||||
exit-script
|
||||
exit_script
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -429,9 +254,9 @@ function advanced_settings() {
|
||||
echo -e "${DEFAULT}${BOLD}${DGN}Interface MTU Size: ${BGN}$MTU1${CL}"
|
||||
break
|
||||
fi
|
||||
whiptail --backtitle "Proxmox VE Helper Scripts" --title "INVALID INPUT" --msgbox "MTU Size must be a number between 576 and 65520, or leave blank for default." 8 58
|
||||
whiptail --backtitle "Proxmox VE Helper Scripts" --title "INVALID INPUT" --msgbox "MTU Size must be between 576 and 65520, or leave blank." 8 58
|
||||
else
|
||||
exit-script
|
||||
exit_script
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -443,6 +268,8 @@ function advanced_settings() {
|
||||
START_VM="no"
|
||||
fi
|
||||
|
||||
configure_cloudinit_ssh_keys || true
|
||||
|
||||
if (whiptail --backtitle "Proxmox VE Helper Scripts" --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create an AlmaLinux 10 VM?" --no-button Do-Over 10 58); then
|
||||
echo -e "${CREATING}${BOLD}${DGN}Creating an AlmaLinux 10 VM using the above advanced settings${CL}"
|
||||
else
|
||||
@@ -464,12 +291,7 @@ function start_script() {
|
||||
fi
|
||||
}
|
||||
|
||||
check_root
|
||||
arch_check
|
||||
pve_check
|
||||
ssh_check
|
||||
start_script
|
||||
|
||||
post_to_api_vm
|
||||
|
||||
msg_info "Validating Storage"
|
||||
@@ -496,7 +318,7 @@ while [ -z "${STORAGE:+x}" ]; do
|
||||
STORAGE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "Storage Pools" --radiolist \
|
||||
"Which storage pool would you like to use for ${HN}?\nTo make a selection, use the Spacebar.\n" \
|
||||
16 $((MSG_MAX_LENGTH + 23)) 6 \
|
||||
"${STORAGE_MENU[@]}" 3>&1 1>&2 2>&3) || exit-script
|
||||
"${STORAGE_MENU[@]}" 3>&1 1>&2 2>&3) || exit_script
|
||||
done
|
||||
msg_ok "Using ${CL}${BL}$STORAGE${CL} ${GN}for Storage Location."
|
||||
msg_ok "Virtual Machine ID is ${CL}${BL}$VMID${CL}."
|
||||
@@ -506,8 +328,8 @@ msg_ok "Virtual Machine ID is ${CL}${BL}$VMID${CL}."
|
||||
# ==============================================================================
|
||||
if ! command -v virt-customize &>/dev/null; then
|
||||
msg_info "Installing libguestfs-tools"
|
||||
apt-get -qq update >/dev/null 2>&1
|
||||
apt-get -qq install -y libguestfs-tools >/dev/null 2>&1
|
||||
$STD apt-get update
|
||||
$STD apt-get install -y libguestfs-tools
|
||||
msg_ok "Installed libguestfs-tools"
|
||||
fi
|
||||
|
||||
@@ -530,24 +352,13 @@ cp "$FILE" "$WORK_FILE"
|
||||
popd >/dev/null
|
||||
rm -rf "$TEMP_DIR"
|
||||
|
||||
# Set hostname
|
||||
virt-customize -q -a "$WORK_FILE" --hostname "${HN}" >/dev/null 2>&1
|
||||
|
||||
# Prepare for unique machine-id on first boot
|
||||
virt-customize -q -a "$WORK_FILE" --run-command "truncate -s 0 /etc/machine-id" >/dev/null 2>&1
|
||||
virt-customize -q -a "$WORK_FILE" --run-command "rm -f /var/lib/dbus/machine-id" >/dev/null 2>&1
|
||||
|
||||
# Disable systemd-firstboot to prevent interactive prompts blocking the console
|
||||
virt-customize -q -a "$WORK_FILE" --run-command "systemctl disable systemd-firstboot.service 2>/dev/null; rm -f /etc/systemd/system/sysinit.target.wants/systemd-firstboot.service; ln -sf /dev/null /etc/systemd/system/systemd-firstboot.service" >/dev/null 2>&1 || true
|
||||
|
||||
# Cloud-Init handles SSH and login
|
||||
virt-customize -q -a "$WORK_FILE" --run-command "sed -i 's/^#*PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config" >/dev/null 2>&1 || true
|
||||
virt-customize -q -a "$WORK_FILE" --run-command "sed -i 's/^#*PasswordAuthentication.*/PasswordAuthentication yes/' /etc/ssh/sshd_config" >/dev/null 2>&1 || true
|
||||
|
||||
# Enable serial console login
|
||||
virt-customize -q -a "$WORK_FILE" --run-command "systemctl enable serial-getty@ttyS0.service" >/dev/null 2>&1 || true
|
||||
|
||||
# Relabel SELinux contexts after all modifications (required for AlmaLinux/RHEL)
|
||||
virt-customize -q -a "$WORK_FILE" --selinux-relabel >/dev/null 2>&1 || true
|
||||
|
||||
msg_ok "Customized image"
|
||||
@@ -579,7 +390,6 @@ for i in {0,1,2}; do
|
||||
eval DISK"${i}"_REF="${STORAGE}":"${DISK_REF:-}""${!disk}"
|
||||
done
|
||||
|
||||
# For block/btrfs storage, pre-convert qcow2 to raw to ensure compatibility
|
||||
if [[ "$STORAGE_TYPE" != "nfs" && "$STORAGE_TYPE" != "dir" ]]; then
|
||||
msg_info "Converting image to raw format"
|
||||
RAW_FILE=$(mktemp --suffix=.raw)
|
||||
@@ -598,49 +408,19 @@ qm importdisk "$VMID" "${WORK_FILE}" "$STORAGE" ${DISK_IMPORT:-} 1>&/dev/null
|
||||
qm set "$VMID" \
|
||||
-efidisk0 "${DISK0_REF}"${FORMAT} \
|
||||
-scsi0 "${DISK1_REF}",${DISK_CACHE}${THIN}size="${DISK_SIZE}" \
|
||||
-scsi1 "${STORAGE}":cloudinit \
|
||||
-tpmstate0 "${DISK2_REF}",version=v2.0 \
|
||||
-boot order=scsi0 \
|
||||
-serial0 socket >/dev/null
|
||||
|
||||
# Clean up work file
|
||||
rm -f "$WORK_FILE"
|
||||
msg_ok "Created an AlmaLinux 10 VM ${CL}${BL}(${HN})"
|
||||
|
||||
DESCRIPTION=$(
|
||||
cat <<EOF
|
||||
<div align='center'>
|
||||
<a href='https://Helper-Scripts.com' target='_blank' rel='noopener noreferrer'>
|
||||
<img src='https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/images/logo-81x112.png' alt='Logo' style='width:81px;height:112px;'/>
|
||||
</a>
|
||||
|
||||
<h2 style='font-size: 24px; margin: 20px 0;'>AlmaLinux 10 VM</h2>
|
||||
|
||||
<p style='margin: 16px 0;'>
|
||||
<a href='https://ko-fi.com/community_scripts' target='_blank' rel='noopener noreferrer'>
|
||||
<img src='https://img.shields.io/badge/☕-Buy us a coffee-blue' alt='spend Coffee' />
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<span style='margin: 0 10px;'>
|
||||
<i class="fa fa-github fa-fw" style="color: #f5f5f5;"></i>
|
||||
<a href='https://github.com/community-scripts/ProxmoxVE' target='_blank' rel='noopener noreferrer' style='text-decoration: none; color: #00617f;'>GitHub</a>
|
||||
</span>
|
||||
<span style='margin: 0 10px;'>
|
||||
<i class="fa fa-comments fa-fw" style="color: #f5f5f5;"></i>
|
||||
<a href='https://github.com/community-scripts/ProxmoxVE/discussions' target='_blank' rel='noopener noreferrer' style='text-decoration: none; color: #00617f;'>Discussions</a>
|
||||
</span>
|
||||
<span style='margin: 0 10px;'>
|
||||
<i class="fa fa-exclamation-circle fa-fw" style="color: #f5f5f5;"></i>
|
||||
<a href='https://github.com/community-scripts/ProxmoxVE/issues' target='_blank' rel='noopener noreferrer' style='text-decoration: none; color: #00617f;'>Issues</a>
|
||||
</span>
|
||||
</div>
|
||||
EOF
|
||||
)
|
||||
qm set "$VMID" -description "$DESCRIPTION" >/dev/null
|
||||
msg_info "Resizing disk to ${DISK_SIZE}"
|
||||
qm resize "$VMID" scsi0 "${DISK_SIZE}" >/dev/null
|
||||
msg_ok "Resized disk to ${DISK_SIZE}"
|
||||
|
||||
setup_cloud_init "$VMID" "$STORAGE" "$HN" "yes"
|
||||
|
||||
msg_ok "Created an AlmaLinux 10 VM ${CL}${BL}(${HN})"
|
||||
if [ "$START_VM" == "yes" ]; then
|
||||
msg_info "Starting AlmaLinux 10 VM"
|
||||
qm start "$VMID"
|
||||
@@ -649,5 +429,8 @@ fi
|
||||
|
||||
post_update_to_api "done" "none"
|
||||
|
||||
msg_ok "Completed successfully"
|
||||
echo -e "Setup Cloud-Init before starting \nMore info at https://github.com/community-scripts/ProxmoxVE/discussions/272 \n"
|
||||
msg_ok "Completed successfully!"
|
||||
if [ -n "${CLOUDINIT_CRED_FILE:-}" ]; then
|
||||
echo -e "${INFO}${YW} Cloud-Init credentials saved to: ${BGN}${CLOUDINIT_CRED_FILE}${CL}"
|
||||
fi
|
||||
|
||||
|
||||
11
vm/headers/almalinux-10-vm
Normal file
11
vm/headers/almalinux-10-vm
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
█████╗ ██╗ ███╗ ███╗ █████╗ ██╗ ██╗███╗ ██╗██╗ ██╗██╗ ██╗
|
||||
██╔══██╗██║ ████╗ ████║██╔══██╗██║ ██║████╗ ██║██║ ██║╚██╗██╔╝
|
||||
███████║██║ ██╔████╔██║███████║██║ ██║██╔██╗ ██║██║ ██║ ╚███╔╝
|
||||
██╔══██║██║ ██║╚██╔╝██║██╔══██║██║ ██║██║╚██╗██║██║ ██║ ██╔██╗
|
||||
██║ ██║███████╗██║ ╚═╝ ██║██║ ██║███████╗██║██║ ╚████║╚██████╔╝██╔╝ ██╗
|
||||
╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝
|
||||
|
||||
AlmaLinux 10 VM
|
||||
(Heliotrope Lion)
|
||||
|
||||
Reference in New Issue
Block a user