From 093cc77c97827c2cd5f74977d9ca56cb4f9988b3 Mon Sep 17 00:00:00 2001 From: manuel Date: Fri, 1 Mar 2024 12:58:13 -0100 Subject: [PATCH] update update-system script --- pepscripts/07update-system | 20 +++++++++++++++++--- pepscriptsdev/07update-system | 20 +++++++++++++++++--- 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/pepscripts/07update-system b/pepscripts/07update-system index 4579112..23a6e1a 100755 --- a/pepscripts/07update-system +++ b/pepscripts/07update-system @@ -7,8 +7,22 @@ # This script updates the system after Debian installation. # Update the system -chroot /target apt update -chroot /target apt upgrade -y +if ! chroot /target apt update; then + echo "Failed to update package lists. Aborting." >&2 + exit 1 +fi + +# Upgrade the system +if ! chroot /target apt upgrade -y; then + echo "Failed to upgrade packages. Aborting." >&2 + exit 1 +fi # Clean up unnecessary packages -chroot /target apt autoremove -y +if ! chroot /target apt autoremove -y; then + echo "Failed to remove unnecessary packages. Continuing anyway." >&2 +fi + +echo "System update completed successfully." +exit 0 + diff --git a/pepscriptsdev/07update-system b/pepscriptsdev/07update-system index 4579112..23a6e1a 100755 --- a/pepscriptsdev/07update-system +++ b/pepscriptsdev/07update-system @@ -7,8 +7,22 @@ # This script updates the system after Debian installation. # Update the system -chroot /target apt update -chroot /target apt upgrade -y +if ! chroot /target apt update; then + echo "Failed to update package lists. Aborting." >&2 + exit 1 +fi + +# Upgrade the system +if ! chroot /target apt upgrade -y; then + echo "Failed to upgrade packages. Aborting." >&2 + exit 1 +fi # Clean up unnecessary packages -chroot /target apt autoremove -y +if ! chroot /target apt autoremove -y; then + echo "Failed to remove unnecessary packages. Continuing anyway." >&2 +fi + +echo "System update completed successfully." +exit 0 +