From 8db57bda6e225e800cc40eec05b54e912f111738 Mon Sep 17 00:00:00 2001 From: MacRimi Date: Wed, 30 Jul 2025 17:34:44 +0200 Subject: [PATCH] Update install utilities --- .../post_install/customizable_post_install.sh | 28 +++++++++++++++- scripts/utilities/system_utils.sh | 33 +++++++++++++++++++ 2 files changed, 60 insertions(+), 1 deletion(-) diff --git a/scripts/post_install/customizable_post_install.sh b/scripts/post_install/customizable_post_install.sh index caebe05..5daef64 100644 --- a/scripts/post_install/customizable_post_install.sh +++ b/scripts/post_install/customizable_post_install.sh @@ -690,6 +690,24 @@ install_system_utils() { command -v "$1" >/dev/null 2>&1 } + + ensure_repositories() { + local sources_file="/etc/apt/sources.list" + local need_update=false + + 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 + + if [ "$need_update" = true ] || ! apt list --installed >/dev/null 2>&1; then + msg_info "$(translate "Updating package lists")..." + apt update >/dev/null 2>&1 + fi + + return 0 + } + install_single_package() { local package="$1" @@ -806,12 +824,18 @@ install_system_utils() { show_proxmenux_logo msg_title "$SCRIPT_TITLE" msg_info2 "$(translate "Installing selected utilities")" + + if ! ensure_repositories; then + msg_error "$(translate "Failed to configure repositories. Installation aborted.")" + return 1 + fi + + msg_ok "$(translate "Update package list successful")" local failed=0 local success=0 local warning=0 - local selected_array IFS=' ' read -ra selected_array <<< "$selected" @@ -876,6 +900,8 @@ install_system_utils() { + + install_system_utils_() { msg_info2 "$(translate "Installing common system utilities...")" diff --git a/scripts/utilities/system_utils.sh b/scripts/utilities/system_utils.sh index 3a9bd52..5193824 100644 --- a/scripts/utilities/system_utils.sh +++ b/scripts/utilities/system_utils.sh @@ -60,6 +60,24 @@ install_system_utils() { } + ensure_repositories() { + local sources_file="/etc/apt/sources.list" + local need_update=false + + 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 + + if [ "$need_update" = true ] || ! apt list --installed >/dev/null 2>&1; then + msg_info "$(translate "Updating package lists")..." + apt update >/dev/null 2>&1 + fi + + return 0 + } + + install_single_package() { local package="$1" local command_name="${2:-$package}" @@ -184,6 +202,13 @@ install_system_utils() { clear show_proxmenux_logo msg_title "$(translate "Installing group"): $group_name" + + if ! ensure_repositories; then + msg_error "$(translate "Failed to configure repositories. Installation aborted.")" + return 1 + fi + + msg_ok "$(translate "Update package list successful")" local failed=0 local success=0 @@ -241,6 +266,13 @@ install_system_utils() { clear show_proxmenux_logo msg_title "$(translate "Installing selected utilities")" + + if ! ensure_repositories; then + msg_error "$(translate "Failed to configure repositories. Installation aborted.")" + return 1 + fi + + msg_ok "$(translate "Update package list successful")" local failed=0 local success=0 @@ -300,6 +332,7 @@ install_system_utils() { clear show_proxmenux_logo msg_info "$(translate "Verifying all utilities status")..." + local utilities=( "axel:Download accelerator"