mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2025-08-14 00:42:23 +00:00
Update system_utils.sh
This commit is contained in:
parent
d1c8aeb25d
commit
c4f6dabd4d
@ -56,22 +56,34 @@ install_system_utils() {
|
||||
}
|
||||
|
||||
|
||||
ensure_repositories() {
|
||||
local sources_file="/etc/apt/sources.list"
|
||||
local need_update=false
|
||||
|
||||
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
|
||||
|
||||
if [ "$need_update" = true ] || ! apt list --installed >/dev/null 2>&1; then
|
||||
apt update >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
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
|
||||
}
|
||||
|
||||
install_single_package() {
|
||||
local package="$1"
|
||||
@ -167,7 +179,7 @@ install_system_utils() {
|
||||
show_proxmenux_logo
|
||||
msg_title "$(translate "Installing group"): $group_name"
|
||||
|
||||
# Ensure repositories are configured before installing
|
||||
|
||||
if ! ensure_repositories; then
|
||||
msg_error "$(translate "Failed to configure repositories. Installation aborted.")"
|
||||
return 1
|
||||
@ -225,7 +237,7 @@ install_system_utils() {
|
||||
show_proxmenux_logo
|
||||
msg_title "$(translate "Installing selected utilities")"
|
||||
|
||||
# Ensure repositories are configured before installing
|
||||
|
||||
if ! ensure_repositories; then
|
||||
msg_error "$(translate "Failed to configure repositories. Installation aborted.")"
|
||||
return 1
|
||||
|
Loading…
x
Reference in New Issue
Block a user