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
1 changed files with 18 additions and 2 deletions

View File

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