mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-04-25 00:46:21 +00:00
update system_utils.sh
This commit is contained in:
144
scripts/global/utils-install-functions.sh
Normal file
144
scripts/global/utils-install-functions.sh
Normal file
@@ -0,0 +1,144 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# ==========================================================
|
||||||
|
# ProxMenux - Shared utility installation functions
|
||||||
|
# ==========================================================
|
||||||
|
# Source this file in scripts that need to install system utilities.
|
||||||
|
# Provides: PROXMENUX_UTILS array, ensure_repositories(), install_single_package()
|
||||||
|
#
|
||||||
|
# Usage:
|
||||||
|
# source "$LOCAL_SCRIPTS/global/utils-install-functions.sh"
|
||||||
|
# ==========================================================
|
||||||
|
|
||||||
|
# All available utilities — format: "package:verify_command:description"
|
||||||
|
PROXMENUX_UTILS=(
|
||||||
|
"axel:axel:Download accelerator"
|
||||||
|
"dos2unix:dos2unix:Convert DOS/Unix text files"
|
||||||
|
"grc:grc:Generic log 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 bandwidth testing"
|
||||||
|
"intel-gpu-tools:intel_gpu_top:Intel GPU tools"
|
||||||
|
"s-tui:s-tui:Stress-Terminal UI"
|
||||||
|
"ipset:ipset:Manage IP sets"
|
||||||
|
"iptraf-ng:iptraf-ng:Network monitoring tool"
|
||||||
|
"plocate: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"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
# Ensure APT repositories are configured for the current PVE version.
|
||||||
|
# Creates missing no-subscription repo entries for PVE8 (bookworm) or PVE9 (trixie).
|
||||||
|
ensure_repositories() {
|
||||||
|
local pve_version need_update=false
|
||||||
|
pve_version=$(pveversion 2>/dev/null | grep -oP 'pve-manager/\K[0-9]+' | head -1)
|
||||||
|
|
||||||
|
if [[ -z "$pve_version" ]]; then
|
||||||
|
msg_error "Unable to detect Proxmox version."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if (( pve_version >= 9 )); then
|
||||||
|
# ===== PVE 9 (Debian 13 - trixie) =====
|
||||||
|
if [[ ! -f /etc/apt/sources.list.d/proxmox.sources ]]; then
|
||||||
|
cat > /etc/apt/sources.list.d/proxmox.sources <<'EOF'
|
||||||
|
Enabled: true
|
||||||
|
Types: deb
|
||||||
|
URIs: http://download.proxmox.com/debian/pve
|
||||||
|
Suites: trixie
|
||||||
|
Components: pve-no-subscription
|
||||||
|
Signed-By: /usr/share/keyrings/proxmox-archive-keyring.gpg
|
||||||
|
EOF
|
||||||
|
need_update=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ! -f /etc/apt/sources.list.d/debian.sources ]]; then
|
||||||
|
cat > /etc/apt/sources.list.d/debian.sources <<'EOF'
|
||||||
|
Types: deb
|
||||||
|
URIs: http://deb.debian.org/debian/
|
||||||
|
Suites: trixie trixie-updates
|
||||||
|
Components: main contrib non-free-firmware
|
||||||
|
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
|
||||||
|
|
||||||
|
Types: deb
|
||||||
|
URIs: http://security.debian.org/debian-security/
|
||||||
|
Suites: trixie-security
|
||||||
|
Components: main contrib non-free-firmware
|
||||||
|
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
|
||||||
|
EOF
|
||||||
|
need_update=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
else
|
||||||
|
# ===== PVE 8 (Debian 12 - bookworm) =====
|
||||||
|
local sources_file="/etc/apt/sources.list"
|
||||||
|
|
||||||
|
if ! grep -qE 'deb .* bookworm .* main' "$sources_file" 2>/dev/null; then
|
||||||
|
{
|
||||||
|
echo "deb http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware"
|
||||||
|
echo "deb http://deb.debian.org/debian bookworm-updates main contrib non-free non-free-firmware"
|
||||||
|
echo "deb http://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware"
|
||||||
|
} >> "$sources_file"
|
||||||
|
need_update=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ! -f /etc/apt/sources.list.d/pve-no-subscription.list ]]; then
|
||||||
|
echo "deb http://download.proxmox.com/debian/pve bookworm pve-no-subscription" \
|
||||||
|
> /etc/apt/sources.list.d/pve-no-subscription.list
|
||||||
|
need_update=true
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$need_update" == true ]] || [[ ! -d /var/lib/apt/lists || -z "$(ls -A /var/lib/apt/lists 2>/dev/null)" ]]; then
|
||||||
|
msg_info "$(translate "Updating APT package lists...")"
|
||||||
|
apt-get update >/dev/null 2>&1 || apt-get update
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Install a single package and verify the resulting command is available.
|
||||||
|
# Args: package_name verify_command description
|
||||||
|
# Returns: 0=ok 1=install_failed 2=installed_but_command_not_found
|
||||||
|
install_single_package() {
|
||||||
|
local package="$1"
|
||||||
|
local command_name="${2:-$package}"
|
||||||
|
local description="${3:-$package}"
|
||||||
|
|
||||||
|
msg_info "$(translate "Installing") $package${description:+ ($description)}..."
|
||||||
|
local install_success=false
|
||||||
|
|
||||||
|
if DEBIAN_FRONTEND=noninteractive apt-get install -y "$package" >/dev/null 2>&1; then
|
||||||
|
install_success=true
|
||||||
|
fi
|
||||||
|
cleanup 2>/dev/null || true
|
||||||
|
|
||||||
|
if [[ "$install_success" == true ]]; then
|
||||||
|
hash -r 2>/dev/null
|
||||||
|
sleep 1
|
||||||
|
if command -v "$command_name" >/dev/null 2>&1; 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
|
||||||
|
}
|
||||||
@@ -65,6 +65,9 @@ initialize_cache
|
|||||||
if [[ -f "$LOCAL_SCRIPTS/global/common-functions.sh" ]]; then
|
if [[ -f "$LOCAL_SCRIPTS/global/common-functions.sh" ]]; then
|
||||||
source "$LOCAL_SCRIPTS/global/common-functions.sh"
|
source "$LOCAL_SCRIPTS/global/common-functions.sh"
|
||||||
fi
|
fi
|
||||||
|
if [[ -f "$LOCAL_SCRIPTS/global/utils-install-functions.sh" ]]; then
|
||||||
|
source "$LOCAL_SCRIPTS/global/utils-install-functions.sh"
|
||||||
|
fi
|
||||||
# ==========================================================
|
# ==========================================================
|
||||||
|
|
||||||
|
|
||||||
@@ -2582,6 +2585,73 @@ EOF
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
install_system_utils() {
|
||||||
|
msg_info2 "$(translate "Installing system utilities...")"
|
||||||
|
|
||||||
|
# Build checklist from global PROXMENUX_UTILS array
|
||||||
|
local checklist_items=()
|
||||||
|
for util_entry in "${PROXMENUX_UTILS[@]}"; do
|
||||||
|
IFS=':' read -r pkg cmd desc <<< "$util_entry"
|
||||||
|
checklist_items+=("$pkg" "$(translate "$desc")" "OFF")
|
||||||
|
done
|
||||||
|
|
||||||
|
exec 3>&1
|
||||||
|
local selected
|
||||||
|
selected=$(dialog --clear --backtitle "ProxMenux" \
|
||||||
|
--title "$(translate "Select utilities to install")" \
|
||||||
|
--checklist "$(translate "Use SPACE to select, ENTER to confirm")" \
|
||||||
|
25 80 20 "${checklist_items[@]}" 2>&1 1>&3)
|
||||||
|
local dialog_exit=$?
|
||||||
|
exec 3>&-
|
||||||
|
|
||||||
|
if [[ $dialog_exit -ne 0 || -z "$selected" ]]; then
|
||||||
|
msg_warn "$(translate "No utilities selected")"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
clear
|
||||||
|
show_proxmenux_logo
|
||||||
|
|
||||||
|
if ! ensure_repositories; then
|
||||||
|
msg_error "$(translate "Failed to configure repositories. Installation aborted.")"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
local success=0 failed=0 warning=0
|
||||||
|
local selected_array
|
||||||
|
IFS=' ' read -ra selected_array <<< "$selected"
|
||||||
|
|
||||||
|
for util in "${selected_array[@]}"; do
|
||||||
|
util=$(echo "$util" | tr -d '"')
|
||||||
|
local pkg_cmd="$util" pkg_desc="$util"
|
||||||
|
for util_entry in "${PROXMENUX_UTILS[@]}"; do
|
||||||
|
IFS=':' read -r epkg ecmd edesc <<< "$util_entry"
|
||||||
|
if [[ "$epkg" == "$util" ]]; then
|
||||||
|
pkg_cmd="$ecmd"
|
||||||
|
pkg_desc="$edesc"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
install_single_package "$util" "$pkg_cmd" "$pkg_desc"
|
||||||
|
case $? in
|
||||||
|
0) success=$((success + 1)) ;;
|
||||||
|
1) failed=$((failed + 1)) ;;
|
||||||
|
2) warning=$((warning + 1)) ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
hash -r 2>/dev/null
|
||||||
|
echo
|
||||||
|
msg_info2 "$(translate "Installation summary"):"
|
||||||
|
[[ $success -gt 0 ]] && msg_ok "$(translate "Successful"): $success"
|
||||||
|
[[ $warning -gt 0 ]] && msg_warn "$(translate "With warnings"): $warning"
|
||||||
|
[[ $failed -gt 0 ]] && msg_error "$(translate "Failed"): $failed"
|
||||||
|
msg_success "$(translate "Utilities installation completed")"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Main menu function
|
# Main menu function
|
||||||
main_menu() {
|
main_menu() {
|
||||||
local HEADER
|
local HEADER
|
||||||
@@ -2750,7 +2820,7 @@ done
|
|||||||
APTUPGRADE) apt_upgrade ;;
|
APTUPGRADE) apt_upgrade ;;
|
||||||
TIMESYNC) configure_time_sync ;;
|
TIMESYNC) configure_time_sync ;;
|
||||||
NOAPTLANG) skip_apt_languages ;;
|
NOAPTLANG) skip_apt_languages ;;
|
||||||
UTILS) bash "$LOCAL_SCRIPTS/utilities/system_utils.sh" ;;
|
UTILS) install_system_utils ;;
|
||||||
JOURNALD) optimize_journald ;;
|
JOURNALD) optimize_journald ;;
|
||||||
LOGROTATE) optimize_logrotate ;;
|
LOGROTATE) optimize_logrotate ;;
|
||||||
LIMITS) increase_system_limits ;;
|
LIMITS) increase_system_limits ;;
|
||||||
|
|||||||
@@ -5,13 +5,13 @@
|
|||||||
# Author : MacRimi
|
# Author : MacRimi
|
||||||
# Copyright : (c) 2024 MacRimi
|
# Copyright : (c) 2024 MacRimi
|
||||||
# License : (GPL-3.0) (https://github.com/MacRimi/ProxMenux/blob/main/LICENSE)
|
# License : (GPL-3.0) (https://github.com/MacRimi/ProxMenux/blob/main/LICENSE)
|
||||||
# Version : 1.1
|
# Version : 1.2
|
||||||
# Last Updated: 30/07/2025
|
# Last Updated: 03/04/2026
|
||||||
# ==========================================================
|
# ==========================================================
|
||||||
# Description:
|
# Description:
|
||||||
# This script provides an interactive system utilities installer with a
|
# This script provides an interactive system utilities installer with a
|
||||||
# comprehensive dialog-based interface for Proxmox VE and Linux systems.
|
# comprehensive dialog-based interface for Proxmox VE and Linux systems.
|
||||||
# It simplifies the installation and management of essential command-line
|
# It simplifies the installation and management of essential command-line
|
||||||
# tools and utilities commonly used in server environments.
|
# tools and utilities commonly used in server environments.
|
||||||
#
|
#
|
||||||
# The script offers both individual utility selection and predefined groups
|
# The script offers both individual utility selection and predefined groups
|
||||||
@@ -24,14 +24,12 @@
|
|||||||
# - Compression tools: zip, unzip, rsync, cabextract
|
# - Compression tools: zip, unzip, rsync, cabextract
|
||||||
# - Network tools: iperf3, nmap, tcpdump, nethogs, iptraf-ng, sshpass
|
# - Network tools: iperf3, nmap, tcpdump, nethogs, iptraf-ng, sshpass
|
||||||
# - Analysis tools: jq, ncdu, iotop, btop, iftop
|
# - Analysis tools: jq, ncdu, iotop, btop, iftop
|
||||||
# - System tools: mlocate, net-tools, ipset, msr-tools
|
# - System tools: plocate, net-tools, ipset, msr-tools
|
||||||
# - Virtualization tools: libguestfs-tools, wimtools, genisoimage, chntpw
|
# - Virtualization tools: libguestfs-tools, wimtools, genisoimage, chntpw
|
||||||
# - Download tools: axel, aria2
|
# - Download tools: axel, aria2
|
||||||
#
|
#
|
||||||
# The script automatically handles package name differences across distributions
|
# The script automatically handles package name differences across distributions
|
||||||
# and provides detailed feedback on installation success, warnings, and failures.
|
# 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 ============================================
|
# Configuration ============================================
|
||||||
@@ -47,165 +45,13 @@ fi
|
|||||||
load_language
|
load_language
|
||||||
initialize_cache
|
initialize_cache
|
||||||
|
|
||||||
OS_CODENAME="$(grep "VERSION_CODENAME=" /etc/os-release | cut -d"=" -f 2 | xargs )"
|
# Load shared utility installation functions
|
||||||
|
if [[ -f "$LOCAL_SCRIPTS/global/utils-install-functions.sh" ]]; then
|
||||||
|
source "$LOCAL_SCRIPTS/global/utils-install-functions.sh"
|
||||||
|
fi
|
||||||
|
|
||||||
# ==========================================================
|
# ==========================================================
|
||||||
install_system_utils() {
|
install_system_utils() {
|
||||||
command_exists() {
|
|
||||||
command -v "$1" >/dev/null 2>&1
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ensure_repositories_() {
|
|
||||||
local sources_file="/etc/apt/sources.list"
|
|
||||||
local need_update=false
|
|
||||||
|
|
||||||
|
|
||||||
if [[ ! -f "$sources_file" ]]; then
|
|
||||||
msg_warn "$(translate "sources.list not found, creating default Debian repository...")"
|
|
||||||
cat > "$sources_file" << EOF
|
|
||||||
# Default Debian ${OS_CODENAME} repository
|
|
||||||
deb http://deb.debian.org/debian ${OS_CODENAME} main contrib non-free non-free-firmware
|
|
||||||
EOF
|
|
||||||
need_update=true
|
|
||||||
else
|
|
||||||
|
|
||||||
if ! grep -q "deb.*${OS_CODENAME}.*main" "$sources_file"; then
|
|
||||||
echo "deb http://deb.debian.org/debian ${OS_CODENAME} main contrib non-free non-free-firmware" >> "$sources_file"
|
|
||||||
need_update=true
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
if [[ "$need_update" == true ]] || ! apt list --installed >/dev/null 2>&1; then
|
|
||||||
msg_info "$(translate "Updating APT package lists...")"
|
|
||||||
apt-get update -o Acquire::AllowInsecureRepositories=true >/dev/null 2>&1
|
|
||||||
fi
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ensure_repositories() {
|
|
||||||
local pve_version need_update=false
|
|
||||||
pve_version=$(pveversion 2>/dev/null | grep -oP 'pve-manager/\K[0-9]+' | head -1)
|
|
||||||
|
|
||||||
if [[ -z "$pve_version" ]]; then
|
|
||||||
msg_error "Unable to detect Proxmox version."
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if (( pve_version >= 9 )); then
|
|
||||||
# ===== PVE 9 (Debian 13 - trixie) =====
|
|
||||||
# proxmox.sources (no-subscription) ─ create if missing
|
|
||||||
if [[ ! -f /etc/apt/sources.list.d/proxmox.sources ]]; then
|
|
||||||
cat > /etc/apt/sources.list.d/proxmox.sources <<'EOF'
|
|
||||||
Enabled: true
|
|
||||||
Types: deb
|
|
||||||
URIs: http://download.proxmox.com/debian/pve
|
|
||||||
Suites: trixie
|
|
||||||
Components: pve-no-subscription
|
|
||||||
Signed-By: /usr/share/keyrings/proxmox-archive-keyring.gpg
|
|
||||||
EOF
|
|
||||||
need_update=true
|
|
||||||
fi
|
|
||||||
|
|
||||||
# debian.sources ─ create if missing
|
|
||||||
if [[ ! -f /etc/apt/sources.list.d/debian.sources ]]; then
|
|
||||||
cat > /etc/apt/sources.list.d/debian.sources <<'EOF'
|
|
||||||
Types: deb
|
|
||||||
URIs: http://deb.debian.org/debian/
|
|
||||||
Suites: trixie trixie-updates
|
|
||||||
Components: main contrib non-free-firmware
|
|
||||||
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
|
|
||||||
|
|
||||||
Types: deb
|
|
||||||
URIs: http://security.debian.org/debian-security/
|
|
||||||
Suites: trixie-security
|
|
||||||
Components: main contrib non-free-firmware
|
|
||||||
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
|
|
||||||
EOF
|
|
||||||
need_update=true
|
|
||||||
fi
|
|
||||||
|
|
||||||
# apt-get update only if needed or lists are empty
|
|
||||||
if [[ "$need_update" == true ]] || [[ ! -d /var/lib/apt/lists || -z "$(ls -A /var/lib/apt/lists 2>/dev/null)" ]]; then
|
|
||||||
msg_info "$(translate "Updating APT package lists...")"
|
|
||||||
apt-get update >/dev/null 2>&1 || apt-get update
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
else
|
|
||||||
# ===== PVE 8 (Debian 12 - bookworm) =====
|
|
||||||
local sources_file="/etc/apt/sources.list"
|
|
||||||
|
|
||||||
# Debian base (create or append minimal lines if missing)
|
|
||||||
if ! grep -qE 'deb .* bookworm .* main' "$sources_file" 2>/dev/null; then
|
|
||||||
{
|
|
||||||
echo "deb http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware"
|
|
||||||
echo "deb http://deb.debian.org/debian bookworm-updates main contrib non-free non-free-firmware"
|
|
||||||
echo "deb http://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware"
|
|
||||||
} >> "$sources_file"
|
|
||||||
need_update=true
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Proxmox no-subscription list (classic) if missing
|
|
||||||
if [[ ! -f /etc/apt/sources.list.d/pve-no-subscription.list ]]; then
|
|
||||||
echo "deb http://download.proxmox.com/debian/pve bookworm pve-no-subscription" \
|
|
||||||
> /etc/apt/sources.list.d/pve-no-subscription.list
|
|
||||||
need_update=true
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# apt-get update only if needed or lists are empty
|
|
||||||
if [[ "$need_update" == true ]] || [[ ! -d /var/lib/apt/lists || -z "$(ls -A /var/lib/apt/lists 2>/dev/null)" ]]; then
|
|
||||||
msg_info "$(translate "Updating APT package lists...")"
|
|
||||||
apt-get update >/dev/null 2>&1 || apt-get update
|
|
||||||
fi
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
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 apt install -y "$package" >/dev/null 2>&1; then
|
|
||||||
install_success=true
|
|
||||||
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() {
|
show_main_utilities_menu() {
|
||||||
local choice
|
local choice
|
||||||
@@ -219,48 +65,24 @@ EOF
|
|||||||
"5" "$(translate "Install compression tools") (zip, unzip, rsync)" \
|
"5" "$(translate "Install compression tools") (zip, unzip, rsync)" \
|
||||||
"6" "$(translate "Install terminal multiplexers") (screen, tmux)" \
|
"6" "$(translate "Install terminal multiplexers") (screen, tmux)" \
|
||||||
"7" "$(translate "Install analysis tools") (jq, ncdu, iotop)" \
|
"7" "$(translate "Install analysis tools") (jq, ncdu, iotop)" \
|
||||||
"8" "$(translate "Install network tools") (nethogs, nmap, tcpdump, lsof)" \
|
"8" "$(translate "Install network tools") (iperf3, nethogs, nmap, tcpdump)" \
|
||||||
"9" "$(translate "Verify installations")" \
|
"9" "$(translate "Verify installations")" \
|
||||||
"0" "$(translate "Return to main menu")" 2>&1 >/dev/tty)
|
"0" "$(translate "Return to main menu")" 2>&1 >/dev/tty)
|
||||||
|
|
||||||
echo "$choice"
|
echo "$choice"
|
||||||
}
|
}
|
||||||
|
|
||||||
show_custom_selection() {
|
show_custom_selection() {
|
||||||
local utilities=(
|
local utilities=()
|
||||||
"axel" "$(translate "Download accelerator")" "OFF"
|
for util_entry in "${PROXMENUX_UTILS[@]}"; do
|
||||||
"dos2unix" "$(translate "Convert DOS/Unix text files")" "OFF"
|
IFS=':' read -r pkg cmd desc <<< "$util_entry"
|
||||||
"grc" "$(translate "Generic log/command colorizer")" "OFF"
|
utilities+=("$pkg" "$(translate "$desc")" "OFF")
|
||||||
"htop" "$(translate "Interactive process viewer")" "OFF"
|
done
|
||||||
"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"
|
|
||||||
"intel-gpu-tools" "$(translate "tools for the Intel graphics driver")" "OFF"
|
|
||||||
"s-tui" "$(translate "Stress-Terminal UI")" "OFF"
|
|
||||||
"ipset" "$(translate "Manage IP sets")" "OFF"
|
|
||||||
"iptraf-ng" "$(translate "Network monitoring tool")" "OFF"
|
|
||||||
"plocate" "$(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
|
local selected
|
||||||
selected=$(dialog --clear --backtitle "ProxMenux" \
|
selected=$(dialog --clear --backtitle "ProxMenux" \
|
||||||
--title "$(translate "Select utilities to install")" \
|
--title "$(translate "Select utilities to install")" \
|
||||||
--checklist "$(translate "Use SPACE to select/deselect, ENTER to confirm")" \
|
--checklist "$(translate "Use SPACE to select/deselect, ENTER to confirm")" \
|
||||||
25 80 20 "${utilities[@]}" 2>&1 >/dev/tty)
|
25 80 20 "${utilities[@]}" 2>&1 >/dev/tty)
|
||||||
|
|
||||||
echo "$selected"
|
echo "$selected"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -268,50 +90,35 @@ EOF
|
|||||||
local group_name="$1"
|
local group_name="$1"
|
||||||
shift
|
shift
|
||||||
local utilities=("$@")
|
local utilities=("$@")
|
||||||
|
|
||||||
clear
|
clear
|
||||||
show_proxmenux_logo
|
show_proxmenux_logo
|
||||||
msg_title "$(translate "Installing group"): $group_name"
|
msg_title "$(translate "Installing group"): $group_name"
|
||||||
|
|
||||||
|
|
||||||
if ! ensure_repositories; then
|
if ! ensure_repositories; then
|
||||||
msg_error "$(translate "Failed to configure repositories. Installation aborted.")"
|
msg_error "$(translate "Failed to configure repositories. Installation aborted.")"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local failed=0
|
local failed=0 success=0 warning=0
|
||||||
local success=0
|
|
||||||
local warning=0
|
|
||||||
|
|
||||||
declare -A package_to_command=(
|
|
||||||
["plocate"]="locate"
|
|
||||||
["msr-tools"]="rdmsr"
|
|
||||||
["net-tools"]="netstat"
|
|
||||||
["libguestfs-tools"]="virt-filesystems"
|
|
||||||
["aria2"]="aria2c"
|
|
||||||
["wimtools"]="wimlib-imagex"
|
|
||||||
)
|
|
||||||
|
|
||||||
for util_info in "${utilities[@]}"; do
|
for util_info in "${utilities[@]}"; do
|
||||||
IFS=':' read -r package command description <<< "$util_info"
|
IFS=':' read -r package command description <<< "$util_info"
|
||||||
local verify_command="${package_to_command[$package]:-$command}"
|
install_single_package "$package" "$command" "$description"
|
||||||
install_single_package "$package" "$verify_command" "$description"
|
case $? in
|
||||||
local install_result=$?
|
|
||||||
|
|
||||||
case $install_result in
|
|
||||||
0) success=$((success + 1)) ;;
|
0) success=$((success + 1)) ;;
|
||||||
1) failed=$((failed + 1)) ;;
|
1) failed=$((failed + 1)) ;;
|
||||||
2) warning=$((warning + 1)) ;;
|
2) warning=$((warning + 1)) ;;
|
||||||
esac
|
esac
|
||||||
sleep 2
|
sleep 2
|
||||||
done
|
done
|
||||||
|
|
||||||
echo
|
echo
|
||||||
msg_info2 "$(translate "Installation summary") - $group_name:"
|
msg_info2 "$(translate "Installation summary") - $group_name:"
|
||||||
msg_ok "$(translate "Successful"): $success"
|
msg_ok "$(translate "Successful"): $success"
|
||||||
[ $warning -gt 0 ] && msg_warn "$(translate "With warnings"): $warning"
|
[ $warning -gt 0 ] && msg_warn "$(translate "With warnings"): $warning"
|
||||||
[ $failed -gt 0 ] && msg_error "$(translate "Failed"): $failed"
|
[ $failed -gt 0 ] && msg_error "$(translate "Failed"): $failed"
|
||||||
|
|
||||||
dialog --clear --backtitle "ProxMenux" \
|
dialog --clear --backtitle "ProxMenux" \
|
||||||
--title "$(translate "Installation Complete")" \
|
--title "$(translate "Installation Complete")" \
|
||||||
--msgbox "$(translate "Group"): $group_name\n$(translate "Successful"): $success\n$(translate "With warnings"): $warning\n$(translate "Failed"): $failed" 10 50
|
--msgbox "$(translate "Group"): $group_name\n$(translate "Successful"): $success\n$(translate "With warnings"): $warning\n$(translate "Failed"): $failed" 10 50
|
||||||
@@ -319,64 +126,55 @@ EOF
|
|||||||
|
|
||||||
install_selected_utilities() {
|
install_selected_utilities() {
|
||||||
local selected="$1"
|
local selected="$1"
|
||||||
|
|
||||||
if [ -z "$selected" ]; then
|
if [ -z "$selected" ]; then
|
||||||
dialog --clear --backtitle "ProxMenux" \
|
dialog --clear --backtitle "ProxMenux" \
|
||||||
--title "$(translate "No Selection")" \
|
--title "$(translate "No Selection")" \
|
||||||
--msgbox "$(translate "No utilities were selected")" 8 40
|
--msgbox "$(translate "No utilities were selected")" 8 40
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
clear
|
clear
|
||||||
show_proxmenux_logo
|
show_proxmenux_logo
|
||||||
msg_title "$(translate "Installing selected utilities")"
|
msg_title "$(translate "Installing selected utilities")"
|
||||||
|
|
||||||
|
|
||||||
if ! ensure_repositories; then
|
if ! ensure_repositories; then
|
||||||
msg_error "$(translate "Failed to configure repositories. Installation aborted.")"
|
msg_error "$(translate "Failed to configure repositories. Installation aborted.")"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local failed=0
|
# Build lookup table from global PROXMENUX_UTILS
|
||||||
local success=0
|
declare -A pkg_cmd_map pkg_desc_map
|
||||||
local warning=0
|
for util_entry in "${PROXMENUX_UTILS[@]}"; do
|
||||||
|
IFS=':' read -r epkg ecmd edesc <<< "$util_entry"
|
||||||
|
pkg_cmd_map[$epkg]="$ecmd"
|
||||||
|
pkg_desc_map[$epkg]="$edesc"
|
||||||
|
done
|
||||||
|
|
||||||
|
local failed=0 success=0 warning=0
|
||||||
local selected_array
|
local selected_array
|
||||||
IFS=' ' read -ra selected_array <<< "$selected"
|
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
|
for util in "${selected_array[@]}"; do
|
||||||
util=$(echo "$util" | tr -d '"')
|
util=$(echo "$util" | tr -d '"')
|
||||||
local verify_command="${package_to_command[$util]:-$util}"
|
local verify_command="${pkg_cmd_map[$util]:-$util}"
|
||||||
install_single_package "$util" "$verify_command" "$util"
|
local description="${pkg_desc_map[$util]:-$util}"
|
||||||
local install_result=$?
|
install_single_package "$util" "$verify_command" "$description"
|
||||||
|
case $? in
|
||||||
case $install_result in
|
|
||||||
0) success=$((success + 1)) ;;
|
0) success=$((success + 1)) ;;
|
||||||
1) failed=$((failed + 1)) ;;
|
1) failed=$((failed + 1)) ;;
|
||||||
2) warning=$((warning + 1)) ;;
|
2) warning=$((warning + 1)) ;;
|
||||||
esac
|
esac
|
||||||
sleep 2
|
sleep 2
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ -f ~/.bashrc ]; then
|
|
||||||
source ~/.bashrc >/dev/null 2>&1
|
|
||||||
fi
|
|
||||||
|
|
||||||
hash -r 2>/dev/null
|
hash -r 2>/dev/null
|
||||||
echo
|
echo
|
||||||
msg_info2 "$(translate "Installation summary"):"
|
msg_info2 "$(translate "Installation summary"):"
|
||||||
msg_ok "$(translate "Successful"): $success"
|
msg_ok "$(translate "Successful"): $success"
|
||||||
[ $warning -gt 0 ] && msg_warn "$(translate "With warnings"): $warning"
|
[ $warning -gt 0 ] && msg_warn "$(translate "With warnings"): $warning"
|
||||||
[ $failed -gt 0 ] && msg_error "$(translate "Failed"): $failed"
|
[ $failed -gt 0 ] && msg_error "$(translate "Failed"): $failed"
|
||||||
|
|
||||||
dialog --clear --backtitle "ProxMenux" \
|
dialog --clear --backtitle "ProxMenux" \
|
||||||
--title "$(translate "Installation Complete")" \
|
--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
|
--msgbox "$(translate "Selected utilities installation completed")\n$(translate "Successful"): $success\n$(translate "With warnings"): $warning\n$(translate "Failed"): $failed" 12 60
|
||||||
@@ -386,43 +184,12 @@ EOF
|
|||||||
clear
|
clear
|
||||||
show_proxmenux_logo
|
show_proxmenux_logo
|
||||||
msg_info "$(translate "Verifying all utilities status")..."
|
msg_info "$(translate "Verifying all utilities status")..."
|
||||||
|
|
||||||
local utilities=(
|
local available=0 missing=0 status_text=""
|
||||||
"axel:Download accelerator"
|
|
||||||
"dialog:Console GUI dialogs"
|
for util_entry in "${PROXMENUX_UTILS[@]}"; do
|
||||||
"dos2unix:Convert DOS/Unix text files"
|
IFS=':' read -r pkg cmd desc <<< "$util_entry"
|
||||||
"grc:Generic log/command colorizer"
|
if command -v "$cmd" >/dev/null 2>&1; then
|
||||||
"htop:Interactive process viewer"
|
|
||||||
"btop:Modern resource monitor"
|
|
||||||
"iftop:Real-time network usage"
|
|
||||||
"iotop:Monitor disk I/O usage"
|
|
||||||
#"iperf3:Network performance testing"
|
|
||||||
"intel-gpu-tools:tools for the Intel graphics driver"
|
|
||||||
"s-tui:Stress-Terminal UI"
|
|
||||||
"ipset:Manage IP sets"
|
|
||||||
"iptraf-ng:Network monitoring tool"
|
|
||||||
"plocate: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"
|
status_text+="\n✓ $cmd - $desc"
|
||||||
available=$((available + 1))
|
available=$((available + 1))
|
||||||
else
|
else
|
||||||
@@ -430,11 +197,11 @@ EOF
|
|||||||
missing=$((missing + 1))
|
missing=$((missing + 1))
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
cleanup
|
cleanup
|
||||||
|
|
||||||
local summary="$(translate "Total"): $((available + missing))\n$(translate "Available"): $available\n$(translate "Missing"): $missing"
|
local summary="$(translate "Total"): $((available + missing))\n$(translate "Available"): $available\n$(translate "Missing"): $missing"
|
||||||
|
|
||||||
dialog --clear --backtitle "ProxMenux" \
|
dialog --clear --backtitle "ProxMenux" \
|
||||||
--title "$(translate "Utilities Verification")" \
|
--title "$(translate "Utilities Verification")" \
|
||||||
--msgbox "$summary$status_text" 25 80
|
--msgbox "$summary$status_text" 25 80
|
||||||
@@ -449,34 +216,7 @@ EOF
|
|||||||
install_selected_utilities "$selected"
|
install_selected_utilities "$selected"
|
||||||
;;
|
;;
|
||||||
2)
|
2)
|
||||||
all_utils=(
|
install_utility_group "$(translate "ALL Utilities")" "${PROXMENUX_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"
|
|
||||||
"intel-gpu-tools:tools for the Intel graphics driver"
|
|
||||||
"s-tui:Stress-Terminal UI"
|
|
||||||
"ipset:ipset:Manage IP sets"
|
|
||||||
"iptraf-ng:iptraf-ng:Network monitoring tool"
|
|
||||||
"plocate: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)
|
3)
|
||||||
basic_utils=(
|
basic_utils=(
|
||||||
@@ -521,10 +261,11 @@ EOF
|
|||||||
;;
|
;;
|
||||||
8)
|
8)
|
||||||
network_utils=(
|
network_utils=(
|
||||||
"nethogs:nethogs:Network monitor"
|
"iperf3:iperf3:Network bandwidth testing"
|
||||||
|
"nethogs:nethogs:Network monitor per process"
|
||||||
"nmap:nmap:Network scanner"
|
"nmap:nmap:Network scanner"
|
||||||
"tcpdump:tcpdump:Packet analyzer"
|
"tcpdump:tcpdump:Packet analyzer"
|
||||||
"lsof:lsof:Open files"
|
"lsof:lsof:Open files and ports"
|
||||||
)
|
)
|
||||||
install_utility_group "$(translate "Network Tools")" "${network_utils[@]}"
|
install_utility_group "$(translate "Network Tools")" "${network_utils[@]}"
|
||||||
;;
|
;;
|
||||||
@@ -541,7 +282,7 @@ EOF
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
clear
|
clear
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user