Clean temp data if upgrade succeed

This commit is contained in:
Jeremy Gardais 2020-06-19 09:28:12 +02:00
parent d133af4fed
commit 6af24258ad
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 14 additions and 2 deletions

View File

@ -222,6 +222,16 @@ Try to apply APT upgrades".
DEBIAN_FRONTEND=noninteractive aptitude -y -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confold full-upgrade >> "${APT_TMP_FILE}" 2>&1
}
# }}}
clean_host() { # {{{
debug_message "clean_host \
Try to clean temp files, downloaded packages,…".
aptitude clean >> "${APT_TMP_FILE}" 2>&1 \
&& rm -f -- "${APT_TMP_FILE}"
}
# }}}
main() { # {{{
@ -256,9 +266,11 @@ main() { # {{{
&& exit 0
## Try to upgrade the system
### Exit 50 if any error in returned value
### If error: Exit 50
### If success: Clean host (temp files, download,…)
upgrade_system \
|| exit 50
|| exit 50 \
&& clean_host
## If Maco upgrade is present
### Exit (and leave Maco manage required reboot if present)