forked from pool/s390-tools
- Made a number of modification to zpxe.rexx to
- Made several hard-coded values variables. - Make it more obvious which default values can be modified - Increased the default size of the FFFF VDISK. - Don't execute the wait if "debug" was specified as a parm. - Change nodebug variable name to debug for clarity, updated logic as needed. OBS-URL: https://build.opensuse.org/package/show/Base:System/s390-tools?expand=0&rev=10
This commit is contained in:
parent
a416fd0dcd
commit
ddabd5b0e5
@ -1,3 +1,14 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed May 31 21:26:50 UTC 2017 - mpost@suse.com
|
||||||
|
|
||||||
|
- Made a number of modification to zpxe.rexx to
|
||||||
|
- Made several hard-coded values variables.
|
||||||
|
- Make it more obvious which default values can be modified
|
||||||
|
- Increased the default size of the FFFF VDISK.
|
||||||
|
- Don't execute the wait if "debug" was specified as a parm.
|
||||||
|
- Change nodebug variable name to debug for clarity, updated
|
||||||
|
logic as needed.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Tue May 16 00:57:05 UTC 2017 - mpost@suse.com
|
Tue May 16 00:57:05 UTC 2017 - mpost@suse.com
|
||||||
|
|
||||||
|
141
zpxe.rexx
141
zpxe.rexx
@ -18,7 +18,7 @@ of the Cobbler or TFTP server.
|
|||||||
Copyright 2006-2009, Red Hat, Inc
|
Copyright 2006-2009, Red Hat, Inc
|
||||||
Brad Hinson <bhinson@redhat.com>
|
Brad Hinson <bhinson@redhat.com>
|
||||||
|
|
||||||
Copyright 2012, SUSE Linux,
|
Copyright 2012, 2017, SUSE Linux,
|
||||||
Mark Post <mpost@suse.com>
|
Mark Post <mpost@suse.com>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
@ -41,45 +41,69 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|||||||
/* Set the default environment for "safety" reasons. */
|
/* Set the default environment for "safety" reasons. */
|
||||||
ADDRESS COMMAND
|
ADDRESS COMMAND
|
||||||
|
|
||||||
/* Make it possible to interrupt zPXE and to enter CMS no matter how
|
/* Save the value of the trace state */
|
||||||
the guest was started, if there is a system-specific profile
|
tvar_o=trace()
|
||||||
or not, etc.
|
tvar_c=tvar_o
|
||||||
*/
|
|
||||||
say
|
|
||||||
say 'Enter a non-blank character and ENTER (or two ENTERs) within 10',
|
|
||||||
'seconds to interrupt zPXE.'
|
|
||||||
ADDRESS CMS 'WAKEUP +00:10 (CONS'
|
|
||||||
/* Check for the interrupt code */
|
|
||||||
if rc = 6 then do
|
|
||||||
say 'Interrupt received: exiting to CMS...'
|
|
||||||
pull /* Clear the stack */
|
|
||||||
exit
|
|
||||||
end
|
|
||||||
|
|
||||||
/* Was this script invoked with "debug" as one of the parameters? */
|
/* Was this script invoked with "debug" as one of the parameters? */
|
||||||
nodebug=1
|
debug=0
|
||||||
if arg() then do
|
if arg() then
|
||||||
|
do
|
||||||
parse upper arg uparg
|
parse upper arg uparg
|
||||||
if index(uparg,'DEBUG') <> 0 then do
|
do sub=1 to words(uparg)
|
||||||
trace i
|
if word(uparg,sub) = "DEBUG" then
|
||||||
nodebug=0
|
do
|
||||||
end
|
debug=1;
|
||||||
|
trace i;
|
||||||
|
tvar_c=trace()
|
||||||
|
end;
|
||||||
else do /* This is a do/end in case we want to add to it later */
|
else do /* This is a do/end in case we want to add to it later */
|
||||||
trace e
|
trace e
|
||||||
|
tvar_c=trace()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
/* Set some defaults */
|
/* Set some defaults */
|
||||||
|
/* These values are intended to be modified by the site using this */
|
||||||
|
/* script to match their environment. */
|
||||||
userid=''
|
userid=''
|
||||||
server=''
|
server=''
|
||||||
iplDisk=''
|
iplDisk=''
|
||||||
server_def = 'internal.tftp.server' /* define default TFTP server */
|
server_def = 'internal.tftp.server' /* define default TFTP server */
|
||||||
iplDisk_def = '150' /* define default IPL DASD */
|
iplDisk_def = '150' /* define default IPL DASD */
|
||||||
profilelist = 'PROFILE LIST T' /* VDISK will be defined as T later */
|
FM='T' /* Default file mode is T */
|
||||||
profiledetail = 'PROFILE DETAIL T'
|
profilelist = 'PROFILE LIST' FM /* Disk will be accessed as FM later */
|
||||||
zpxeparm = 'ZPXE PARM T'
|
profiledetail = 'PROFILE DETAIL' FM
|
||||||
zpxeconf = 'ZPXE CONF T'
|
zpxeparm = 'ZPXE PARM' FM
|
||||||
|
zpxeconf = 'ZPXE CONF' FM
|
||||||
config = 'ZPXE CONF A'
|
config = 'ZPXE CONF A'
|
||||||
|
seconds=10 /* The default amount of time to wait for console input */
|
||||||
|
|
||||||
|
workDiskType='VFB-512'
|
||||||
|
workDiskSize=200000 /* This is approximately 97MB of space. */
|
||||||
|
/* For TDISK instead of VDISK, comment out the previous two lines and */
|
||||||
|
/* uncomment the following two lines.*/
|
||||||
|
/* workDisk='T3390' */
|
||||||
|
/* workDiskSize=138 */
|
||||||
|
|
||||||
|
/* Make it possible to interrupt zPXE and to enter CMS no matter how
|
||||||
|
the guest was started, if there is a system-specific profile
|
||||||
|
or not, etc.
|
||||||
|
*/
|
||||||
|
if debug then say 'Debugging, so we will skip the wait and just run.'
|
||||||
|
else do
|
||||||
|
say
|
||||||
|
say 'Enter a non-blank character and ENTER (or two ENTERs)',
|
||||||
|
'within' seconds 'seconds to interrupt zPXE.'
|
||||||
|
ADDRESS CMS 'WAKEUP +00:'seconds '(CONS'
|
||||||
|
/* Check for the interrupt code */
|
||||||
|
if rc = 6 then do
|
||||||
|
say 'Interrupt received: exiting to CMS...'
|
||||||
|
ADDRESS CMS 'DESBUF' /* Clear the stack */
|
||||||
|
exit
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
/* For translating strings to lowercase */
|
/* For translating strings to lowercase */
|
||||||
lower = xrange('a','i')xrange('j','r')xrange('s','z')
|
lower = xrange('a','i')xrange('j','r')xrange('s','z')
|
||||||
@ -107,12 +131,12 @@ userid_def = translate(userid_def, lower, upper)
|
|||||||
'CP TERM HOLD OFF'
|
'CP TERM HOLD OFF'
|
||||||
|
|
||||||
/* We want to have a way to figure out what went wrong if something
|
/* We want to have a way to figure out what went wrong if something
|
||||||
isn't working.
|
isn't working. */
|
||||||
*/
|
|
||||||
'CP SPOOL CONSOLE STOP CLOSE' /* Close any existing spooled console. */
|
'CP SPOOL CONSOLE STOP CLOSE' /* Close any existing spooled console. */
|
||||||
'CP SPOOL CONSOLE START' /* Start spooling the console for this run. */
|
'CP SPOOL CONSOLE START' /* Start spooling the console for this run. */
|
||||||
|
|
||||||
if nodebug then ADDRESS CMS 'VMFCLEAR' /* clear screen */
|
if \ debug then ADDRESS CMS 'VMFCLEAR' /* clear screen */
|
||||||
|
|
||||||
/* The following two commands that were in the original script are */
|
/* The following two commands that were in the original script are */
|
||||||
/* almost certainly not going to work for anyone that only has CP */
|
/* almost certainly not going to work for anyone that only has CP */
|
||||||
@ -120,21 +144,20 @@ if nodebug then ADDRESS CMS 'VMFCLEAR' /* clear screen */
|
|||||||
/* 'set vdisk syslim infinite' */
|
/* 'set vdisk syslim infinite' */
|
||||||
/* 'set vdisk userlim infinite' */
|
/* 'set vdisk userlim infinite' */
|
||||||
|
|
||||||
/* Define a temporary disk (VDISK) to store files and CMS FORMAT it */
|
/* Define a temporary disk to store files and CMS FORMAT it */
|
||||||
/* If your site doesn't allow this, but does allow TDISKs, change the */
|
/* If your site doesn't allow this, but does allow TDISKs, change the */
|
||||||
/* DEFINE command to T3390 instead */
|
/* DEFINE command to T3390 instead */
|
||||||
'CP SET EMSG OFF'
|
'CP SET EMSG OFF'
|
||||||
if nodebug then trace off
|
if \ debug then trace off
|
||||||
'CP DETACH FFFF' /* detach ffff if present */
|
'CP DETACH FFFF' /* detach ffff if present */
|
||||||
if nodebug then trace e
|
trace value tvar_c
|
||||||
else trace i
|
|
||||||
'CP SET EMSG ON'
|
'CP SET EMSG ON'
|
||||||
'CP DEFINE VFB-512 AS FFFF BLK 144000' /* 512 byte block size ~70 MB */
|
'CP DEFINE' workDiskType' AS FFFF' workDiskSize
|
||||||
queue '1'
|
queue '1'
|
||||||
queue 'tmpdsk'
|
queue 'tmpdsk'
|
||||||
if nodebug then /* If debug was not specified, then */
|
if \ debug then /* If debug was not specified, then */
|
||||||
ADDRESS CMS 'set cmstype ht' /* suppress format output */
|
ADDRESS CMS 'set cmstype ht' /* suppress format output */
|
||||||
ADDRESS CMS 'format ffff t' /* format VDISK as file mode t */
|
ADDRESS CMS 'format ffff' FM /* format VDISK as file mode FM */
|
||||||
ADDRESS CMS 'set cmstype rt' /* Resume seeing command output */
|
ADDRESS CMS 'set cmstype rt' /* Resume seeing command output */
|
||||||
say 'DASD FFFF has been CMS formatted'
|
say 'DASD FFFF has been CMS formatted'
|
||||||
|
|
||||||
@ -165,12 +188,12 @@ say
|
|||||||
say 'Connecting to server 'server /* print server name */
|
say 'Connecting to server 'server /* print server name */
|
||||||
|
|
||||||
/* Check whether a user-specific PXE profile exists. */
|
/* Check whether a user-specific PXE profile exists. */
|
||||||
call GetTFTP '/s390x/s_'userid 'profile.detail.t'
|
call GetTFTP '/s390x/s_'userid 'profile.detail.'FM
|
||||||
if lines(profiledetail) > 0 then call ProcessUserProfile
|
if lines(profiledetail) > 0 then call ProcessUserProfile
|
||||||
else do /* no user-specific profile was found */
|
else do /* no user-specific profile was found */
|
||||||
say 'No profile found for' userid
|
say 'No profile found for' userid
|
||||||
if disconnected then do /* user is disconnected */
|
if disconnected then do /* user is disconnected */
|
||||||
ADDRESS CMS 'release t (detach'
|
ADDRESS CMS 'release' FM '(detach'
|
||||||
ADDRESS CMS 'exec vmlink tcpmaint 592 <detach>'
|
ADDRESS CMS 'exec vmlink tcpmaint 592 <detach>'
|
||||||
say 'User is disconnected. Booting from DASD 'iplDisk'...'
|
say 'User is disconnected. Booting from DASD 'iplDisk'...'
|
||||||
'CP IPL' iplDisk
|
'CP IPL' iplDisk
|
||||||
@ -178,6 +201,8 @@ else do /* no user-specific profile was found */
|
|||||||
else call ProcessGenericProfiles /* user is interactive -> prompt */
|
else call ProcessGenericProfiles /* user is interactive -> prompt */
|
||||||
end /* no user-specific profile was found */
|
end /* no user-specific profile was found */
|
||||||
|
|
||||||
|
trace value tvar_o
|
||||||
|
|
||||||
exit
|
exit
|
||||||
/* */
|
/* */
|
||||||
/* Subroutines called from the main script */
|
/* Subroutines called from the main script */
|
||||||
@ -227,7 +252,7 @@ say
|
|||||||
bootRc = ParseSystemRecord() /* parse file for boot action */
|
bootRc = ParseSystemRecord() /* parse file for boot action */
|
||||||
if bootRc = 0 then do
|
if bootRc = 0 then do
|
||||||
say 'The profile said we should boot from local disk.'
|
say 'The profile said we should boot from local disk.'
|
||||||
ADDRESS CMS 'release t (detach'
|
ADDRESS CMS 'release' FM '(detach'
|
||||||
ADDRESS CMS 'exec vmlink tcpmaint 592 <detach>'
|
ADDRESS CMS 'exec vmlink tcpmaint 592 <detach>'
|
||||||
say 'IPLing from' iplDisk
|
say 'IPLing from' iplDisk
|
||||||
'CP IPL' iplDisk /* boot from default DASD */
|
'CP IPL' iplDisk /* boot from default DASD */
|
||||||
@ -237,13 +262,13 @@ else do /* The profile should contain pointers to kernel, etc.*/
|
|||||||
|
|
||||||
/* Get the user PARM file that contains network info */
|
/* Get the user PARM file that contains network info */
|
||||||
say 'Downloading parameter file [/s390x/s_'userid'_parm]...'
|
say 'Downloading parameter file [/s390x/s_'userid'_parm]...'
|
||||||
call GetTFTP '/s390x/s_'userid'_parm' 'zpxe.parm.t'
|
call GetTFTP '/s390x/s_'userid'_parm' 'zpxe.parm.'FM
|
||||||
if CheckDownload('s_'userid'_parm' zpxeparm) <> 0 then
|
if CheckDownload('s_'userid'_parm' zpxeparm) <> 0 then
|
||||||
abort=1
|
abort=1
|
||||||
|
|
||||||
/* Get the user CONF file that currently isn't used for anything */
|
/* Get the user CONF file that currently isn't used for anything */
|
||||||
say 'Downloading conf file [/s390x/s_'userid'_conf]...'
|
say 'Downloading conf file [/s390x/s_'userid'_conf]...'
|
||||||
call GetTFTP '/s390x/s_'userid'_conf' 'zpxe.conf.t'
|
call GetTFTP '/s390x/s_'userid'_conf' 'zpxe.conf.'FM
|
||||||
if CheckDownload('s_'userid'_conf' zpxeconf) <> 0 then
|
if CheckDownload('s_'userid'_conf' zpxeconf) <> 0 then
|
||||||
abort=1
|
abort=1
|
||||||
|
|
||||||
@ -265,7 +290,7 @@ end /* he profile should contain pointers to kernel, etc */
|
|||||||
ProcessGenericProfiles:
|
ProcessGenericProfiles:
|
||||||
/* Download the list of generic profiles available */
|
/* Download the list of generic profiles available */
|
||||||
say 'Downloading the profile list [/s390x/profile_list]...'
|
say 'Downloading the profile list [/s390x/profile_list]...'
|
||||||
call GetTFTP '/s390x/profile_list' 'profile.list.t'
|
call GetTFTP '/s390x/profile_list' 'profile.list.'FM
|
||||||
if CheckDownload('profile_list' profilelist) <> 0 then do
|
if CheckDownload('profile_list' profilelist) <> 0 then do
|
||||||
say '** **'
|
say '** **'
|
||||||
say '** No profile list found **'
|
say '** No profile list found **'
|
||||||
@ -302,7 +327,7 @@ select
|
|||||||
end
|
end
|
||||||
|
|
||||||
when answer = '' then do /* IPL from default disk */
|
when answer = '' then do /* IPL from default disk */
|
||||||
ADDRESS CMS 'release t (detach'
|
ADDRESS CMS 'release' FM '(detach'
|
||||||
ADDRESS CMS 'exec vmlink tcpmaint 592 <detach>'
|
ADDRESS CMS 'exec vmlink tcpmaint 592 <detach>'
|
||||||
say 'Booting from DASD 'iplDisk'...'
|
say 'Booting from DASD 'iplDisk'...'
|
||||||
'CP IPL' iplDisk
|
'CP IPL' iplDisk
|
||||||
@ -312,19 +337,19 @@ select
|
|||||||
abort=0
|
abort=0
|
||||||
|
|
||||||
say 'Downloading generic profile [/s390x/p_'profile.answer']...'
|
say 'Downloading generic profile [/s390x/p_'profile.answer']...'
|
||||||
call GetTFTP '/s390x/p_'profile.answer 'profile.detail.t'
|
call GetTFTP '/s390x/p_'profile.answer 'profile.detail.'FM
|
||||||
if CheckDownload('p_'profile.answer profiledetail) <> 0 then
|
if CheckDownload('p_'profile.answer profiledetail) <> 0 then
|
||||||
abort=1
|
abort=1
|
||||||
|
|
||||||
say 'Downloading generic parameter file',
|
say 'Downloading generic parameter file',
|
||||||
'[/s390x/p_'profile.answer'_parm]...'
|
'[/s390x/p_'profile.answer'_parm]...'
|
||||||
call GetTFTP '/s390x/p_'profile.answer'_parm' 'zpxe.parm.t'
|
call GetTFTP '/s390x/p_'profile.answer'_parm' 'zpxe.parm.'FM
|
||||||
if CheckDownload('p_'profile.answer'_parm' zpxeparm) <> 0 then
|
if CheckDownload('p_'profile.answer'_parm' zpxeparm) <> 0 then
|
||||||
abort=1
|
abort=1
|
||||||
|
|
||||||
say 'Downloading generic conf file',
|
say 'Downloading generic conf file',
|
||||||
'[/s390x/p_'profile.answer'_conf]...'
|
'[/s390x/p_'profile.answer'_conf]...'
|
||||||
call GetTFTP '/s390x/p_'profile.answer'_conf' 'zpxe.conf.t'
|
call GetTFTP '/s390x/p_'profile.answer'_conf' 'zpxe.conf.'FM
|
||||||
if CheckDownload('p_'profile.answer'_conf' zpxeconf) <> 0 then
|
if CheckDownload('p_'profile.answer'_conf' zpxeconf) <> 0 then
|
||||||
abort=1
|
abort=1
|
||||||
|
|
||||||
@ -346,7 +371,7 @@ select
|
|||||||
call lineout zpxeparm, hostipparm
|
call lineout zpxeparm, hostipparm
|
||||||
call lineout zpxeparm /* close the output file */
|
call lineout zpxeparm /* close the output file */
|
||||||
|
|
||||||
if nodebug then ADDRESS CMS 'VMFCLEAR' /* clear screen */
|
if \ debug then ADDRESS CMS 'VMFCLEAR' /* clear screen */
|
||||||
say
|
say
|
||||||
say 'Using profile 'answer' ['profile.answer']'
|
say 'Using profile 'answer' ['profile.answer']'
|
||||||
say
|
say
|
||||||
@ -379,11 +404,13 @@ GetTFTP:
|
|||||||
|
|
||||||
if transfermode <> '' then
|
if transfermode <> '' then
|
||||||
queue 'mode' transfermode
|
queue 'mode' transfermode
|
||||||
|
|
||||||
queue 'get 'path filename
|
queue 'get 'path filename
|
||||||
queue 'quit'
|
queue 'quit'
|
||||||
|
|
||||||
if nodebug then
|
if \ debug then
|
||||||
ADDRESS CMS 'set cmstype ht' /* suppress TFTP output */
|
ADDRESS CMS 'set cmstype ht' /* suppress TFTP output */
|
||||||
|
|
||||||
ADDRESS CMS 'tftp' server
|
ADDRESS CMS 'tftp' server
|
||||||
ADDRESS CMS 'set cmstype rt'
|
ADDRESS CMS 'set cmstype rt'
|
||||||
|
|
||||||
@ -422,8 +449,8 @@ DownloadBinaries:
|
|||||||
exit 99
|
exit 99
|
||||||
end
|
end
|
||||||
say 'Downloading kernel ['kernelpath']...'
|
say 'Downloading kernel ['kernelpath']...'
|
||||||
call GetTFTP kernelpath 'kernel.img.t' octet
|
call GetTFTP kernelpath 'kernel.img.'FM octet
|
||||||
if CheckDownload(kernelpath kernel img t) <> 0 then do
|
if CheckDownload(kernelpath kernel img FM) <> 0 then do
|
||||||
say 'Aborting PXE boot.'
|
say 'Aborting PXE boot.'
|
||||||
exit 99
|
exit 99
|
||||||
end
|
end
|
||||||
@ -435,8 +462,8 @@ DownloadBinaries:
|
|||||||
exit 99
|
exit 99
|
||||||
end
|
end
|
||||||
say 'Downloading initrd ['initrdpath']...'
|
say 'Downloading initrd ['initrdpath']...'
|
||||||
call GetTFTP initrdpath 'initrd.img.t' octet
|
call GetTFTP initrdpath 'initrd.img.'FM octet
|
||||||
if CheckDownload(initrdpath initrd img t) <> 0 then do
|
if CheckDownload(initrdpath initrd img FM) <> 0 then do
|
||||||
say 'Aborting PXE boot.'
|
say 'Aborting PXE boot.'
|
||||||
exit 99
|
exit 99
|
||||||
end
|
end
|
||||||
@ -450,8 +477,8 @@ DownloadBinaries:
|
|||||||
|
|
||||||
/* Convert to fixed record length since they're going to be run
|
/* Convert to fixed record length since they're going to be run
|
||||||
through the virtual card reader. */
|
through the virtual card reader. */
|
||||||
ADDRESS CMS 'pipe < KERNEL IMG T | fblock 80 00 | > KERNEL IMG T'
|
ADDRESS CMS 'pipe < KERNEL IMG 'FM' | fblock 80 00 | > KERNEL IMG' FM
|
||||||
ADDRESS CMS 'pipe < INITRD IMG T | fblock 80 00 | > INITRD IMG T'
|
ADDRESS CMS 'pipe < INITRD IMG 'FM' | fblock 80 00 | > INITRD IMG' FM
|
||||||
ADDRESS CMS 'pipe < ' zpxeparm ' | fblock 80 SPACE | > ' zpxeparm
|
ADDRESS CMS 'pipe < ' zpxeparm ' | fblock 80 SPACE | > ' zpxeparm
|
||||||
|
|
||||||
return /* DownloadBinaries */
|
return /* DownloadBinaries */
|
||||||
@ -467,10 +494,10 @@ PunchFiles:
|
|||||||
'CP CLOSE READER'
|
'CP CLOSE READER'
|
||||||
'CP PURGE READER ALL' /* clear reader contents */
|
'CP PURGE READER ALL' /* clear reader contents */
|
||||||
|
|
||||||
ADDRESS CMS 'punch kernel img t ( noheader' /* punch kernel */
|
ADDRESS CMS 'punch kernel img' FM '( noheader' /* punch kernel */
|
||||||
ADDRESS CMS 'punch zpxe parm t ( noheader' /* punch PARM file */
|
ADDRESS CMS 'punch zpxe parm' FM '( noheader' /* punch PARM file */
|
||||||
ADDRESS CMS 'punch initrd img t ( noheader' /* punch initrd */
|
ADDRESS CMS 'punch initrd img' FM '( noheader' /* punch initrd */
|
||||||
ADDRESS CMS 'release t (detach' /* release and detach the VDISK */
|
ADDRESS CMS 'release' FM '(detach' /* release and detach the VDISK */
|
||||||
ADDRESS CMS 'exec vmlink tcpmaint 592 <detach>' /* and this disk */
|
ADDRESS CMS 'exec vmlink tcpmaint 592 <detach>' /* and this disk */
|
||||||
|
|
||||||
'CP CHANGE READER ALL KEEP NOHOLD' /* keep files in reader */
|
'CP CHANGE READER ALL KEEP NOHOLD' /* keep files in reader */
|
||||||
|
Loading…
Reference in New Issue
Block a user