Mike Burns
2011-Sep-15 19:13 UTC
[Ovirt-devel] [PATCH node] Wipe disk containing Root if uninstall passed
rhbz#738182 Signed-off-by: Mike Burns <mburns at redhat.com> --- scripts/ovirt-early | 2 +- scripts/ovirt-functions | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletions(-) diff --git a/scripts/ovirt-early b/scripts/ovirt-early index a0ebe1c..419acb2 100755 --- a/scripts/ovirt-early +++ b/scripts/ovirt-early @@ -672,7 +672,7 @@ start_ovirt_early () { oldIFS=$IFS log "Found uninstall arg, wiping mbr from init disks" IFS=$SEP - for init_disk in $init $init_app; do + for init_disk in $init $init_app $(get_boot_disk); do echo "Wiping $init_disk" wipe_mbr "$init_disk" done diff --git a/scripts/ovirt-functions b/scripts/ovirt-functions index 26f66c8..c0f9949 100644 --- a/scripts/ovirt-functions +++ b/scripts/ovirt-functions @@ -1104,6 +1104,30 @@ autoinstall_failed(){ plymouth --show-splash } +get_base_device() { + dev=$1 + if [ -e "${dev%?}" ]; then + echo "${dev%?}" + return 0 + elif [ -e "${dev%p?}" ]; then + echo "${dev%p?}" + return 0 + else + return 1 + fi +} + +get_boot_device() { + ROOT=$(get_base_device $(findfs LABEL=Root)) + ROOTBACKUP=$(get_base_device $(findfs LABEL=RootBackup)) + if [ "$ROOT" = "$ROOTBACKUP" ]; then + echo "$ROOT" + return 0 + else + return 1 + fi +} + # execute a function if called as a script, e.g. # ovirt-functions ovirt_store_config /etc/hosts -- 1.7.4.4