2025-02-24 23:44:47 +01:00
#!/bin/bash
# ==========================================================
# ProxMenu - A menu-driven script for Proxmox VE management
# ==========================================================
# Author : MacRimi
# Copyright : (c) 2024 MacRimi
# License : MIT (https://raw.githubusercontent.com/MacRimi/ProxMenux/main/LICENSE)
2025-05-28 23:26:58 +02:00
# Version : 1.1
# Last Updated: 28/05/2025
2025-02-24 23:44:47 +01:00
# ==========================================================
REPO_URL = "https://raw.githubusercontent.com/MacRimi/ProxMenux/main"
BASE_DIR = "/usr/local/share/proxmenux"
UTILS_FILE = " $BASE_DIR /utils.sh "
VENV_PATH = "/opt/googletrans-env"
if [ [ -f " $UTILS_FILE " ] ] ; then
source " $UTILS_FILE "
fi
2025-05-28 23:26:58 +02:00
2025-02-24 23:44:47 +01:00
load_language
initialize_cache
2025-05-28 23:26:58 +02:00
# ==========================================================
2025-05-07 18:51:17 +02:00
confirm_and_run( ) {
local name = " $1 "
local command = " $2 "
2025-05-28 23:26:58 +02:00
dialog --clear --title " $( translate "Confirmation" ) " \
--yesno " \n\n $( translate "Do you want to run the post-installation script from" ) $name ? " 10 70
response = $?
clear
if [ $response -eq 0 ] ; then
2025-05-07 18:51:17 +02:00
eval " $command "
2025-05-28 23:26:58 +02:00
echo
2025-05-07 18:51:17 +02:00
msg_success " $( translate 'Press ENTER to continue...' ) "
read -r _
else
msg_warn " $( translate "Cancelled by user." ) "
sleep 1
fi
}
2025-05-28 23:26:58 +02:00
scripts_es = (
" Script post-install personalizable |ProxMenux|bash <(curl -s $REPO_URL /scripts/customizable_post_install.sh) "
"Script post-install Proxmox VE |Helper-Scripts|bash -c \"\$(wget -qLO - https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/pve/post-pve-install.sh); msg_success \\\"\$(translate 'Press ENTER to continue...')\\\"; read -r _\""
"Script post-iinstall xshok-proxmox|fork xshok-proxmox|confirm_and_run \"Xshok\" \"wget https://raw.githubusercontent.com/MacRimi/xshok-proxmox/master/install-post.sh -c -O install-post.sh && bash install-post.sh && rm install-post.sh\""
" Desinstalar herramientas|ProxMenux|bash <(curl -s $REPO_URL /scripts/uninstall-tools.sh) "
)
2025-05-07 18:51:17 +02:00
2025-05-28 23:26:58 +02:00
scripts_all_langs = (
2025-02-24 23:44:47 +01:00
" Customizable script post-installation|ProxMenux|bash <(curl -s $REPO_URL /scripts/customizable_post_install.sh) "
2025-05-07 18:51:17 +02:00
"Proxmox VE Post Install|Helper-Scripts|bash -c \"\$(wget -qLO - https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/pve/post-pve-install.sh); msg_success \\\"\$(translate 'Press ENTER to continue...')\\\"; read -r _\""
2025-05-28 23:26:58 +02:00
"Xshok-proxmox Post install|fork xshok-proxmox|confirm_and_run \"Xshok\" \"wget https://raw.githubusercontent.com/MacRimi/xshok-proxmox/master/install-post.sh -c -O install-post.sh && bash install-post.sh && rm install-post.sh\""
2025-05-02 19:33:51 +02:00
" Uninstall Tools|ProxMenux|bash <(curl -s $REPO_URL /scripts/uninstall-tools.sh) "
2025-02-24 23:44:47 +01:00
)
show_menu( ) {
while true; do
2025-05-28 23:26:58 +02:00
local HEADER
local current_scripts = ( )
if [ [ " $LANGUAGE " = = "es" ] ] ; then
HEADER = "\n Seleccione un script post-instalación:\n\n Descripción │ Fuente"
current_scripts = ( " ${ scripts_es [@] } " )
else
HEADER = " \n $( translate " Select a post-installation script:" ) \n\n Description │ Source "
current_scripts = ( " ${ scripts_all_langs [@] } " )
fi
2025-02-24 23:44:47 +01:00
menu_items = ( )
2025-05-28 23:26:58 +02:00
for i in " ${ !current_scripts[@] } " ; do
IFS = '|' read -r name repository command <<< " ${ current_scripts [ $i ] } "
2025-02-24 23:44:47 +01:00
number = $(( i+1))
2025-05-28 23:26:58 +02:00
local display_name = " $name "
[ [ " $LANGUAGE " != "es" ] ] && display_name = " $( translate " $name " ) "
formatted_line = $( printf "%-47s │ %s" " $display_name " " $repository " )
menu_items += ( " $number " " $formatted_line " )
2025-02-24 23:44:47 +01:00
done
2025-05-28 23:26:58 +02:00
menu_items += ( " $(( ${# current_scripts [@] } + 1 )) " " $( translate "Return to Main Menu" ) " )
2025-02-25 17:44:17 +01:00
2025-05-28 23:26:58 +02:00
exec 3>& 1
script_selection = $( dialog --clear --backtitle "ProxMenux" --title " $( translate "Post-Installation Scripts Menu" ) " \
--menu " $HEADER " 20 78 $(( ${# menu_items [@] } / 2 )) \
" ${ menu_items [@] } " 2>& 1 1>& 3)
exit_status = $?
exec 3>& -
clear
if [ $exit_status -ne 0 ] ; then
exec bash <( curl -s " $REPO_URL /scripts/menus/main_menu.sh " )
fi
if [ " $script_selection " = " $(( ${# current_scripts [@] } + 1 )) " ] ; then
2025-02-24 23:44:47 +01:00
exec bash <( curl -s " $REPO_URL /scripts/menus/main_menu.sh " )
fi
2025-05-28 23:26:58 +02:00
index = $(( script_selection - 1 ))
if [ $index -ge 0 ] && [ $index -lt ${# current_scripts [@] } ] ; then
IFS = '|' read -r _ _ command <<< " ${ current_scripts [ $index ] } "
eval " $command "
fi
2025-02-24 23:44:47 +01:00
done
}
2025-02-25 18:17:24 +01:00
2025-05-28 23:26:58 +02:00
#if [[ "$LANGUAGE" != "en" ]]; then
# show_proxmenux_logo
# msg_lang "$(translate "Generating automatic translations...")"
#fi
cleanup
2025-02-24 23:44:47 +01:00
show_menu