From 3faff725199e18f6059999e17552f3194aba9d2a Mon Sep 17 00:00:00 2001 From: MacRimi Date: Mon, 30 Jun 2025 18:54:16 +0200 Subject: [PATCH] utilities create menu --- scripts/utilities/system_utils.sh | 470 ++++++++++++++++++++++ scripts/utilities/uup_dump_iso_creator.sh | 324 +++++++++++++++ 2 files changed, 794 insertions(+) create mode 100644 scripts/utilities/system_utils.sh create mode 100644 scripts/utilities/uup_dump_iso_creator.sh diff --git a/scripts/utilities/system_utils.sh b/scripts/utilities/system_utils.sh new file mode 100644 index 0000000..2d7f97b --- /dev/null +++ b/scripts/utilities/system_utils.sh @@ -0,0 +1,470 @@ +#!/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: 30/06/2025 +# ========================================================== +# Description: +# This script provides an interactive system utilities installer with a +# comprehensive dialog-based interface for Proxmox VE and Linux systems. +# It simplifies the installation and management of essential command-line +# tools and utilities commonly used in server environments. +# +# The script offers both individual utility selection and predefined groups +# for different use cases, ensuring administrators can quickly set up their +# preferred toolset without manual package management. +# +# Supported utility categories: +# - Basic utilities: grc, htop, tree, curl, wget +# - Development tools: git, vim, nano, dos2unix +# - Compression tools: zip, unzip, rsync, cabextract +# - Network tools: iperf3, nmap, tcpdump, nethogs, iptraf-ng, sshpass +# - Analysis tools: jq, ncdu, iotop, btop, iftop +# - System tools: mlocate, net-tools, ipset, msr-tools +# - Virtualization tools: libguestfs-tools, wimtools, genisoimage, chntpw +# - Download tools: axel, aria2 +# +# The script automatically handles package name differences across distributions +# and provides detailed feedback on installation success, warnings, and failures. +# It includes built-in troubleshooting for common PATH and command availability +# issues that may occur after package installation. +# +# Configuration ============================================ + +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 +load_language +initialize_cache + +# ========================================================== + + + +install_system_utils() { + + + + command_exists() { + command -v "$1" >/dev/null 2>&1 + } + + + install_single_package() { + local package="$1" + local command_name="${2:-$package}" + local description="$3" + + msg_info "$(translate "Installing") $package ($description)..." + + + local install_success=false + + if command_exists apt; then + if apt update >/dev/null 2>&1 && apt install -y "$package" >/dev/null 2>&1; then + install_success=true + fi + elif command_exists yum; then + if yum install -y "$package" >/dev/null 2>&1; then + install_success=true + fi + elif command_exists dnf; then + if dnf install -y "$package" >/dev/null 2>&1; then + install_success=true + fi + elif command_exists pacman; then + if pacman -S --noconfirm "$package" >/dev/null 2>&1; then + install_success=true + fi + elif command_exists zypper; then + if zypper install -y "$package" >/dev/null 2>&1; then + install_success=true + fi + else + cleanup + msg_error "$(translate "No compatible package manager detected")" + return 1 + fi + + cleanup + + + if [ "$install_success" = true ]; then + + hash -r 2>/dev/null + sleep 1 + + if command_exists "$command_name"; then + msg_ok "$package $(translate "installed correctly and available")" + return 0 + else + msg_warn "$package $(translate "installed but command not immediately available")" + msg_info2 "$(translate "May need to restart terminal")" + return 2 + fi + else + msg_error "$(translate "Error installing") $package" + return 1 + fi + } + + + show_main_utilities_menu() { + local choice + choice=$(dialog --clear --backtitle "ProxMenu - $(translate "System Utilities Installer")" \ + --title "$(translate "Utilities Installation Menu")" \ + --menu "$(translate "Select an option"):" 20 70 12 \ + "1" "$(translate "Custom selection")" \ + "2" "$(translate "Install ALL utilities")" \ + "3" "$(translate "Install basic utilities") (grc, htop, tree, curl, wget)" \ + "4" "$(translate "Install development tools") (git, vim, nano)" \ + "5" "$(translate "Install compression tools") (zip, unzip, rsync)" \ + "6" "$(translate "Install terminal multiplexers") (screen, tmux)" \ + "7" "$(translate "Install analysis tools") (jq, ncdu, iotop)" \ + "8" "$(translate "Install network tools") (nethogs, nmap, tcpdump, lsof)" \ + "9" "$(translate "Verify installations")" \ + "0" "$(translate "Return to main menu")" 2>&1 >/dev/tty) + + echo "$choice" + } + + + show_custom_selection() { + local utilities=( + "axel" "$(translate "Download accelerator")" "OFF" + "dos2unix" "$(translate "Convert DOS/Unix text files")" "OFF" + "grc" "$(translate "Generic log/command colorizer")" "OFF" + "htop" "$(translate "Interactive process viewer")" "OFF" + "btop" "$(translate "Modern resource monitor")" "OFF" + "iftop" "$(translate "Real-time network usage")" "OFF" + "iotop" "$(translate "Monitor disk I/O usage")" "OFF" + "iperf3" "$(translate "Network performance testing")" "OFF" + "ipset" "$(translate "Manage IP sets")" "OFF" + "iptraf-ng" "$(translate "Network monitoring tool")" "OFF" + "mlocate" "$(translate "Locate files quickly")" "OFF" + "msr-tools" "$(translate "Access CPU MSRs")" "OFF" + "net-tools" "$(translate "Legacy networking tools")" "OFF" + "sshpass" "$(translate "Non-interactive SSH login")" "OFF" + "tmux" "$(translate "Terminal multiplexer")" "OFF" + "unzip" "$(translate "Extract ZIP files")" "OFF" + "zip" "$(translate "Create ZIP files")" "OFF" + "libguestfs-tools" "$(translate "VM disk utilities")" "OFF" + "aria2" "$(translate "Multi-source downloader")" "OFF" + "cabextract" "$(translate "Extract CAB files")" "OFF" + "wimtools" "$(translate "Manage WIM images")" "OFF" + "genisoimage" "$(translate "Create ISO images")" "OFF" + "chntpw" "$(translate "Edit Windows registry/passwords")" "OFF" + ) + + local selected + selected=$(dialog --clear --backtitle "ProxMenu - $(translate "Custom Utility Selection")" \ + --title "$(translate "Select utilities to install")" \ + --checklist "$(translate "Use SPACE to select/deselect, ENTER to confirm")" \ + 25 80 20 "${utilities[@]}" 2>&1 >/dev/tty) + + echo "$selected" + } + + + install_utility_group() { + local group_name="$1" + shift + local utilities=("$@") + + clear + show_proxmenux_logo + msg_title "$(translate "Installing group"): $group_name" + + local failed=0 + local success=0 + local warning=0 + + + declare -A package_to_command=( + ["mlocate"]="locate" + ["msr-tools"]="rdmsr" + ["net-tools"]="netstat" + ["libguestfs-tools"]="virt-filesystems" + ["aria2"]="aria2c" + ["wimtools"]="wimlib-imagex" + ) + + for util_info in "${utilities[@]}"; do + IFS=':' read -r package command description <<< "$util_info" + + + local verify_command="${package_to_command[$package]:-$command}" + + + install_single_package "$package" "$verify_command" "$description" + local install_result=$? + + case $install_result in + 0) success=$((success + 1)) ;; + 1) failed=$((failed + 1)) ;; + 2) warning=$((warning + 1)) ;; + esac + done + + echo + msg_info2 "$(translate "Installation summary") - $group_name:" + msg_ok "$(translate "Successful"): $success" + [ $warning -gt 0 ] && msg_warn "$(translate "With warnings"): $warning" + [ $failed -gt 0 ] && msg_error "$(translate "Failed"): $failed" + + dialog --clear --backtitle "ProxMenu" \ + --title "$(translate "Installation Complete")" \ + --msgbox "$(translate "Group"): $group_name\n$(translate "Successful"): $success\n$(translate "With warnings"): $warning\n$(translate "Failed"): $failed" 10 50 + } + + + install_selected_utilities() { + local selected="$1" + + if [ -z "$selected" ]; then + dialog --clear --backtitle "ProxMenu" \ + --title "$(translate "No Selection")" \ + --msgbox "$(translate "No utilities were selected")" 8 40 + return + fi + + clear + show_proxmenux_logo + msg_title "$(translate "Installing selected utilities")" + + local failed=0 + local success=0 + local warning=0 + + + local selected_array + IFS=' ' read -ra selected_array <<< "$selected" + + + declare -A package_to_command=( + ["mlocate"]="locate" + ["msr-tools"]="rdmsr" + ["net-tools"]="netstat" + ["libguestfs-tools"]="virt-filesystems" + ["aria2"]="aria2c" + ["wimtools"]="wimlib-imagex" + ) + + for util in "${selected_array[@]}"; do + + util=$(echo "$util" | tr -d '"') + + + local verify_command="${package_to_command[$util]:-$util}" + + + install_single_package "$util" "$verify_command" "$util" + local install_result=$? + + case $install_result in + 0) success=$((success + 1)) ;; + 1) failed=$((failed + 1)) ;; + 2) warning=$((warning + 1)) ;; + esac + done + + + if [ -f ~/.bashrc ]; then + source ~/.bashrc >/dev/null 2>&1 + fi + hash -r 2>/dev/null + + echo + msg_info2 "$(translate "Installation summary"):" + msg_ok "$(translate "Successful"): $success" + [ $warning -gt 0 ] && msg_warn "$(translate "With warnings"): $warning" + [ $failed -gt 0 ] && msg_error "$(translate "Failed"): $failed" + + dialog --clear --backtitle "ProxMenu" \ + --title "$(translate "Installation Complete")" \ + --msgbox "$(translate "Selected utilities installation completed")\n$(translate "Successful"): $success\n$(translate "With warnings"): $warning\n$(translate "Failed"): $failed" 12 60 + } + + + verify_installations() { + clear + show_proxmenux_logo + msg_info "$(translate "Verifying all utilities status")..." + + local utilities=( + "axel:Download accelerator" + "dialog:Console GUI dialogs" + "dos2unix:Convert DOS/Unix text files" + "grc:Generic log/command colorizer" + "htop:Interactive process viewer" + "btop:Modern resource monitor" + "iftop:Real-time network usage" + "iotop:Monitor disk I/O usage" + "iperf3:Network performance testing" + "ipset:Manage IP sets" + "iptraf-ng:Network monitoring tool" + "locate:Locate files quickly" + "rdmsr:Access CPU MSRs" + "netstat:Legacy networking tools" + "sshpass:Non-interactive SSH login" + "tmux:Terminal multiplexer" + "unzip:Extract ZIP files" + "zip:Create ZIP files" + "virt-filesystems:VM disk utilities" + "aria2c:Multi-source downloader" + "cabextract:Extract CAB files" + "wimlib-imagex:Manage WIM images" + "genisoimage:Create ISO images" + "chntpw:Edit Windows registry/passwords" + ) + + local available=0 + local missing=0 + local status_text="" + + for util in "${utilities[@]}"; do + IFS=':' read -r cmd desc <<< "$util" + if command_exists "$cmd"; then + status_text+="\n✓ $cmd - $desc" + available=$((available + 1)) + else + status_text+="\n✗ $cmd - $desc" + missing=$((missing + 1)) + fi + done + + cleanup + + local summary="$(translate "Total"): $((available + missing))\n$(translate "Available"): $available\n$(translate "Missing"): $missing" + + dialog --clear --backtitle "ProxMenu" \ + --title "$(translate "Utilities Verification")" \ + --msgbox "$summary$status_text" 25 80 + } + + + + + while true; do + choice=$(show_main_utilities_menu) + + case $choice in + 1) + + selected=$(show_custom_selection) + install_selected_utilities "$selected" + ;; + 2) + + all_utils=( + "axel:axel:Download accelerator" + "dos2unix:dos2unix:Convert DOS/Unix text files" + "grc:grc:Generic log/command colorizer" + "htop:htop:Interactive process viewer" + "btop:btop:Modern resource monitor" + "iftop:iftop:Real-time network usage" + "iotop:iotop:Monitor disk I/O usage" + "iperf3:iperf3:Network performance testing" + "ipset:ipset:Manage IP sets" + "iptraf-ng:iptraf-ng:Network monitoring tool" + "mlocate:locate:Locate files quickly" + "msr-tools:rdmsr:Access CPU MSRs" + "net-tools:netstat:Legacy networking tools" + "sshpass:sshpass:Non-interactive SSH login" + "tmux:tmux:Terminal multiplexer" + "unzip:unzip:Extract ZIP files" + "zip:zip:Create ZIP files" + "libguestfs-tools:virt-filesystems:VM disk utilities" + "aria2:aria2c:Multi-source downloader" + "cabextract:cabextract:Extract CAB files" + "wimtools:wimlib-imagex:Manage WIM images" + "genisoimage:genisoimage:Create ISO images" + "chntpw:chntpw:Edit Windows registry/passwords" + ) + install_utility_group "$(translate "ALL Utilities")" "${all_utils[@]}" + ;; + 3) + + basic_utils=( + "grc:grc:Generic Colouriser" + "htop:htop:Process monitor" + "tree:tree:Directory structure" + "curl:curl:Data transfer" + "wget:wget:Web downloader" + ) + install_utility_group "$(translate "Basic Utilities")" "${basic_utils[@]}" + ;; + 4) + + dev_utils=( + "git:git:Version control" + "vim:vim:Advanced editor" + "nano:nano:Simple editor" + ) + install_utility_group "$(translate "Development Tools")" "${dev_utils[@]}" + ;; + 5) + + compress_utils=( + "zip:zip:ZIP compressor" + "unzip:unzip:ZIP extractor" + "rsync:rsync:File synchronizer" + ) + install_utility_group "$(translate "Compression Tools")" "${compress_utils[@]}" + ;; + 6) + + multiplex_utils=( + "screen:screen:Terminal multiplexer" + "tmux:tmux:Advanced multiplexer" + ) + install_utility_group "$(translate "Terminal Multiplexers")" "${multiplex_utils[@]}" + ;; + 7) + + analysis_utils=( + "jq:jq:JSON processor" + "ncdu:ncdu:Disk analyzer" + "iotop:iotop:I/O monitor" + ) + install_utility_group "$(translate "Analysis Tools")" "${analysis_utils[@]}" + ;; + 8) + + network_utils=( + "nethogs:nethogs:Network monitor" + "nmap:nmap:Network scanner" + "tcpdump:tcpdump:Packet analyzer" + "lsof:lsof:Open files" + ) + install_utility_group "$(translate "Network Tools")" "${network_utils[@]}" + ;; + 9) + verify_installations + ;; + 0|"") + break + ;; + *) + dialog --clear --backtitle "ProxMenu" \ + --title "$(translate "Invalid Option")" \ + --msgbox "$(translate "Please select a valid option")" 8 40 + ;; + esac + done + + clear +} + + +install_system_utils \ No newline at end of file diff --git a/scripts/utilities/uup_dump_iso_creator.sh b/scripts/utilities/uup_dump_iso_creator.sh new file mode 100644 index 0000000..eb168c4 --- /dev/null +++ b/scripts/utilities/uup_dump_iso_creator.sh @@ -0,0 +1,324 @@ +#!/usr/bin/env bash + +# ========================================================== +# ProxMenux - UUP Dump ISO Creator Custom +# ========================================================== +# Author : MacRimi +# Copyright : (c) 2024 MacRimi +# License : MIT (https://raw.githubusercontent.com/MacRimi/ProxMenux/main/LICENSE) +# Version : 1.0 +# Last Updated: 30/06/2025 +# ========================================================== +# Description: +# This script is part of the ProxMenux tools for Proxmox VE. +# It allows downloading and converting official Windows ISO images +# from UUP Dump using a shared link (with ID, pack, and edition). +# +# Key features: +# - Automatically installs and verifies required dependencies (aria2c, cabextract, wimlib-imagex…) +# - Downloads the selected Windows edition from UUP Dump using aria2 +# - Converts the downloaded files into a bootable ISO +# - Stores the resulting ISO in the default template path (/var/lib/vz/template/iso) +# - Provides a graphical prompt via whiptail for user-friendly usage +# +# This tool simplifies the creation of official Windows ISOs +# for use in virtual machines within Proxmox VE. +# ========================================================== + +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 + +load_language +initialize_cache + +# ========================================================== +detect_iso_dir() { + for store in $(pvesm status -content iso | awk 'NR>1 {print $1}'); do + for ext in iso img; do + volid=$(pvesm list "$store" --content iso | awk -v ext="$ext" 'NR>1 && $2 ~ ext {print $1; exit}') + if [[ -n "$volid" ]]; then + path=$(pvesm path "$volid" 2>/dev/null) + dir=$(dirname "$path") + [[ -d "$dir" ]] && echo "$dir" && return 0 + fi + done + done + + if [[ -d /var/lib/vz/template/iso ]]; then + echo "/var/lib/vz/template/iso" + return 0 + fi + + return 1 +} + + +function get_destination_path() { + local default_path="$1" + local user_path="" + + while true; do + +###################################### + + user_path=$(dialog --inputbox "$(translate "Enter destination path for ISO file")" 10 80 "$default_path" 3>&1 1>&2 2>&3) + +###################################### + + if [[ $? -ne 0 ]]; then + return 1 + fi + + + if [[ -z "$user_path" ]]; then + user_path="$default_path" + fi + + + if [[ ! -d "$user_path" ]]; then + if mkdir -p "$user_path" 2>/dev/null; then + msg_ok "$(translate "Directory created successfully:") $user_path" + echo "$user_path" + return 0 + else + dialog --msgbox "$(translate "Error: Cannot create directory") '$user_path'. $(translate "Please check permissions and try again.")" 8 60 + + continue + fi + else + + if [[ -w "$user_path" ]]; then + echo "$user_path" + return 0 + else + dialog --msgbox "$(translate "Error: No write permissions in directory") '$user_path'. $(translate "Please choose another path.")" 8 60 + + continue + fi + fi + done +} + +function run_uupdump_creator() { + local DEPS=(curl aria2 cabextract wimtools genisoimage chntpw) + local CMDS=(curl aria2c cabextract wimlib-imagex genisoimage chntpw) + local MISSING=() + local FAILED=() + + + for i in "${!CMDS[@]}"; do + if ! command -v "${CMDS[$i]}" &>/dev/null; then + MISSING+=("${DEPS[$i]}") + fi + done + + if [[ ${#MISSING[@]} -gt 0 ]]; then + msg_info "$(translate "Installing dependencies: ${MISSING[*]}")" + apt-get update -qq >/dev/null 2>&1 + if ! apt-get install -y "${MISSING[@]}" >/dev/null 2>&1; then + msg_error "$(translate "Failed to install: ${MISSING[*]}")" + exit 1 + fi + fi + + + for i in "${!CMDS[@]}"; do + if ! command -v "${CMDS[$i]}" &>/dev/null; then + FAILED+=("${CMDS[$i]}") + fi + done + + if [[ ${#FAILED[@]} -eq 0 ]]; then + msg_ok "$(translate "All dependencies installed and verified.")" + else + msg_error "$(translate "Missing commands after installation: ${FAILED[*]}")" + exit 1 + fi + + + ISO_DIR=$(detect_iso_dir) + if [[ -z "$ISO_DIR" ]]; then + msg_error "$(translate "Could not determine a valid ISO storage directory.")" + exit 1 + fi + mkdir -p "$ISO_DIR" + +###################################### + + DEFAULT_TMP="/root/uup-temp" + USER_INPUT=$(dialog --inputbox "Enter temporary folder path (default: $DEFAULT_TMP):" 10 60 "$DEFAULT_TMP" 3>&1 1>&2 2>&3) + +###################################### + + + if [[ $? -ne 0 ]]; then + return 1 + fi + + + if [[ $? -ne 0 || -z "$USER_INPUT" ]]; then + USER_INPUT="$DEFAULT_TMP" + fi + + + if [[ "$USER_INPUT" == "$DEFAULT_TMP" ]]; then + TMP_DIR="$USER_INPUT" + CLEAN_ALL=true + else + TIMESTAMP=$(date +%Y%m%d_%H%M%S) + RANDOM_ID=$(head /dev/urandom | tr -dc a-z0-9 | head -c 4) + TMP_DIR="${USER_INPUT%/}/uup-session-${TIMESTAMP}-${RANDOM_ID}" + CLEAN_ALL=false + fi + + mkdir -p "$TMP_DIR" || { + msg_error "$(translate "Failed to create temporary directory:") $TMP_DIR" + exit 1 + } + + + OUT_DIR=$(get_destination_path "$ISO_DIR") + if [[ $? -ne 0 ]]; then + return 1 + fi + + +###################################### + + UUP_URL=$(whiptail --inputbox "$(translate "Paste the UUP Dump URL here")" 10 90 3>&1 1>&2 2>&3) + +###################################### + + + if [[ $? -ne 0 ]]; then + return 1 + fi + + + if [[ $? -ne 0 || -z "$UUP_URL" ]]; then + msg_warn "$(translate "Cancelled by user or empty URL.")" + return 1 + fi + + + if [[ ! "$UUP_URL" =~ id=.+\&pack=.+\&edition=.+ ]]; then + msg_error "$(translate "The URL does not contain the required parameters (id, pack, edition).")" + sleep 2 + return 1 + fi + + + BUILD_ID=$(echo "$UUP_URL" | grep -oP 'id=\K[^&]+') + LANG=$(echo "$UUP_URL" | grep -oP 'pack=\K[^&]+') + EDITION=$(echo "$UUP_URL" | grep -oP 'edition=\K[^&]+') + ARCH="amd64" + clear + show_proxmenux_logo + echo -e + echo -e "\n${BGN}=============== UUP Dump Creator ===============${CL}" + echo -e " ${BGN}🆔 ID:${CL} ${DGN}$BUILD_ID${CL}" + echo -e " ${BGN}🌐 Language:${CL} ${DGN}$LANG${CL}" + echo -e " ${BGN}💿 Edition:${CL} ${DGN}$EDITION${CL}" + echo -e " ${BGN}🖥️ Architecture:${CL} ${DGN}$ARCH${CL}" + echo -e " ${BGN}📁 Destination:${CL} ${DGN}$OUT_DIR${CL}" + echo -e "${BGN}===============================================${CL}\n" + + + CONVERTER="$TMP_DIR/converter" + if [[ ! -f "$CONVERTER/convert.sh" ]]; then + echo "📦 $(translate "Downloading UUP converter...")" + mkdir -p "$CONVERTER" + cd "$CONVERTER" || exit 1 + wget -q https://git.uupdump.net/uup-dump/converter/archive/refs/heads/master.tar.gz -O converter.tar.gz + tar -xzf converter.tar.gz --strip-components=1 + chmod +x convert.sh + cd "$TMP_DIR" || exit 1 + fi + + + cat > uup_download_linux.sh < files/converter_multi + +for prog in aria2c cabextract wimlib-imagex chntpw; do + which \$prog &>/dev/null || { echo "\$prog not found."; exit 1; } +done + +which genisoimage &>/dev/null || which mkisofs &>/dev/null || { echo "genisoimage/mkisofs not found."; exit 1; } + +destDir="UUPs" +tempScript="aria2_script.\$RANDOM.txt" + +aria2c --no-conf --console-log-level=warn --log-level=info --log="aria2_download.log" \\ + -x16 -s16 -j2 --allow-overwrite=true --auto-file-renaming=false -d"files" -i"files/converter_multi" || exit 1 + +aria2c --no-conf --console-log-level=warn --log-level=info --log="aria2_download.log" \\ + -o"\$tempScript" --allow-overwrite=true --auto-file-renaming=false \\ + "https://uupdump.net/get.php?id=$BUILD_ID&pack=$LANG&edition=$EDITION&aria2=2" || exit 1 + +grep '#UUPDUMP_ERROR:' "\$tempScript" && { echo "❌ Error generating UUP download list."; exit 1; } + +aria2c --no-conf --console-log-level=warn --log-level=info --log="aria2_download.log" \\ + -x16 -s16 -j5 -c -R -d"\$destDir" -i"\$tempScript" || exit 1 +EOF + + chmod +x uup_download_linux.sh + + + ./uup_download_linux.sh + + + UUP_FOLDER=$(find "$TMP_DIR" -type d -name "UUPs" | head -n1) + [[ -z "$UUP_FOLDER" ]] && msg_error "$(translate "No UUP folder found.")" && exit 1 + + echo -e "\n${GN}=======================================${CL}" + echo -e " 💿 ${GN}Starting ISO conversion...${CL}" + echo -e "${GN}=======================================${CL}\n" + + + "$CONVERTER/convert.sh" wim "$UUP_FOLDER" 1 + + + ISO_FILE=$(find "$TMP_DIR" "$CONVERTER" "$UUP_FOLDER" -maxdepth 1 -iname "*.iso" | head -n1) + + if [[ -f "$ISO_FILE" ]]; then + mv "$ISO_FILE" "$OUT_DIR/" + msg_ok "$(translate "ISO created successfully:") $OUT_DIR/$(basename "$ISO_FILE")" + msg_ok "$(translate "Cleaning temporary files...")" + + if [[ "$CLEAN_ALL" == true ]]; then + rm -rf "$TMP_DIR" "$CONVERTER" + else + [[ -d "$TMP_DIR" ]] && rm -rf "$TMP_DIR" + [[ -d "$CONVERTER" ]] && rm -rf "$CONVERTER" + fi + + export OS_TYPE="windows" + export LANGUAGE=C + export LANG=C + export LC_ALL=C + load_language + initialize_cache + msg_success "$(translate "Press Enter to return to menu...")" + read -r + else + msg_warn "$(translate "No ISO was generated.")" + rm -rf "$TMP_DIR" "$CONVERTER" + export LANGUAGE=C + export LANG=C + export LC_ALL=C + load_language + initialize_cache + msg_success "$(translate "Press Enter to return to menu...")" + read -r + return 1 + fi +} + +run_uupdump_creator \ No newline at end of file