Recovery BackupTool: add system mount check to prevent (u)mount if already mounted

This commit is contained in:
Tanguy Pruvot 2011-06-15 10:40:23 +02:00
parent 2532fe3f96
commit 1ef50758c3

View File

@ -140,9 +140,15 @@ restore_file() {
fi fi
} }
# don't (u)mount system if already done
UMOUNT=0
case "$1" in case "$1" in
backup) backup)
mount $S if [ ! -f "$S/build.prop" ]; then
mount $S
UMOUNT=1
fi
check_prereq; check_prereq;
check_installscript; check_installscript;
if [ $PROCEED -ne 0 ]; if [ $PROCEED -ne 0 ];
@ -155,9 +161,15 @@ case "$1" in
done done
done done
fi fi
umount $S if [ $UMOUNT -ne 0 ]; then
umount $S
fi
;; ;;
restore) restore)
if [ ! -f "$S/build.prop" ]; then
mount $S
UMOUNT=1
fi
check_prereq; check_prereq;
check_installscript; check_installscript;
if [ $PROCEED -ne 0 ]; if [ $PROCEED -ne 0 ];
@ -171,6 +183,10 @@ case "$1" in
done done
rm -rf $C rm -rf $C
fi fi
if [ $UMOUNT -ne 0 ]; then
umount $S
fi
sync
;; ;;
*) *)
echo "Usage: $0 {backup|restore}" echo "Usage: $0 {backup|restore}"