-if [ $IMAGE_INSTALL = 0 ]; then
- # devkit-disks is now mounting lots of stuff. for now, let's just try to
- # unmount it all
- umount /media/* 2>/dev/null
- tac /proc/mounts | grep ^/dev | grep -v live |
- while read dev mntpoint rest; do
- # hack - don't unmount devices the storage test code requires
- if [ "$mntpoint" = "/mnt/anactest" ]; then
- continue
- fi
-
- if [ -b $dev ]; then
- umount $mntpoint 2>/dev/null
- fi
- done
-
- /sbin/swapoff -a
- /sbin/lvm vgchange -an --ignorelockingfailure
- for i in /dev/md*; do
- if [ ! -b $i ]; then
- continue
- fi
-
- case "$i" in
- /dev/md*p*)
- ;;
- *)
- mdadm --stop $i >/dev/null 2>&1
- ;;
- esac
- done
-fi
+# unmount anything that shouldn't be mounted prior to install
+anaconda-cleanup $ANACONDA $*
/sbin/udevadm control --env=ANACONDA=1
@@ -143,7 +113,7 @@ fi
# try to teardown the filesystems if this was an image install
if [ $IMAGE_INSTALL = 1 -a $RESCUE = 0 ]; then
- anaconda-image-cleanup
+ anaconda-cleanup
fi
if flags.imageInstall:
- print(_("Run anaconda-image-cleanup to unmount the system "
- "when you are finished."))
+ print(_("Run %s to unmount the system when you are finished.")
+ % ANACONDA_CLEANUP)
else:
print(_("When finished please exit from the shell and your "
"system will reboot."))
@@ -379,8 +379,8 @@ def runRescue(anaconda):
msg = _("The system will reboot automatically when you exit "
"from the shell.")
else:
- msg = _("Run anaconda-image-cleanup to unmount the system "
- "when you are finished.")
+ msg = _("Run %s to unmount the system "
+ "when you are finished.") % ANACONDA_CLEANUP
if rc == -1:
if anaconda.ksdata:
@@ -479,8 +479,8 @@ def runRescue(anaconda):
msg = _("The system will reboot automatically when you "
"exit from the shell.")
else:
- msg = _("Run anaconda-image-cleanup to unmount the system "
- "when you are finished.")
+ msg = _("Run %s to unmount the system "
+ "when you are finished.") % ANACONDA_CLEANUP
ButtonChoiceWindow(screen, _("Rescue"),
_("An error occurred trying to mount some or all of your "
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index 692dd34..329a2fc 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -25,7 +25,7 @@ dist_scripts_DATA = mk-images.* pyrc.py
dist_noinst_SCRIPTS = getlangnames.py upd-bootimage upd-initrd upd-kernel
makeupdates
-dist_bin_SCRIPTS = analog anaconda-image-cleanup
+dist_bin_SCRIPTS = analog anaconda-cleanup
stage2scriptsdir = $(datadir)/$(PACKAGE_NAME)
dist_stage2scripts_SCRIPTS = restart-anaconda
diff --git a/scripts/anaconda-cleanup b/scripts/anaconda-cleanup
new file mode 100755
index 0000000..5107bfc
--- /dev/null
+++ b/scripts/anaconda-cleanup
@@ -0,0 +1,98 @@
+#!/usr/bin/python
+"""
+ image install:
+
+ - unmount everything under /mnt/sysimage
+ - populate a devicetree with only the image "disks"
+
+ live install:
+
+ - unmount everything under /mnt/sysimage
+ - unmount everything under /media
+ - populate a devicetree and tear everything down
+
+"""
+import os
+import sys
+
+live_install = "--liveinst" in sys.argv
+image_install = False
+
+# see if there are disk images to take down
+sys_class_block = "/sys/class/block"
+for dev in os.listdir(sys_class_block):
+ if not dev.startswith("dm-"):
+ continue
+
+ uuid = open("%s/%s/dm/uuid" % (sys_class_block, dev)).read().strip()
+ if uuid.startswith("ANACONDA-"):
+ image_install = True
+ break
+
+# set the imageInstall flag so the logger won't log to the syslog
+from pyanaconda.flags import flags
+flags.imageInstall = True
+
+import pyanaconda.anaconda_log
+pyanaconda.anaconda_log.init()
+
+from pyanaconda import iutil
+
+from pyanaconda.cmdline import InstallInterface
+from pyanaconda.storage import StorageDiscoveryConfig
+from pyanaconda.storage.devicetree import DeviceTree
+from pyanaconda.storage import devicelibs
+
+intf = InstallInterface()
+storage_config = StorageDiscoveryConfig()
+
+# find devices representing disk images
+sys_class_block = "/sys/class/block"
+for dev in os.listdir(sys_class_block):
+ if not dev.startswith("dm-"):
+ continue
+
+ name = open("%s/%s/dm/name" % (sys_class_block, dev)).read().strip()
+ uuid = open("%s/%s/dm/uuid" % (sys_class_block, dev)).read().strip()
+ if not name or not uuid.startswith("ANACONDA-"):
+ continue
+
+ loop = os.listdir("%s/%s/slaves" % (sys_class_block, dev))[0].strip()
+ path = devicelibs.loop.get_device_path(loop)
+ storage_config.diskImages[name] = path
+
+if not image_install and not live_install:
+ print >> sys.stderr, "not a live install or an image install -- exiting"
+ sys.exit(1)
+
+# unmount filesystems
+for mounted in reversed(open("/proc/mounts").readlines()):
+ (device, mountpoint, rest) = mounted.split(" ", 2)
+ if mountpoint.startswith("/mnt/anactest"):
+ continue
+
+ # If this is for an image install, only unmount all filesystems under
+ # /mnt/sysimage
+ if image_install and not mountpoint.startswith("/mnt/sysimage"):
+ continue
+
+ # If this is for a live install, unmount any non-nodev filesystem that
+ # isn't related to the live image.
+ if (not mountpoint.startswith("/media") and
+ not device.startswith("/dev") or
+ "live" in mounted):
+ continue
+
+ os.system("umount %s" % mountpoint)
+
+os.system("udevadm control --env=ANACONDA=1")
+os.system("udevadm trigger --subsystem-match block")
+os.system("udevadm settle")
+devicetree = DeviceTree(intf=intf, conf=storage_config)
+devicetree.populate(cleanupOnly=True)
+devicetree.teardownAll()
+for name in devicetree.diskImages.keys():
+ device = devicetree.getDeviceByName(name)
+ device.deactivate(recursive=True)
+os.system("udevadm control --env=ANACONDA=0")
+
diff --git a/scripts/anaconda-image-cleanup b/scripts/anaconda-image-cleanup
deleted file mode 100755
index 5107bfc..0000000
--- a/scripts/anaconda-image-cleanup
+++ /dev/null
@@ -1,98 +0,0 @@
-#!/usr/bin/python
-"""
- image install:
-
- - unmount everything under /mnt/sysimage
- - populate a devicetree with only the image "disks"
-
- live install:
-
- - unmount everything under /mnt/sysimage
- - unmount everything under /media
- - populate a devicetree and tear everything down
-
-"""
-import os
-import sys
-
-live_install = "--liveinst" in sys.argv
-image_install = False
-
-# see if there are disk images to take down
-sys_class_block = "/sys/class/block"
-for dev in os.listdir(sys_class_block):
- if not dev.startswith("dm-"):
- continue
-
- uuid = open("%s/%s/dm/uuid" % (sys_class_block, dev)).read().strip()
- if uuid.startswith("ANACONDA-"):
- image_install = True
- break
-
-# set the imageInstall flag so the logger won't log to the syslog
-from pyanaconda.flags import flags
-flags.imageInstall = True
-
-import pyanaconda.anaconda_log
-pyanaconda.anaconda_log.init()
-
-from pyanaconda import iutil
-
-from pyanaconda.cmdline import InstallInterface
-from pyanaconda.storage import StorageDiscoveryConfig
-from pyanaconda.storage.devicetree import DeviceTree
-from pyanaconda.storage import devicelibs
-
-intf = InstallInterface()
-storage_config = StorageDiscoveryConfig()
-
-# find devices representing disk images
-sys_class_block = "/sys/class/block"
-for dev in os.listdir(sys_class_block):
- if not dev.startswith("dm-"):
- continue
-
- name = open("%s/%s/dm/name" % (sys_class_block, dev)).read().strip()
- uuid = open("%s/%s/dm/uuid" % (sys_class_block, dev)).read().strip()
- if not name or not uuid.startswith("ANACONDA-"):
- continue
-
- loop = os.listdir("%s/%s/slaves" % (sys_class_block, dev))[0].strip()
- path = devicelibs.loop.get_device_path(loop)
- storage_config.diskImages[name] = path
-
-if not image_install and not live_install:
- print >> sys.stderr, "not a live install or an image install -- exiting"
- sys.exit(1)
-
-# unmount filesystems
-for mounted in reversed(open("/proc/mounts").readlines()):
- (device, mountpoint, rest) = mounted.split(" ", 2)
- if mountpoint.startswith("/mnt/anactest"):
- continue
-
- # If this is for an image install, only unmount all filesystems under
- # /mnt/sysimage
- if image_install and not mountpoint.startswith("/mnt/sysimage"):
- continue
-
- # If this is for a live install, unmount any non-nodev filesystem that
- # isn't related to the live image.
- if (not mountpoint.startswith("/media") and
- not device.startswith("/dev") or
- "live" in mounted):
- continue
-
- os.system("umount %s" % mountpoint)
-
-os.system("udevadm control --env=ANACONDA=1")
-os.system("udevadm trigger --subsystem-match block")
-os.system("udevadm settle")
-devicetree = DeviceTree(intf=intf, conf=storage_config)
-devicetree.populate(cleanupOnly=True)
-devicetree.teardownAll()
-for name in devicetree.diskImages.keys():
- device = devicetree.getDeviceByName(name)
- device.deactivate(recursive=True)
-os.system("udevadm control --env=ANACONDA=0")
-
--
1.7.3.2
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list