FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Fedora Design Team

 
 
LinkBack Thread Tools
 
Old 12-15-2010, 08:01 PM
David Lehman
 
Default Add ability to clean up prior to live install.

---
scripts/anaconda-image-cleanup | 59 +++++++++++++++++++++++++++++++++------
1 files changed, 50 insertions(+), 9 deletions(-)

diff --git a/scripts/anaconda-image-cleanup b/scripts/anaconda-image-cleanup
index 366d8d2..5107bfc 100755
--- a/scripts/anaconda-image-cleanup
+++ b/scripts/anaconda-image-cleanup
@@ -1,7 +1,34 @@
#!/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
@@ -19,14 +46,7 @@ from pyanaconda.storage import devicelibs
intf = InstallInterface()
storage_config = StorageDiscoveryConfig()

-# unmount filesystems
-for mounted in reversed(open("/proc/mounts").readlines()):
- (device, mountpoint, rest) = mounted.split(" ", 2)
- if not mountpoint.startswith("/mnt/sysimage"):
- continue
- os.system("umount %s" % mountpoint)
-
-# tear down the devices representing the disk images
+# find devices representing disk images
sys_class_block = "/sys/class/block"
for dev in os.listdir(sys_class_block):
if not dev.startswith("dm-"):
@@ -41,9 +61,30 @@ for dev in os.listdir(sys_class_block):
path = devicelibs.loop.get_device_path(loop)
storage_config.diskImages[name] = path

-if not storage_config.diskImages:
+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")
--
1.7.3.2

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 05:08 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org