Add option --include-backup to wipedisk
The option --include-backup offers the possibility to wipe the directory /opt/platform-backup by ignoring the "protected" partition GUID. Test Plan: PASS: Verify that wipedisk without parameters keep the directory /opt/platform-backup contents PASS: Verify that wipedisk with parameter --include-backup remove contents of /opt/platform-backup Story: 2009291 Task: 43719 Signed-off-by: Delfino Curado <delfinogomes.curadofilho@windriver.com> Change-Id: I1a7c0b284a4c229d6ea59433fd7db296745ead2f
This commit is contained in:
parent
025a2fc56f
commit
366b68d3c7
@ -8,13 +8,14 @@
|
||||
|
||||
usage ()
|
||||
{
|
||||
echo "Usage: `basename $0` [-h|--force]"
|
||||
echo "Usage: `basename $0` [-h|--force|--include-backup]"
|
||||
echo "Erases the master boot record on the hard drive."
|
||||
echo "WARNING: All data on this hard drive will be lost."
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo " -h display this help"
|
||||
echo " --force do not ask for confirmation"
|
||||
echo " --include-backup also removes data from platform backup directory"
|
||||
exit 1
|
||||
}
|
||||
|
||||
@ -40,7 +41,7 @@ unmount_fs()
|
||||
return $ret_code
|
||||
}
|
||||
|
||||
OPTS=`getopt -o h -l force -- "$@"`
|
||||
OPTS=`getopt -o h -l force,include-backup -- "$@"`
|
||||
if [ $? != 0 ]
|
||||
then
|
||||
exit 1
|
||||
@ -52,6 +53,7 @@ while true ; do
|
||||
case "$1" in
|
||||
-h) usage; shift;;
|
||||
--force) FORCE=1; shift;;
|
||||
--include-backup) INCLUDE_BACKUP=1; shift;;
|
||||
--) shift; break;;
|
||||
esac
|
||||
done
|
||||
@ -141,7 +143,7 @@ do
|
||||
esac
|
||||
sgdisk_part_info=$(flock $dev sgdisk -i $part_number $dev)
|
||||
part_type_guid=$(echo "$sgdisk_part_info" | grep "$part_type_guid_str" | awk '{print $4;}')
|
||||
if [ "$part_type_guid" == $BACKUP_PART_GUID ]; then
|
||||
if [[ "$part_type_guid" == $BACKUP_PART_GUID && ! $INCLUDE_BACKUP ]]; then
|
||||
echo "Skipping wipe backup partition $part..."
|
||||
continue
|
||||
fi
|
||||
@ -185,3 +187,4 @@ else
|
||||
sync
|
||||
echo "The disk(s) have been wiped."
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user