backuptool: Ensure to cleanup the environment on failure
Change-Id: I6f974a40b4f3f4a0a1f3a4b46bf8e0cfeb81c4ec
This commit is contained in:
committed by
Bruno Martins
parent
271ba02664
commit
b5f3a4a72d
@@ -164,23 +164,30 @@ umount_extra() {
|
||||
done
|
||||
}
|
||||
|
||||
cleanup() {
|
||||
umount_extra $all_V3_partitions
|
||||
umount /postinstall/tmp
|
||||
rm -rf /postinstall/tmp
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
backup)
|
||||
if check_prereq; then
|
||||
mkdir -p $C
|
||||
preserve_addon_d
|
||||
run_stages pre-backup backup post-backup
|
||||
else
|
||||
cleanup
|
||||
fi
|
||||
;;
|
||||
restore)
|
||||
if check_prereq; then
|
||||
run_stages pre-restore restore post-restore
|
||||
umount_extra $all_V3_partitions
|
||||
restore_addon_d
|
||||
rm -rf $C
|
||||
umount /postinstall/tmp
|
||||
rm -rf /postinstall/tmp
|
||||
cleanup
|
||||
sync
|
||||
else
|
||||
cleanup
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
|
Reference in New Issue
Block a user