Finalize backup list. Fixes for debian-upgrade.

This commit is contained in:
2025-08-22 14:04:21 -07:00
parent 86e3f40d36
commit 16466fb0c8

View File

@@ -755,8 +755,7 @@
BACKUP="$BACKUP_DIR/$BACKUP_FILENAME" BACKUP="$BACKUP_DIR/$BACKUP_FILENAME"
echo "*** Creating backup at '$BACKUP' ***" echo "*** Creating backup at '$BACKUP' ***"
sudo zip -rv "$BACKUP" \ sudo zip -rv "$BACKUP" \
/etc/apt /var/{log,mail} \ /etc /var/{log,mail,spool} /srv /boot \
/etc/crontab /etc/cron.d /var/spool/cron \
/usr/local/etc $EXTRA /usr/local/etc $EXTRA
status="$?" status="$?"
if [[ "$status" != 0 ]]; then if [[ "$status" != 0 ]]; then
@@ -778,16 +777,16 @@
if [[ -z "$OLD" || -z "$NEW" ]]; then if [[ -z "$OLD" || -z "$NEW" ]]; then
echo -n "ERROR: Please pass the OLD and NEW version names" echo -n "ERROR: Please pass the OLD and NEW version names"
echo ", such as 'debian-upgrade bookworm trixie'. " echo ", such as 'debian-upgrade bookworm trixie'. "
return 1
fi fi
echo "*** Doing an 'update' and 'backup' before starting upgrade. ***" echo "*** Running 'backup' before starting upgrade. ***"
sleep 1
update
backup backup
echo "*** Listing the current apt listing for '$OLD' ***" echo "*** Listing the current apt listing for '$OLD' ***"
sudo grep "$OLD" /apt/sources.list /apt/sources.list.d/* sudo grep "$OLD" /etc/apt/sources.list /etc/apt/sources.list.d/*
echo -en "\nAre these the entries you'd like changed to '$NEW'? (y/N) " echo -en "\nAre these the entries you'd like changed to '$NEW'? (y/N) "
typeset -u confirm_change typeset -u confirm_change
@@ -795,16 +794,17 @@
if [[ -z "$confirm_change" || "$confirm_change" == "N"* ]]; then if [[ -z "$confirm_change" || "$confirm_change" == "N"* ]]; then
echo "*** Aborting upgrade, change rejected. ***" echo "*** Aborting upgrade, change rejected. ***"
return 1
fi fi
unset confirm_change unset confirm_change
echo "*** Continuing with upgrade. ***" echo "*** Continuing with upgrade. ***"
sudo sed -i 's/$OLD/$NEW/g' /etc/apt/sources.list sudo sed -i "s/$OLD/$NEW/g" /etc/apt/sources.list
find /etc/apt/sources.list.d -name "*.list" \ find /etc/apt/sources.list.d -name "*.list" \
-exec sudo sed -i 's/$OLD/$NEW/g' {} \; -exec sudo sed -i "s/$OLD/$NEW/g" {} \;
sudo grep $OLD /apt/sources.list /apt/sources.list.d/* sudo grep $OLD /etc/apt/sources.list /etc/apt/sources.list.d/*
sudo grep $NEW /apt/sources.list /apt/sources.list.d/* sudo grep $NEW /etc/apt/sources.list /etc/apt/sources.list.d/*
echo -en "\nDo the source files look correct? (y/N) " echo -en "\nDo the source files look correct? (y/N) "
typeset -u confirm_correct typeset -u confirm_correct
@@ -812,22 +812,25 @@
if [[ -z "$confirm_correct" || "$confirm_correct" == "N"* ]]; then if [[ -z "$confirm_correct" || "$confirm_correct" == "N"* ]]; then
echo "*** Aborting upgrade, confirmation rejected. ***" echo "*** Aborting upgrade, confirmation rejected. ***"
return 1
fi fi
unset confirm_correct unset confirm_correct
echo "*** Starting the upgrade. ***" echo "*** Starting the upgrade. ***"
sleep 3 sleep 1
#sudo apt update sudo apt update
#sudo apt upgrade --without-new-pkgs sudo apt upgrade --without-new-pkgs
#sudo apt full-upgrade sudo apt full-upgrade
echo "*** Upgrade complete, cleaning apt files. ***" echo "*** Upgrade complete, cleaning apt files. ***"
sleep 1
#sudo apt autoremove --purge sudo apt autoremove --purge
#sudo apt clean sudo apt clean
echo "*** All done! '$OLD' is now '$NEW'. Please reboot. ***" echo "*** All done! '$OLD' is now '$NEW'. Please reboot. ***"
sleep 1
unset OLD NEW unset OLD NEW
} }
alias upgrade-debian="debian-upgrade" alias upgrade-debian="debian-upgrade"