From 009e1116b250e85c07289dc6009ee6093057a60d Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Mon, 16 Apr 2018 19:12:09 +0800 Subject: Try use the new Makefile_upgrade.inc to cleanup obsolete files Also bump version to 0.1.3 --- dfly-update | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/dfly-update b/dfly-update index ecd8c1f..b10ec65 100755 --- a/dfly-update +++ b/dfly-update @@ -9,10 +9,12 @@ # Exit immediately if any untested command fails in non-interactive mode set -e +# Exit with an error when an undefined variable is referenced +set -u DEBUG=${DEBUG:-""} -VERSION="0.1.2" +VERSION="0.1.3" NAME="dfly-update" TOOLDIR="${0%/*}" PREFIX="${PREFIX:-${TOOLDIR}}" @@ -79,7 +81,7 @@ NEW_SUF="__new__" # -# XXX: Variables share across two or more functions +# XXX: Variables shared across two or more functions # _FILENAME= # The latest remote system image filename _MD5= @@ -521,10 +523,12 @@ upgrade_system() { cleanup() { [ $# -eq 0 ] || \ error ${EC_ARGS} "cleanup: invalid arguments: $@" - local mk_upgrade=/etc/upgrade/Makefile_upgrade.inc - local tmpfile=$(mktemp -t ${NAME}) || exit ${EC_TMPFILE} - local item + local mk_upgrade tmpfile item + mk_upgrade=/etc/upgrade/Makefile_upgrade.inc + [ -e "${mk_upgrade}.${NEW_SUF}" ] && mk_upgrade=${mk_upgrade}.${NEW_SUF} + tmpfile=$(mktemp -t ${NAME}) || exit ${EC_TMPFILE} echo "Removing obsolete and deprecated files ..." + echo "(according to ${mk_upgrade})" make -f ${mk_upgrade} -V TO_REMOVE | tr ' ' '\n' > ${tmpfile} make -f ${mk_upgrade} -V TO_REMOVE_LATE | tr ' ' '\n' >> ${tmpfile} -- cgit v1.2.2