On Wed, 2013-02-06 at 16:26 -0800, Brian C. Lane wrote:
From: "Brian C. Lane" bcl@redhat.com
This disables the storage spoke and installs to /mnt/sysimage without mounting any filesystems. If something is already mounted on /mnt/sysimage it leaves it untouched.
This can be useful for utilities like livemedia-creator which will mount a filesystem image on the directory and then run anaconda to install to it.
anaconda | 31 +++++++++++++++++++++---------- pyanaconda/flags.py | 1 + pyanaconda/install.py | 10 ++++++---- pyanaconda/ui/gui/spokes/storage.py | 4 ++++ pyanaconda/ui/tui/spokes/storage.py | 4 ++++ 5 files changed, 36 insertions(+), 14 deletions(-)
diff --git a/anaconda b/anaconda index 0789094..8e32b87 100755 --- a/anaconda +++ b/anaconda @@ -50,7 +50,7 @@ def exitHandler(rebootData, storage, exitCode=None): while True: time.sleep(10000)
- if image_count:
- if image_count or flags.dirInstall: anaconda.storage.umountFilesystems(ignoreErrors=True, swapoff=False) devicetree = anaconda.storage.devicetree devicetree.teardownAll()
@@ -60,7 +60,8 @@ def exitHandler(rebootData, storage, exitCode=None): loop.controllable = True device.deactivate(recursive=True)
- if not flags.imageInstall and not flags.livecdInstall:
- if not flags.imageInstall and not flags.livecdInstall \
and not flags.dirInstall: from pykickstart.constants import KS_SHUTDOWN, KS_WAIT, KS_REBOOT from pyanaconda.iutil import dracut_eject@@ -281,6 +282,7 @@ def parseOptions(argv=None, cmdline=None): op.add_option("--updates", dest="updateSrc", action="store", type="string") op.add_option("--dlabel", action="store_true", default=False) op.add_option("--image", action="append", dest="images", default=[])
- op.add_option("--dirinstall", action="store_true", default=False) op.add_option("--memcheck", action="store_true", default=True) op.add_option("--nomemcheck", action="store_false", dest="memcheck") op.add_option("--leavebootorder", action="store_true", default=False)
@@ -645,8 +647,6 @@ if __name__ == "__main__": # do this early so we can set flags before initializing logging from pyanaconda.flags import flags (opts, args, depr) = parseOptions(cmdline=flags.cmdline)
if opts.images:
flags.imageInstall = True# Set up logging as early as possible. import logging
@@ -661,6 +661,14 @@ if __name__ == "__main__": stdoutLog.error("anaconda must be run as root.") sys.exit(0)
- if opts.images and opts.dirinstall:
stdoutLog.error("--images and --dirinstall cannot be used at the same time")sys.exit(0)- elif opts.images:
flags.imageInstall = True- elif opts.dirinstall:
flags.dirInstall = True- # see if we're on s390x and if we've got an ssh connection uname = os.uname() if uname[4] == 's390x':
@@ -783,7 +791,8 @@ if __name__ == "__main__": flags.mpath = opts.mpath flags.selinux = opts.selinux
- if not flags.livecdInstall and not flags.imageInstall:
if not flags.livecdInstall and not flags.imageInstall \
and not flags.dirInstall: startAuditDaemon()# setup links required for all install types
@@ -972,18 +981,20 @@ if __name__ == "__main__": from pyanaconda.rescue import doRescue doRescue(anaconda.rescue_mount, ksdata, anaconda.platform)
- threadMgr.add(AnacondaThread(name="AnaStorageThread", target=storageInitialize, args=(anaconda.storage, ksdata, anaconda.protected)))
if not flags.dirInstall:
threadMgr.add(AnacondaThread(name="AnaStorageThread", target=storageInitialize, args=(anaconda.storage, ksdata, anaconda.protected)))threadMgr.add(AnacondaThread(name="AnaNetworkThread", target=networkInitialize, args=(ksdata,))) threadMgr.add(AnacondaThread(name="AnaPayloadThread", target=payloadInitialize, args=(anaconda.storage, ksdata, anaconda.payload)))
atexit.register(exitHandler, ksdata.reboot, anaconda.storage)
# setup ntp servers and start NTP daemon if not requested otherwise
- if (not flags.imageInstall) and anaconda.ksdata.timezone.ntpservers:
ntp.save_servers_to_config(anaconda.ksdata.timezone.ntpservers)
- if not flags.imageInstall and not flags.dirInstall:
if anaconda.ksdata.timezone.ntpservers:ntp.save_servers_to_config(anaconda.ksdata.timezone.ntpservers)
I think using 'and ' is better than using two ifs as it saves indentation (which is good especially in this case of a long line indented).
Also I believe pyanaconda.flags.can_touch_runtime_system should be patched.