[PATCH 1/2] dracut: fix crash with PXE ipappend and ks=file:..
by Will Woods
If you're using pxelinux with 'ipappend 2', it will add a "BOOTIF=..."
argument to your boot args.
parse-kickstart will rewrite your first 'network' line to a "ip=..."
argument for dracut.
But dracut refuses to allow "ip=..." and "BOOTIF=..." arguments to mix,
so this makes it die with the message:
FATAL: Mixing BOOTIF and ip= lines is dangerous
So: parse-kickstart should check the boot arguments, and not bother
generating an "ip=..." line if "BOOTIF" is already there.
---
dracut/parse-kickstart | 26 ++++++++++++++++++--------
1 file changed, 18 insertions(+), 8 deletions(-)
diff --git a/dracut/parse-kickstart b/dracut/parse-kickstart
index 3b6b861..d81dc72 100755
--- a/dracut/parse-kickstart
+++ b/dracut/parse-kickstart
@@ -23,6 +23,23 @@ from collections import OrderedDict
# Default logging: none
log = logging.getLogger('parse-kickstart').addHandler(logging.NullHandler())
+# So we can examine commandline args
+def readfile(f):
+ try:
+ val = open(f).readline().strip()
+ except IOError:
+ val = None
+ return val
+
+def read_cmdline(f):
+ args = OrderedDict()
+ for arg in readfile(f).split():
+ k,e,v = arg.partition("=")
+ args[k] = v
+ return args
+
+proc_cmdline = read_cmdline("/proc/cmdline")
+
# Here are the kickstart commands we care about:
class Method(commands.method.F14_Method):
@@ -79,7 +96,7 @@ class Network(commands.network.F16_Network):
# write ifcfg for all listed devices
ksnet_to_ifcfg(net)
# anaconda tradition: bring up the first device listed, and no others
- if len(self.network) == 1:
+ if len(self.network) == 1 and "BOOTIF" not in proc_cmdline:
netline = ksnet_to_dracut(args, lineno, net, bootdev=True)
return netline
@@ -215,13 +232,6 @@ def ksnet_to_dracut(args, lineno, net, bootdev=False):
return " ".join(line)
-def readfile(f):
- try:
- val = open(f).readline().strip()
- except IOError:
- val = None
- return val
-
def ksnet_to_ifcfg(net, filename=None):
'''Write an ifcfg file for the given kickstart network config'''
dev = net.device
--
1.7.11.2
11 years, 9 months
[PATCH 1/4] add command line option to set the platform.
by Dennis Gilmore
Use case is to create images using livemedia-creator where we wont be
running on the target platform, this could be for a arm system, or
could be used to make efi bootable media on a non efi system, or any
other use case where we need to override anacondas detection of the
running system.
Signed-off-by: Dennis Gilmore <dennis(a)ausil.us>
---
anaconda | 4 ++++
pyanaconda/flags.py | 1 +
pyanaconda/iutil.py | 3 +++
3 files changed, 8 insertions(+)
diff --git a/anaconda b/anaconda
index fc679c9..c37dd72 100755
--- a/anaconda
+++ b/anaconda
@@ -222,6 +222,7 @@ def parseOptions(argv=None, cmdline=None):
op.add_option("--kickstart", dest="ksfile")
op.add_option("--rescue", dest="rescue", action="store_true", default=False)
op.add_option("--targetarch", "rpmarch", dest="targetArch", type="string")
+ op.add_option("--targetplatform", "platform", dest="targetPlatform", type="string")
op.add_option("-m", "--method", dest="method", default=None)
op.add_option("--repo", dest="method", default=None)
@@ -803,6 +804,9 @@ if __name__ == "__main__":
if opts.targetArch:
flags.targetarch = opts.targetArch
+ if opts.targetPlatform:
+ flags.platform = opts.targetPlatform
+
# set flags
flags.dmraid = opts.dmraid
flags.mpath = opts.mpath
diff --git a/pyanaconda/flags.py b/pyanaconda/flags.py
index 92584fd..7a18043 100644
--- a/pyanaconda/flags.py
+++ b/pyanaconda/flags.py
@@ -58,6 +58,7 @@ class Flags(object):
self.targetarch = None
self.useIPv4 = True
self.useIPv6 = True
+ self.platform = None
self.preexisting_x11 = False
self.noverifyssl = False
self.imageInstall = False
diff --git a/pyanaconda/iutil.py b/pyanaconda/iutil.py
index ed6d098..aef4cc6 100644
--- a/pyanaconda/iutil.py
+++ b/pyanaconda/iutil.py
@@ -627,6 +627,9 @@ def getARMMachine():
if not isARM():
return 0
+ if flags.platform:
+ return flags.platform
+
armMachine = os.uname()[2].rpartition('.' )[2]
if armMachine.startswith('arm'):
--
1.7.11.2
11 years, 9 months