summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG3
-rw-r--r--MANIFEST.in1
-rw-r--r--cobbler.spec2
-rw-r--r--cobbler/action_import.py14
-rw-r--r--cobbler/pxegen.py65
-rw-r--r--cobbler/utils.py10
-rw-r--r--installer_templates/settings.template4
-rw-r--r--loaders/zpxe.rexx261
-rw-r--r--setup.py2
-rw-r--r--snippets/post_s390_reboot10
-rw-r--r--templates/pxeprofile_s390x.template1
-rw-r--r--templates/pxesystem_s390x.template1
-rw-r--r--templates/s390x_conf.template89
-rw-r--r--templates/s390x_parm.template25
14 files changed, 404 insertions, 84 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 28a91511..acbe32ab 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -29,6 +29,9 @@ Cobbler CHANGELOG
- (BUGF) Use shlex for parsing --kopts to allow a wider variety of kernel options
- (BUGF) prevent potential traceback when --template-file data isn't a hash
+- XXX - 1.4.3
+- (BUGF) fix OMAPI support's (note: deprecated) usage of subprocess
+
- XXX - 1.4.2
- (BUGF) fix WTI power templates
- (FEAT) add WTI power type
diff --git a/MANIFEST.in b/MANIFEST.in
index 43fc6776..a5d1643f 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -2,6 +2,7 @@ include loaders/COPYING_ELILO
include loaders/elilo-3.8-ia64.efi
include loaders/menu.c32
include loaders/yaboot-1.3.14
+include loaders/zpxe.rexx
include config/acls.conf
include config/cobbler.conf
include config/cobbler_svc.conf
diff --git a/cobbler.spec b/cobbler.spec
index 70b09f1c..1821ee4b 100644
--- a/cobbler.spec
+++ b/cobbler.spec
@@ -267,10 +267,12 @@ test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT
%config(noreplace) /var/lib/cobbler/snippets/koan_environment
%config(noreplace) /var/lib/cobbler/snippets/pre_anamon
%config(noreplace) /var/lib/cobbler/snippets/post_anamon
+%config(noreplace) /var/lib/cobbler/snippets/post_s390_reboot
%config(noreplace) /var/lib/cobbler/snippets/redhat_register
/var/lib/cobbler/elilo-3.8-ia64.efi
/var/lib/cobbler/menu.c32
/var/lib/cobbler/yaboot-1.3.14
+/var/lib/cobbler/zpxe.rexx
%defattr(660,root,root)
%config(noreplace) /etc/cobbler/users.digest
diff --git a/cobbler/action_import.py b/cobbler/action_import.py
index f5bd557d..3de63b98 100644
--- a/cobbler/action_import.py
+++ b/cobbler/action_import.py
@@ -88,8 +88,8 @@ class Importer:
if self.arch == "x86":
# be consistent
self.arch = "i386"
- if self.arch not in [ "i386", "ia64", "ppc", "ppc64", "s390x", "x86_64", ]:
- raise CX(_("arch must be i386, ia64, ppc, ppc64, s390x or x86_64"))
+ if self.arch not in [ "i386", "ia64", "ppc", "ppc64", "s390", "s390x", "x86_64", ]:
+ raise CX(_("arch must be i386, ia64, ppc, ppc64, s390, s390x or x86_64"))
# if we're going to do any copying, set where to put things
# and then make sure nothing is already there.
@@ -113,7 +113,7 @@ class Importer:
if self.arch:
# append the arch path to the name if the arch is not already
# found in the name.
- for x in [ "i386", "ia64", "ppc", "ppc64", "s390x", "x86_64", "x86", ]:
+ for x in [ "i386", "ia64", "ppc", "ppc64", "s390", "s390x", "x86_64", "x86", ]:
if self.mirror_name.lower().find(x) != -1:
if self.arch != x :
raise CX(_("Architecture found on pathname (%s) does not fit the one given in command line (%s)")%(x,self.arch))
@@ -519,7 +519,7 @@ class Importer:
print "- following symlink: %s" % fullname
os.path.walk(fullname, self.distro_adder, foo)
- if x.startswith("initrd") or x.startswith("ramdisk.image.gz"):
+ if ( x.startswith("initrd") or x.startswith("ramdisk.image.gz") ) and x != "initrd.size":
initrd = os.path.join(dirname,x)
if ( x.startswith("vmlinu") or x.startswith("kernel.img") ) and x.find("initrd") == -1:
kernel = os.path.join(dirname,x)
@@ -774,7 +774,7 @@ class Importer:
name = name.replace("chrp","ppc64")
for separator in [ '-' , '_' , '.' ] :
- for arch in [ "i386" , "x86_64" , "ia64" , "ppc64", "ppc32", "ppc", "x86" , "s390x" , "386" , "amd" ]:
+ for arch in [ "i386" , "x86_64" , "ia64" , "ppc64", "ppc32", "ppc", "x86" , "s390", "s390x" , "386" , "amd" ]:
name = name.replace("%s%s" % ( separator , arch ),"")
return name
@@ -793,6 +793,8 @@ class Importer:
if dirname.find("i386") != -1 or dirname.find("386") != -1 or dirname.find("x86") != -1:
return "i386"
if dirname.find("s390") != -1:
+ return "s390"
+ if dirname.find("s390x") != -1:
return "s390x"
if dirname.find("ppc64") != -1 or dirname.find("chrp") != -1:
return "ppc64"
@@ -915,7 +917,7 @@ class BaseImporter:
for x in fnames:
if self.match_kernelarch_file(x):
# print _("- kernel header found: %s") % x
- for arch in [ "i386" , "x86_64" , "ia64" , "ppc64", "ppc", "s390x" ]:
+ for arch in [ "i386" , "x86_64" , "ia64" , "ppc64", "ppc", "s390", "s390x" ]:
if x.find(arch) != -1:
foo[arch] = 1
for arch in [ "i686" , "amd64" ]:
diff --git a/cobbler/pxegen.py b/cobbler/pxegen.py
index 262649f1..e003a9d9 100644
--- a/cobbler/pxegen.py
+++ b/cobbler/pxegen.py
@@ -24,6 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
import os
import os.path
import shutil
+import shlex
import time
import sys
import glob
@@ -123,8 +124,6 @@ class PXEGen:
print e.value
# FIXME: using logging module so this ends up in cobbler.log?
- if len(errors) > 0:
- raise CX(_("Error(s) encountered while copying distro files"))
def copy_images(self):
"""
@@ -141,8 +140,6 @@ class PXEGen:
print e.value
# FIXME: using logging module so this ends up in cobbler.log?
- if len(errors) > 0:
- raise CX(_("Error(s) encountered while copying image files"))
def copy_single_distro_files(self, d):
for dirtree in [self.bootloc, self.settings.webdir]:
@@ -482,25 +479,28 @@ class PXEGen:
image = profile
# hack: s390 generates files per system not per interface
- if not image_based and distro.arch == "s390x":
+ if not image_based and distro.arch.startswith("s390"):
+ # Always write a system specific _conf and _parm file
f2 = os.path.join(self.bootloc, "s390x", "s_%s" % system.name)
+ cf = "%s_conf" % f2
+ pf = "%s_parm" % f2
+ template_cf = open("/etc/cobbler/pxe/s390x_conf.template")
+ template_pf = open("/etc/cobbler/pxe/s390x_parm.template")
+ blended = utils.blender(self.api, True, system)
+ self.templar.render(template_cf, blended, cf)
+ # FIXME: profiles also need this data!
+ # FIXME: the _conf and _parm files are limited to 80 characters in length
+ kickstart_path = "http://%s/cblr/svc/op/ks/system/%s" % (blended["http_server"], system.name)
+ # gather default kernel_options and default kernel_options_s390x
+ kopts = blended.get("kernel_options","")
+ hkopts = shlex.split(utils.hash_to_string(kopts))
+ blended["kickstart_expanded"] = "ks=%s" % kickstart_path
+ blended["kernel_options"] = hkopts
+ self.templar.render(template_pf, blended, pf)
+
+ # Write system specific zPXE file if netboot_enabled?
if system.netboot_enabled:
- cf = "%s_conf" % f2
- pf = "%s_parm" % f2
- template_cf = open("/etc/cobbler/pxe/s390x_conf.template")
- template_pf = open("/etc/cobbler/pxe/s390x_parm.template")
self.write_pxe_file(f2,system,profile,distro,distro.arch)
- blended = utils.blender(self.api, True, system)
- self.templar.render(template_cf, blended, cf)
- # FIXME: profiles also need this data!
- kickstart_path = "http://%s/cblr/svc/op/ks/system/%s" % (blended["http_server"], system.name)
- meta2 = {}
- meta2["kickstart_expanded"] = "ks=%s" % kickstart_path
- ## FIXME: this may not work right for kernel options with
- ## a space in them though there are not many of those.
- meta2["kernel_options"] = "\n".join(blended["kernel_options"].split(" "))
- meta2["confname"] = "s_%s_conf" % system.name
- self.templar.render(template_pf, meta2, pf)
else:
# ensure the file doesn't exist
utils.rmfile(f2)
@@ -575,7 +575,7 @@ class PXEGen:
distro = profile.get_conceptual_parent()
if distro is None:
raise CX(_("profile is missing distribution: %s, %s") % (profile.name, profile.distro))
- if distro.arch == "s390x":
+ if distro.arch.startswith("s390"):
listfile.write("%s\n" % profile.name)
f2 = os.path.join(self.bootloc, "s390x", "p_%s" % profile.name)
self.write_pxe_file(f2,None,profile,distro,distro.arch)
@@ -586,15 +586,14 @@ class PXEGen:
blended = utils.blender(self.api, True, profile)
self.templar.render(template_cf, blended, cf)
# FIXME: profiles also need this data!
+ # FIXME: the _conf and _parm files are limited to 80 characters in length
kickstart_path = "http://%s/cblr/svc/op/ks/profile/%s" % (blended["http_server"], profile.name)
- meta2 = {}
- meta2["kickstart_expanded"] = "ks=%s" % kickstart_path
- ## FIXME: this may not work right for kernel options with
- ## a space in them though there are not many of those.
- meta2["kernel_options"] = "\n".join(blended["kernel_options"].split(" "))
- meta2["confname"] = "p_%s_conf" % profile.name
- self.templar.render(template_pf, meta2, pf)
-
+ # gather default kernel_options and default kernel_options_s390x
+ kopts = blended.get("kernel_options","")
+ hkopts = shlex.split(utils.hash_to_string(kopts))
+ blended["kickstart_expanded"] = "ks=%s" % kickstart_path
+ blended["kernel_options"] = hkopts
+ self.templar.render(template_pf, blended, pf)
listfile.close()
@@ -761,7 +760,7 @@ class PXEGen:
else:
template = os.path.join(self.settings.pxe_template_dir,"pxesystem.template")
- if arch == "s390x":
+ if arch.startswith("s390"):
template = os.path.join(self.settings.pxe_template_dir,"pxesystem_s390x.template")
elif arch == "ia64":
template = os.path.join(self.settings.pxe_template_dir,"pxesystem_ia64.template")
@@ -795,7 +794,7 @@ class PXEGen:
if distro is not None and distro.breed == "windows":
template = os.path.join(self.settings.pxe_template_dir,"pxeprofile_win.template")
- elif arch == "s390x":
+ elif arch.startswith("s390"):
template = os.path.join(self.settings.pxe_template_dir,"pxeprofile_s390x.template")
else:
template = os.path.join(self.settings.pxe_template_dir,"pxeprofile.template")
@@ -838,14 +837,14 @@ class PXEGen:
# interface=bootif causes a failure
# append_line = append_line.replace("ksdevice","interface")
- if arch in ["s390x", "ppc", "ppc64"]:
+ if arch in ["s390", "s390x", "ppc", "ppc64"]:
# remove the prefix "append"
append_line = append_line[7:]
# store variables for templating
metadata["menu_label"] = ""
if profile:
- if not arch in [ "ia64", "ppc", "ppc64", "s390x" ]:
+ if not arch in [ "ia64", "ppc", "ppc64", "s390", "s390x" ]:
metadata["menu_label"] = "MENU LABEL %s" % profile.name
metadata["profile_name"] = profile.name
elif image:
diff --git a/cobbler/utils.py b/cobbler/utils.py
index 7f662e0d..1a566694 100644
--- a/cobbler/utils.py
+++ b/cobbler/utils.py
@@ -459,11 +459,11 @@ def blender(api_handle,remove_hashes, root_obj):
# hack -- s390 nodes get additional default kernel options
arch = results.get("arch","?")
- if arch == "s390x":
+ if arch.startswith("s390"):
keyz = settings.kernel_options_s390x.keys()
for k in keyz:
if not results.has_key(k):
- results[k] = settings.kernel_options_s390x[k]
+ results["kernel_options"][k] = settings.kernel_options_s390x[k]
# determine if we have room to add kssendmac to the kernel options line
kernel_txt = hash_to_string(results["kernel_options"])
@@ -1048,13 +1048,13 @@ def set_redhat_management_key(self,key):
def set_arch(self,arch):
if arch is None or arch == "":
arch = "x86"
- if arch in [ "standard", "ia64", "x86", "i386", "ppc", "ppc64", "x86_64", "s390x" ]:
+ if arch in [ "standard", "ia64", "x86", "i386", "ppc", "ppc64", "x86_64", "s390", "s390x" ]:
if arch == "x86" or arch == "standard":
# be consistent
arch = "i386"
self.arch = arch
return True
- raise CX(_("arch choices include: x86, x86_64, ppc, ppc64, s390x and ia64"))
+ raise CX(_("arch choices include: x86, x86_64, ppc, ppc64, s390, s390x and ia64"))
def set_os_version(self,os_version):
if os_version == "" or os_version is None:
@@ -1386,7 +1386,7 @@ def popen2(args, **kwargs):
Leftovers from borrowing some bits from Snake, replace this
function with just the subprocess call.
"""
- p = sub_process.Popen(args, stdout=subprocess.PIPE, stdin=subprocess.PIPE, **kwargs)
+ p = sub_process.Popen(args, stdout=sub_process.PIPE, stdin=sub_process.PIPE, **kwargs)
return (p.stdout, p.stdin)
if __name__ == "__main__":
diff --git a/installer_templates/settings.template b/installer_templates/settings.template
index 9d8c5c0c..5ceb6be0 100644
--- a/installer_templates/settings.template
+++ b/installer_templates/settings.template
@@ -142,12 +142,12 @@ kernel_options:
# above defaults
kernel_options_s390x:
+ RUNKS: 1
ramdisk_size: 40000
root: /dev/ram0
ro: ~
ip: off
- CMSDASD: 191
- RUNKS: 1
+ vnc: ~
# configuration options if using the authn_ldap module. See the
# the Wiki for details. This can be ignored if you are not using
diff --git a/loaders/zpxe.rexx b/loaders/zpxe.rexx
new file mode 100644
index 00000000..3ce6f576
--- /dev/null
+++ b/loaders/zpxe.rexx
@@ -0,0 +1,261 @@
+/* zPXE: REXX PXE Client for System z
+
+zPXE is a PXE client used with Cobbler. It must be run under
+z/VM. zPXE uses TFTP to first download a list of profiles,
+then a specific kernel, initial RAMdisk, and PARM file. These
+files are then punched to start the install process.
+
+zPXE does not require a writeable 191 A disk. Files are
+downloaded to a temporary disk (VDISK).
+
+zPXE can also IPL a DASD disk by default. You can specify the
+default dasd in ZPXE CONF, as well as the hostname of the Cobbler
+server.
+---
+
+Copyright 2006-2009, Red Hat, Inc
+Brad Hinson <bhinson@redhat.com>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA
+*/
+
+
+/* Defaults */
+
+server = '' /* define server in ZPXE CONF */
+iplDisk = 100 /* overridden by value in ZPXE CONF */
+profilelist = PROFILE LIST T /* VDISK will be defined as T later */
+profiledetail = PROFILE DETAIL T
+zpxeparm = ZPXE PARM T
+zpxeconf = ZPXE CONF T
+config = ZPXE CONF
+
+/* For translating strings to lowercase */
+upper = xrange('A', 'Z')
+lower = xrange('a', 'z')
+
+/* Useful settings normally found in PROFILE EXEC */
+'cp set run on'
+'cp set pf11 retrieve forward'
+'cp set pf12 retrieve'
+
+/* Check for config file */
+if lines(config) > 0 then do
+ inputline = linein(config) /* first line is server hostname/IP */
+ parse var inputline . server .
+ inputline = linein(config) /* second line is DASD disk to IPL */
+ parse var inputline . iplDisk .
+end
+
+/* Define temporary disk (VDISK) to store files */
+'detach ffff' /* detach ffff if present */
+'define vfb-512 as ffff blk 100000' /* 512 byte block size =~ 50 MB */
+queue '1'
+queue 'tmpdsk'
+'format ffff t' /* format VDISK as file mode t */
+
+/* Link TCPMAINT disk for access to TFTP */
+'link tcpmaint 592 592 rr'
+'access 592 e'
+
+/* Query user ID. This is used later to determine:
+ 1. Whether a user-specific PXE profile exists.
+ 2. Whether user is disconnected. If so, IPL the default disk.
+*/
+'pipe cp query' userid() '| var user'
+parse value user with id . dsc .
+userid = translate(id, lower, upper)
+
+/* Check whether a user-specific PXE profile exists.
+ If so, proceed with this. Otherwise, continue and
+ show the system-wide profile menu.
+*/
+call GetTFTP '/s390x/s_'userid 'profile.detail.t'
+
+/* Get user PARM and CONF. If available, will be used later */
+call GetTFTP '/s390x/s_'userid'_parm' 'zpxe.parm.t' /* get parm */
+call GetTFTP '/s390x/s_'userid'_conf' 'zpxe.conf.t' /* get conf */
+
+if lines(profiledetail) > 0 then do
+ vmfclear /* clear screen */
+ call CheckServer /* print server name */
+ say 'Profile 'userid' found'
+ say ''
+ call DownloadBinaries /* download kernel and initrd */
+ say 'Starting install...'
+ say ''
+ call PunchFiles /* punch files to begin install */
+ exit
+end /* if user-specific profile found */
+
+
+/* Download initial profile list */
+call GetTFTP '/s390x/profile_list' 'profile.list.t'
+
+vmfclear /* clear screen */
+call CheckServer /* print server name */
+
+say 'zPXE MENU' /* show menu */
+say '---------'
+
+count = 0
+do while lines(profilelist) > 0 /* display one profile per line */
+ count = count + 1
+ inputline = linein(profilelist)
+ parse var inputline profile.count
+ say count'. 'profile.count
+end
+
+if (count = 0) then
+ say '** Error connecting to server: no profiles found **'
+
+count = count + 1
+say count'. Exit to CMS shell [IPL CMS]'
+say ''
+say ''
+say 'Enter Choice -->'
+say 'or press <Enter> to boot from disk [DASD 'iplDisk']'
+
+/* Check if user is disconnected, indicating
+ logon by XAUTOLOG. In this case, IPL the
+ default disk.
+*/
+if (dsc = 'DSC') then do /* user is disconnected */
+ say 'User disconnected. Booting from DASD 'iplDisk'...'
+ 'cp ipl' iplDisk
+ end
+else do /* user is interactive -> prompt */
+ parse upper pull answer .
+ select
+ when (answer = count)
+ then do
+ say 'Exiting to CMS shell...'
+ exit
+ end
+ when (answer = '') /* IPL by default */
+ then do
+ say 'Booting from DASD 'iplDisk'...'
+ 'cp ipl' iplDisk
+ end
+ when (answer < 0) | (answer > count) /* invalid respone */
+ then do
+ say 'Invalid choice, exiting to CMS shell.'
+ exit
+ end
+ when (answer > 0) & (answer < count) /* valid response */
+ then do
+ call GetTFTP '/s390x/p_'profile.answer 'profile.detail.t'
+
+ /* Don't overwrite user-specific PARM and CONF if available */
+ if lines(zpxeparm) = 0 then
+ call GetTFTP '/s390x/p_'profile.answer'_parm' 'zpxe.parm.t'
+ if lines(zpxeconf) = 0 then
+ call GetTFTP '/s390x/p_'profile.answer'_conf' 'zpxe.conf.t'
+
+ vmfclear /* clear screen */
+ say 'Using profile 'answer' ['profile.answer']'
+ say ''
+ call DownloadBinaries /* download kernel and initrd */
+
+ say 'Starting install...'
+ say ''
+
+ call PunchFiles
+
+ end /* valid answer */
+ otherwise
+ say 'Invalid choice, exiting to CMS shell.'
+ exit
+ end /* Select */
+end
+exit
+
+
+/* Procedure CheckServer
+ Print error message if server is not defined. Otherwise
+ show server name
+*/
+CheckServer:
+
+ if server = '' then
+ say '** Error: No host defined in ZPXE.CONF **'
+ else say 'Connected to server 'server
+ say ''
+
+return 0 /* CheckServer */
+
+
+/* Procedure GetTFTP
+ Use CMS TFTP client to download files
+ path: remote file location
+ filename: local file name
+ transfermode [optional]: 'ascii' or 'octet'
+*/
+GetTFTP:
+
+ parse arg path filename transfermode
+
+ if transfermode <> '' then
+ queue 'mode' transfermode
+ queue 'get 'path filename
+ queue 'quit'
+
+ 'set cmstype ht' /* suppress tftp output */
+ tftp server
+ 'set cmstype rt'
+
+return 0 /* GetTFTP */
+
+
+/* Procedure DownloadBinaries
+ Download kernel and initial RAMdisk. Convert both
+ to fixed record length 80.
+*/
+DownloadBinaries:
+
+ inputline = linein(profiledetail) /* first line is kernel */
+ parse var inputline kernelpath
+ say 'Downloading kernel ['kernelpath']...'
+ call GetTFTP kernelpath 'kernel.img.t' octet
+
+ inputline = linein(profiledetail) /* next line is initrd */
+ parse var inputline initrdpath
+ say 'Downloading initrd ['initrdpath']...'
+ call GetTFTP initrdpath 'initrd.img.t' octet
+
+ /* convert to fixed record length */
+ 'pipe < KERNEL IMG T | fblock 80 00 | > KERNEL IMG T'
+ 'pipe < INITRD IMG T | fblock 80 00 | > INITRD IMG T'
+
+return 0 /* DownloadBinaries */
+
+
+/* Procedure PunchFiles
+ Punch the kernel, initial RAMdisk, and PARM file.
+ Then IPL to start the install process.
+*/
+PunchFiles:
+
+ 'spool punch *'
+ 'close reader'
+ 'purge reader all' /* clear reader contents */
+ 'punch kernel img t (noh' /* punch kernel */
+ 'punch zpxe parm t (noh' /* punch PARM file */
+ 'punch initrd img t (noh' /* punch initrd */
+ 'change reader all keep' /* keep files in reader */
+ 'ipl 00c clear' /* IPL the reader */
+
+return 0 /* PunchFiles */
diff --git a/setup.py b/setup.py
index fc500025..33360eaa 100644
--- a/setup.py
+++ b/setup.py
@@ -165,6 +165,7 @@ if __name__ == "__main__":
(libpath, ['loaders/elilo-3.8-ia64.efi']),
(libpath, ['loaders/menu.c32']),
(libpath, ['loaders/yaboot-1.3.14']),
+ (libpath, ['loaders/zpxe.rexx']),
# database/serializer
(dbpath + "/distros.d", []),
@@ -240,6 +241,7 @@ if __name__ == "__main__":
(snippetpath, ['snippets/koan_environment']),
(snippetpath, ['snippets/pre_anamon']),
(snippetpath, ['snippets/post_anamon']),
+ (snippetpath, ['snippets/post_s390_reboot']),
(snippetpath, ['snippets/redhat_register']),
# documentation
diff --git a/snippets/post_s390_reboot b/snippets/post_s390_reboot
new file mode 100644
index 00000000..2534cd76
--- /dev/null
+++ b/snippets/post_s390_reboot
@@ -0,0 +1,10 @@
+## HACK to allow RHEL4 and previous s390 installs to reboot
+#if $arch.startswith("s390"):
+%post --nochroot
+pid=\$(cat /var/run/init.pid)
+[ -z "\$pid" ] && pid=\$(pidof init)
+kill -12 \$pid
+pid=\$(cat /var/run/loader.run)
+[ -z "\$pid" ] && pid=\$(pidof loader)
+kill \$pid
+#end if
diff --git a/templates/pxeprofile_s390x.template b/templates/pxeprofile_s390x.template
index ba0c95ea..d4950eac 100644
--- a/templates/pxeprofile_s390x.template
+++ b/templates/pxeprofile_s390x.template
@@ -1,3 +1,2 @@
$kernel_path
$initrd_path
-$append_line
diff --git a/templates/pxesystem_s390x.template b/templates/pxesystem_s390x.template
index ba0c95ea..d4950eac 100644
--- a/templates/pxesystem_s390x.template
+++ b/templates/pxesystem_s390x.template
@@ -1,3 +1,2 @@
$kernel_path
$initrd_path
-$append_line
diff --git a/templates/s390x_conf.template b/templates/s390x_conf.template
index 8b659a84..93af25b1 100644
--- a/templates/s390x_conf.template
+++ b/templates/s390x_conf.template
@@ -1,54 +1,77 @@
-DASD=100-101,200
-SUBCHANNELS=0.0.0600,0.0.0601,0.0.0602
-NETTYPE=qeth
+## Stuff content into a list so we can display a condensed format later
+#if $isinstance($kernel_options, $list)
+#set $argList = $kernel_options
+#else
+#set $argList = $kernel_options.split(" ")
+#end if
+#silent $argList.append("DASD=100-101,200")
+#silent $argList.append("SUBCHANNELS=0.0.0600,0.0.0601,0.0.0602")
+#silent $argList.append("NETTYPE=qeth")
+#if $getVar('hostname', '') != ''
+#silent $argList.append("HOSTNAME=%s" % $hostname)
+#end if
+#if $getVar('name_servers_search', '') != ''
+#silent $argList.append("SEARCHDNS=%s" % ':'.join($name_servers_search))
+#end if
+#if $getVar('gateway', '') != ''
+#silent $argList.append("GATEWAY=%s" % $gateway)
+#end if
+#if $getVar('name_servers', '') != ''
+#silent $argList.append("DNS=%s" % ':'.join($name_servers))
+#end if
#if $getVar("interfaces","") != "" and $interfaces.has_key("eth0")
- $set $hostname=$interfaces['eth0'].get('hostname','')
#set $ip=$interfaces['eth0'].get('ip_address','')
#set $netmask=$interfaces['eth0'].get('subnet','')
- #set $gateway=$interfaces['eth0'].get('gateway','')
- #set $nameservers=':'.join($interfaces['eth0'].get('nameservers',''))
- #set $dnssearch=':'.join($interfaces['eth0'].get('dnssearch',''))
#if $ip != ''
#set $tokens = $ip.split('.')
#set $tokens = $tokens[0:-1]
- #set $broadcast = " ".join($tokens) + ".255"
+ #set $broadcast = ".".join($tokens) + ".255"
#else
#set $broadcast = ""
#end if
#else
- #set $hostname=""
#set $ip=""
#set $netmask=""
- #set $gateway=""
- #set $nameservers=""
- #set $dnssearch=""
#set $broadcast = ""
#end if
-#if $hostname != ''
-HOSTNAME=$hostname
-#end if
#if $ip != ''
-IPADDR=$ip
+#silent $argList.append("IPADDR=%s" % $ip)
#end if
-## FIXME: don't know what to do with this?
-## NETWORK=192.168.5.0
-#if $netmask != ''
-NETMASK=$netmask
+## Unless provided, calculate the network using netmask and broadcast
+#if $getVar('network', '') != ''
+#silent $argList.append("NETWORK=%s" % $network)
+#elif $netmask != '' and $ip != ''
+#set $ip_split = $ip.split('.')
+#set $nm_split = $netmask.split('.')
+#set $nw_split = []
+#for $oct in $range($len($ip_split))
+#silent $nw_split.append("%s" % ($int($nm_split[$oct]) & $int($ip_split[$oct])))
+#end for
+#set $network=".".join($nw_split)
+#silent $argList.append("NETWORK=%s" % $network)
#end if
-#if $dnssearch != ''
-SEARCHDNS=$dnssearch
+#if $netmask != ''
+#silent $argList.append("NETMASK=%s" % $netmask)
#end if
-#if $gateway != ''
-GATEWAY=$gateway
+#if $broadcast != ''
+#silent $argList.append("BROADCAST=%s" % $broadcast)
#end if
-#if $nameservers != ''
-DNS=$name_servers
+#silent $argList.append("MTU=1500")
+#silent $argList.append("PORTNAME=UNASSIGNED")
+#silent $argList.append("PORTNO=0")
+#silent $argList.append("LAYER2=0")
+## =====================================
+## Now write out data. Content cannot be longer than 80 characters in length,
+## and must not exceed 11 lines
+## =====================================
+#set $output_str=""
+#for $item in $argList
+#if $len($output_str) + $len($item) >= 80
+#echo "%s\n" % $output_str.strip()
+#set $output_str = ""
#end if
-## FIXME: the hack that generates this assumes ip with 255 as last octet
-## FIXME: if this is wrong, don't change here, change at the top where it's set
-#if $broadcast != ''
-BROADCAST=$broadcast
+#set $output_str = "%s %s" % ($output_str, $item)
+#end for
+#if $len($output_str) > 0
+#echo "%s\n" % $output_str.strip()
#end if
-MTU=1500
-PORTNAME=UNASSIGNED
-LAYER2=0
diff --git a/templates/s390x_parm.template b/templates/s390x_parm.template
index 39b977ad..42247222 100644
--- a/templates/s390x_parm.template
+++ b/templates/s390x_parm.template
@@ -1,3 +1,22 @@
-$kickstart_expanded
-CMSCONFFILE=$confname
-$kernel_options
+## Stuff content into a list so we can display a condensed format later
+#if $isinstance($kernel_options, $list)
+#set $argList = $kernel_options
+#else
+#set $argList = $kernel_options.split(" ")
+#end if
+#silent $argList.insert(0, $kickstart_expanded)
+## =====================================
+## Now write out data. Content cannot be longer than 80 characters in length,
+## and must not exceed 11 lines
+## =====================================
+#set $output_str=""
+#for $item in $argList
+#if $len($output_str) + $len($item) >= 80
+#echo "%s\n" % $output_str.strip()
+#set $output_str = ""
+#end if
+#set $output_str = "%s %s" % ($output_str, $item)
+#end for
+#if $len($output_str) > 0
+#echo "%s\n" % $output_str.strip()
+#end if