ProxMenux/scripts/menus/storage_menu.sh

58 lines
2.1 KiB
Bash
Raw Normal View History

2025-01-29 20:25:40 +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)
# Version : 1.0
# Last Updated: 28/01/2025
# ==========================================================
2025-01-29 20:44:02 +01:00
# Configuration
REPO_URL="https://raw.githubusercontent.com/MacRimi/ProxMenux/main"
2025-01-29 20:25:40 +01:00
UTILS_URL="https://raw.githubusercontent.com/MacRimi/ProxMenux/main/scripts/utils.sh"
BASE_DIR="/usr/local/share/proxmenux"
CACHE_FILE="$BASE_DIR/cache.json"
VENV_PATH="/opt/googletrans-env"
LANGUAGE=$(jq -r '.language // "en"' "$BASE_DIR/config.json" 2>/dev/null)
2025-01-29 20:44:02 +01:00
2025-01-29 20:25:40 +01:00
2025-01-29 20:41:01 +01:00
# Try to load utils.sh from GitHub
if ! source <(curl -sSf "$UTILS_URL"); then
echo "$(translate 'Error: Could not load utils.sh from') $UTILS_URL"
exit 1
fi
2025-01-29 20:25:40 +01:00
2025-01-29 20:22:39 +01:00
while true; do
OPTION=$(whiptail --title "$(translate "Disk and Storage Menu")" --menu "$(translate "Select an option:")" 15 60 3 \
"1" "$(translate "Add Disk Passthrough to a VM")" \
"2" "$(translate "Import Disk Image to a VM")" \
"3" "$(translate "Return to Main Menu")" 3>&1 1>&2 2>&3)
case $OPTION in
1)
echo -e "\033[33m[INFO] $(translate "Running script:") $(translate "Disk Passthrough")...\033[0m"
bash <(curl -s "$REPO_URL/scripts/disk-passthrough.sh")
if [ $? -ne 0 ]; then
msg_info "$(translate "Operation cancelled.")"
sleep 2
fi
;;
2)
echo -e "\033[33m[INFO] $(translate "Running script:") $(translate "Import Disk Image")...\033[0m"
bash <(curl -s "$REPO_URL/scripts/import-disk-image.sh")
if [ $? -ne 0 ]; then
msg_info "$(translate "Operation cancelled.")"
sleep 2
fi
;;
2025-01-29 20:49:54 +01:00
2025-01-29 21:12:48 +01:00
3) return ;;
*) return ;;
2025-01-29 20:22:39 +01:00
esac
done