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 ()
|
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 "Erases the master boot record on the hard drive."
|
||||||
echo "WARNING: All data on this hard drive will be lost."
|
echo "WARNING: All data on this hard drive will be lost."
|
||||||
echo ""
|
echo ""
|
||||||
echo "Options:"
|
echo "Options:"
|
||||||
echo " -h display this help"
|
echo " -h display this help"
|
||||||
echo " --force do not ask for confirmation"
|
echo " --force do not ask for confirmation"
|
||||||
|
echo " --include-backup also removes data from platform backup directory"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,7 +41,7 @@ unmount_fs()
|
|||||||
return $ret_code
|
return $ret_code
|
||||||
}
|
}
|
||||||
|
|
||||||
OPTS=`getopt -o h -l force -- "$@"`
|
OPTS=`getopt -o h -l force,include-backup -- "$@"`
|
||||||
if [ $? != 0 ]
|
if [ $? != 0 ]
|
||||||
then
|
then
|
||||||
exit 1
|
exit 1
|
||||||
@ -52,6 +53,7 @@ while true ; do
|
|||||||
case "$1" in
|
case "$1" in
|
||||||
-h) usage; shift;;
|
-h) usage; shift;;
|
||||||
--force) FORCE=1; shift;;
|
--force) FORCE=1; shift;;
|
||||||
|
--include-backup) INCLUDE_BACKUP=1; shift;;
|
||||||
--) shift; break;;
|
--) shift; break;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
@ -141,7 +143,7 @@ do
|
|||||||
esac
|
esac
|
||||||
sgdisk_part_info=$(flock $dev sgdisk -i $part_number $dev)
|
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;}')
|
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..."
|
echo "Skipping wipe backup partition $part..."
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
@ -185,3 +187,4 @@ else
|
|||||||
sync
|
sync
|
||||||
echo "The disk(s) have been wiped."
|
echo "The disk(s) have been wiped."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user