From: Didier Morandi [Didier.Morandi@gmx.ch] Sent: Thursday, November 29, 2001 11:19 AM To: Info-VAX@Mvb.Saic.Com Subject: DCL minute of the day: PCSI_MENU v1.1 $!+ $! PCSI_MENU.COM $! $! This procedure will build a PCSI kit from answers to questions during a $! menu driven session. On-line help will also provide some training on PCSI. $! $! The PCSI Developper's Guide is available from the COMPAQ WEB site at: $! www.openvms.compaq.com:8000/72final/5952/5952pro.html (for OpenVMS 7.2) $! or $! www.openvms.compaq.com:8000/73final/5952/5952pro.html (for OpenVMS 7.3) $! $! There is also an ADOBE PDF version available from the following URL: $! www.openvms.compaq.com:8000/73final/documentation/pdf/OVMS_73_PCSI_GD.pdf $! $! $! First name, last name $! help text option (Verbose/Brief/None) $! favourite editor $! product name, version $! automatic IVP proc YES/NO (next release) $! configuration template YES/NO (next release) $! pre-conf proc YES/NO $! post-install proc YES/NO (next release) $! $! $! pre-conf procedure $! .pcsi$desc file $! .pcsi$text file $! post-install procedure (next release) $! IVP (next release) $! release notes (next release) $! installation guide (next release) $! users guide (?) (next release) $! PCSI kit file $! $! $! None. But note that an incomplete kit file will be deleted when restarting $! the same kit build if the version number did not change. $! $! LEGAL: This procedure is NothingWare and may be copied, given and modified $! as wished, but without any support whatsoever from the author. $! To know more on PCSI, visit http://groups.yahoo.com/group/vmsinstal. $! To know more on the author, visit http://Didier.Morandi.Free.fr. $! $! Revision history $! $! Version Date Author action $! ------- ----------- ---------- --------------------------------------------- $! v1.0-0 16-may-2001 D. Morandi creation $v="1.1-0"!29-nov-2001 DMo add list of resulting files at end of process. $! fix bug in default directory values $!- $ on error then goto EXIT $ set control=(T,Y) $ on control then goto EXIT $ set symbol/scope=noglobal $ say = "write sys$output" $ bell[0,8]=7 $ esc[0,8]=27 $ b1 = esc + "[1m" $ b0 = esc + "[m" $ r1 = esc + "[7m" $ r0 = b0 $ bold = "write sys$output b1" $ rev = "write sys$output r1" $ off = "write sys$output r0" $ help_on = "call give_help" $ explain = "call give_help HELP_SETUP " $ help_setup = "VERBOSE" $ user := 'f$getjpi(0,"username")' $ node = f$trnlnm("sys$node") - "::" $ debug = (f$trnlnm("pcsi_menu$debug") .nes. "") $ if p4 .nes. "" then debug = 1 $! $ first=f$trnlnm("first$name") $ default="" $ if first .nes. "" then default = "''first'" $ if p1 .eqs. "" then inq p1 "* Please enter your first name [''default']" $ if p1 .eqs. "" .and. first .eqs. "" then goto EXIT $ if p1 .nes. "" $ then $ first = f$edit(f$extract(0,1,p1),"upcase") + - f$edit(f$extract(1,99,p1),"lowercase") $ define/nolog first$name "''first'" $ if debug then say "(first name default value set to ''first')" $ endif $! $ last=f$trnlnm("last$name") $ default="" $ if last .nes. "" then default = "''last'" $ if p2 .eqs. "" then inq p2 "* Please enter your last name [''default']" $ if p2 .eqs. "" .and. last .eqs. "" then goto EXIT $ if p2 .nes. "" $ then $ last = f$edit(p2,"upcase") $ define/nolog last$name 'last' $ if debug then say "(last name default value set to ''last')" $ endif $! $ producer=f$trnlnm("producer$name") $ default="" $ if producer .nes. "" then default = "''producer'" $ASK_PRODUCER: $ if p3 .eqs. "" then inq p3 - "* Enter Company three digits code [''default']" $ if p3 .eqs. "" .and. producer .eqs. "" then goto EXIT $ if p3 .nes. "" $ then $ if f$len(p3) .ne. 3 $ then $ type sys$input $DECK Please enter a three digits code to identify the producer of this PCSI kit. This information is mandatory as this code wil be part of different string identifiers required to build the kit then install/remove your software. See section 5952PRO_001.HTML#SUBFIELD_PDF_FORMAT_KIT in the HTML doc at http://www.openvms.compaq.com:8000/72final/5952/5952pro_001.html for more. Should you have a direct access to the Internet, select the above URL then cut/paste it into your favourite WEB browser, then select the whole string starting with the # and cut/paste/append it to reach the section directly. $EOD $ p3="" $ goto ASK_PRODUCER $ endif $ producer = f$edit(p3,"upcase") $ define/nolog producer$name 'producer' $ if debug then say "(producer name default value set to ''producer')" $ endif $! $ type/page nl: $ say "" $ say "Hello ",first,", Welcome to PCSI Menu, version ",v," on ",f$time() $ say "" $ editor_cmd = "edit/edt" $ edtini_file = "SYS$LOGIN:EDTINI.EDT" $ if f$search(edtini_file) .nes. "" then - editor_cmd = "edit/edt/command=''edtini_file'" $! $ASK_CUST_MENU: $ inq ask "* Do you wish to access the customization menu (Y/[N]/?)" $ ask = f$edit(ask,"upcase") $ if ask .eqs. "?" $ then $ help_on CUST_MENU $ goto ASK_CUST_MENU $ endif $ h_setup = f$trnlnm("help$setup") $ if h_setup .eqs. "" then define/nolog help$setup "V" !Verbose by default $ if h_setup .eqs. "V" then help_setup = "VERBOSE" $ if h_setup .eqs. "B" then help_setup = "BRIEF" $ if h_setup .eqs. "N" then help_setup = "NONE" $ say "" $ say "(current HELP mode is ",help_setup,")" $ say "" $ if f$extr(0,1,ask) .nes. "Y" then goto SKIP_CUSTOMIZATION $ if debug then say "[Start customization phase ]" $ if debug then say "[1. HELP mode preference ]" $ if h_setup .eqs. "N" then say "" $! $ explain HELP_MODE $! $ASK_HELP_MODE: $ inq ask "* Select Verbose, Brief or No help mode (V/[B]/N/?)" $ ask =f$edit(ask,"upcase") $ if ask .eqs. "?" $ then $ help_on HELP_MODE $ goto ASK_HELP_MODE $ endif $ if ask .eqs. "" then ask = "B" $ if ask.nes."V" .and. ask.nes."B" .and. ask.nes."N" then goto ASK_HELP_MODE $ define/nolog help$setup 'ask' $ h_setup = ask $ say "" $ if debug then say "[2. Editor preference ]" $ if h_setup .eqs. "N" then say "" $! $ explain DEFAULT_EDITOR $! $ASK_DEFAULT_EDITOR: $ inq ask "* Select your favourite editor, EDT or TPU ([E]/T/?)" $ if ask .eqs. "?" $ then $ help_on DEFAULT_EDITOR $ goto ASK_DEFAULT_EDITOR $ endif $ say "" $ ask = f$extract(0,1,f$edit(ask,"upcase")) $ if ask .eqs. "T" $ then $ editor_cmd = "edit/tpu" $ say "(default editor is : TPU)" $ section = "SYS$LOGIN:TPUINI.TPU$SECTION" $ if f$search(section) .nes. "" $ then $ editor_cmd = "edit/tpu/section=''section'" $ say "(default TPU section is : ''section')" $ endif $ else $ say "(default editor is : EDT)" $ edtini_file = "SYS$LOGIN:EDTINI.EDT" $ if f$search(edtini_file) .nes. "" $ then $ editor_cmd = "edit/edt/command=''edtini_file'" $ say "(default EDTINI file is : ''edtini_file')" $ endif $ endif $ if debug then say "[end of customization phase]" $ if h_setup .eqs. "N" then say "" $! $SKIP_CUSTOMIZATION: $! $ explain PRODUCT_NAME $!www.openvms.compaq.com:8000/72final/5952/5952pro_001.html#subfield_pdf_format_kit $! $ASK_PRODUCT_NAME: $ prod_name = f$edit(f$trnlnm("prod$name"),"upcase") $ default="" $ if prod_name .nes. "" then default = "''prod_name'" $ read/end=EXIT - /prompt="* Enter product name (9c. maxi) [''default']: " - sys$command ask $ ask =f$edit(ask,"upcase") $ if ask .eqs. "?" $ then $ help_on PRODUCT_NAME $ goto ASK_PRODUCT_NAME $ else $ if ask .eqs. "" .and. prod_name .eqs. "" $ then $ say bell,b1,"You must enter a name here or ^Z to exit",b0 $ goto ASK_PRODUCT_NAME $ endif $ endif $ if ask .nes. "" $ then $ prod_name = ask $ define/nolog prod$name 'prod_name' $ if debug then say "(product name default value set to ''prod_name')" $ endif $! $ explain PRODUCT_VERSION $! www.openvms.compaq.com:8000/72final/5952/5952pro_001.html#tmmnn_format $! $ASK_PRODUCT_VERSION: $ prod_ver = f$trnlnm("prod$ver") $ default="" $ if prod_ver .nes. "" then default = "''prod_ver'" $ inq ask "* Enter version number (format xx.yy-zzzz) [''default']" $ ask =f$edit(ask,"upcase") $ if ask .eqs. "?" $ then $ help_on PRODUCT_VERSION $ goto ASK_PRODUCT_VERSION $ else $ if ask .eqs. "" .and. prod_ver .eqs. "" $ then $ say bell,b1,"You must enter a version number here",b0 $ goto ASK_PRODUCT_VERSION $ endif $ endif $ if prod_ver .eqs. "" $ then $ prod_ver = ask $ define/nolog prod$ver 'prod_ver' $ if debug then say "(product version default value set to ''prod_ver')" $ endif $! $ explain MATERIAL_LOC $! www.openvms.compaq.com:8000/72final/5952/5952pro_005.html#package_kit_now $! (the /MATERIAL value for the PACKAGE command, where the appli. is located) $! $ASK_MATERIAL_LOC: $ source_kit = f$trnlnm("src$kit") $ default="" $ if source_kit .nes. "" then default = "''source_kit'" $ read/end=EXIT - /prompt="* Enter kit material location [''default']: " - sys$command ask $ ask =f$edit(ask,"upcase") $ if ask .eqs. "?" $ then $ help_on MATERIAL_LOC $ goto ASK_MATERIAL_LOC $ else $ if ask .eqs. "" .and. source_kit .eqs. "" $ then $ say bell,b1,"You must enter a location here or ^Z to exit",b0 $ goto ASK_MATERIAL_LOC $ endif $ endif $ if ask .eqs. "" $ then $ source_kit = default $ else $ source_kit = ask $ endif $ source_kit = source_kit - ":*.*" - "*.*" !in case... $ define/nolog src$kit 'source_kit' $ if debug then say "(source kit default value set to ''source_kit')" $ logname_value = f$trnlnm("source_kit") !in case it's a logname $ if logname_value .nes. "" then source_kit = logname_value $ root_kit = source_kit $ if f$locate("...]",source_kit) .ne. f$len(source_kit) then - root_kit = root_kit - "..." - "*.*" $ if f$search("''source_kit'*.*") .eqs. "" $ then $ say bell,b1,"There are no files in ",source_kit,b0 $ goto ASK_MATERIAL_LOC $ endif $! $ explain DEST_KIT_LOC $! www.openvms.compaq.com:8000/72final/6258/6048pro_054.html#index_x_1662 $! (the /DESTINATION value for the PACKAGE command) $! $ASK_DEST_KIT_LOC: $ dest_kit = f$trnlnm("dest$kit") $ default="" $ if dest_kit .nes. "" $ then $ default = "''dest_kit'" $ else $ default = "SYS$LOGIN" $ endif $ inq ask "* Enter destination for kit file [''default']" $ ask =f$edit(ask,"upcase") $ if ask .eqs. "?" $ then $ help_on DEST_KIT_LOC $ goto ASK_DEST_KIT_LOC $ endif $ if ask .nes. "" $ then $ dest_kit = ask $ else $ dest_kit = default $ endif $ define/nolog dest$kit 'dest_kit' $ if debug then say "(dest kit location default value set to ''dest_kit')" $ define sys$output nl: $ define sys$error nl: $ dir dest$kit $ status = $status $ deassign sys$output $ deassign sys$error $ if status .eqs. "%X1001C04A" then create/dir/log 'dest_kit' $ if status .eqs. "X00038030" $ then $ say f$mess(status) $ goto ASK_DEST_KIT_LOC $ endif $ set on $! $ explain PCSI_SRC_LOC $! www.openvms.compaq.com:8000/72final/5952/5952pro_005.html#package_files_now $! (the /SOURCE value for the PACKAGE command, where the PDF/PTF are located) $! $ASK_PCSI_SRC_LOC: $ pcsi_src_dir = f$trnlnm("pcsi_src$dir") $ default="" $ if pcsi_src_dir .nes. "" $ then $ default = "''pcsi_src_dir'" $ else $ default = "''dest_kit'" !why not? $ endif $ inq ask "* Enter PCSI material directory [''default']" $ if ask .eqs. "?" $ then $ help_on PCSI_SRC_LOC $ goto ASK_PCSI_SRC_LOC $ endif $ if ask .nes. "" $ then $ pcsi_src_dir = ask $ else $ pcsi_src_dir = dest_kit $ endif $ define/nolog pcsi_src$dir 'pcsi_src_dir' $ if debug then say "(source kit location default value set to ''pcsi_src_dir')" $! $ explain PRE_CONF_PROC $! www.openvms.compaq.com:8000/72final/5952/5952pro_007.html#exec_pre $! $ASK_PRE_CONF_PROC: $ inq ask "* Do you want a pre-installation procedure? Y/[N]" $ if ask .eqs. "?" $ then $ help_on PRE_CONF_PROC $ goto ASK_PRE_CONF_PROC $ endif $ ask = f$edit(ask,"upcase") $ there_is_a_pre_install_proc = 0 $ if ask .eqs. "" then ask = "N" $ if f$extr(0,1,ask) .eqs. "Y" $ then $ there_is_a_pre_install_proc = 1 $ inq ask "* Enter filename specification [''prod_name'$PRE_CONFIGURE.COM]" $ if ask .nes. "" $ then $ pre_install_file = f$search(ask) $ if pre_install_file .eqs. "" $ then $ say b1,ask," was not found",b0 $ goto ASK_PRE_CONF_PROC $ endif $ else $ pre_install_file = "''prod_name'$PRE_CONFIGURE.COM" $ bold $ say " Entering editing session for the PCSI pre-installation file" $ say " with a default name of ",pre_install_file,". Please do not change it." $ say " You can enter now any DCL commands or include any procedure in here." $ say "" $ say " Note: This procedure will NOT be parsed by PCSI and" $ say " elements created here cannot be removed by PCSI." $ off $ inq dummy "Press to start" $ if f$search(pre_install_file) .eqs. "" then gosub CREATE_PRECONF_FILE $ assign/user sys$command sys$input $ 'editor_cmd' 'pre_install_file' $ endif $ endif $! Now we create an empty PTF (not necessarily required but useful for training) $ ptf_name = "''prod_name'.PCSI$TEXT" $! $!!! explain PTF $! www.openvms.compaq.com:8000/72final/5952/5952pro_004.html#ptf_ch $! $ if debug then say "" $ if debug then say "[creating Product Text File ",ptf_name,"]" $ close/nolog ptf $ open/write ptf 'ptf_name' $! >>> start update PTF <<< $ gosub CREATE_EMPTY_PTF $! >>> end update PTF <<< $! $! Now we create the PDF (fasten you seat belt) $ pdf_name = "''prod_name'.PCSI$DESC" $! $!!! explain PDF $! www.openvms.compaq.com:8000/72final/5952/5952pro_002.html#spia_def $! $ if debug then say "" $ if debug then say "[creating Product Description File ",pdf_name,"]" $ close/nolog pdf $ open/write pdf 'pdf_name' $! >>> start update PDF <<< $ gosub BUILD_HEADER $! >>> end update PDF <<< $ if debug then say "" $ if debug then say "[version checking section]" $! $ explain VMS_VER_CHK $! www.openvms.compaq.com:8000/72final/5952/5952pro.html#pdf_file_example $! $ASK_VMS_VER_CHK: $ inq ask "* Product needs minimum OpenVMS version? [Y]/N " $ if ask .eqs. "?" $ then $ help_on VMS_VER_CHK $ goto ASK_VMS_VER_CHK $ endif $ ask = f$edit(ask,"upcase") $ if ask .eqs. "" .or. f$extr(0,1,ask) .eqs. "Y" $ then $ explain MIN_VMS_VER $! www.openvms.compaq.com:8000/72final/5952/5952pro_001.html#tmmnn_format $! $ASK_MIN_VMS_VER: $ inq ask "* Enter minimum OpenVMS version [V7.2-1H1]" $ if ask .eqs. "?" $ then $ help_on MIN_VMS_VER $ goto ASK_MIN_VMS_VER $ endif $ min_vms_version = ask $ if min_vms_version .eqs. "" then min_vms_version = "V7.2-1H1" $! >>> start update PDF <<< $ if debug then say "" $ if debug then say "[update PDF]" $ write pdf - "--!" $ write pdf - "if ();" $ write pdf - " error UNSUPP_VMS_VER abort;" $ write pdf - "end if;" $! >>> end update PDF <<< $!+ $! Now we create the matching text in the PTF $!- $! >>> start update PTF <<< $ if debug then say "[update PTF]" $ write ptf - "1 UNSUPP_VMS_VER" $ write ptf - "=prompt OpenVMS ",min_vms_version," minimum required." $ write ptf - " The version of ",prod_name," you are installing runs only with OpenVMS" $ write ptf - " version ",min_vms_version," or higher." $ write ptf - " " $ write ptf - " Please check whether you are installing this software on the right" $ write ptf - " system, or do upgrade this system to OpenVMS ",min_vms_version," or higher." $! >>> end update PTF <<< $ endif $!+ $! If there is a pre-installation procedure, let's declare it in the PDF $!- $ if there_is_a_pre_install_proc $ then $! >>> start update PDF <<< $ if debug then say "[update PDF]" $ write pdf - "--!" $ write pdf - "execute preconfigure ""@PCSI$SOURCE:[TEMP]",pre_install_file,"""" $ write pdf - " interactive" $ write pdf - " uses [TEMP]",pre_install_file,";" $! >>> end update PDF <<< $ endif $ if debug then say "" $ if debug then say "[identifiers section]" $! $ explain IDENTIFIERS $! www.openvms.compaq.com:8000/72final/5952/5952pro_011.html#right $! $ASK_IDENTIFIERS: $ inq ask "* Do you want to create rights identifiers? Y/[N]" $ if ask .eqs. "?" $ then $ help_on IDENTIFIERS $ goto ASK_IDENTIFIERS $ endif $ ask = f$edit(ask,"upcase") $ if ask .eqs. "" then ask = "N" $ if f$extr(0,1,ask) .eqs. "Y" $ then $ANOTHER_ID: $ inq ask "* Enter identifier name (=done)" $ if ask .nes. "" $ then $ rights_id = f$edit(ask,"upcase") $ inq ask - "* Do you want the RESOURCE attribute for ''rights_id'? (Y/[N])" $ ask = f$edit(ask,"upcase") $ if ask .eqs. "" then ask = "N" $ attr_string = "" $ if f$extr(0,1,ask) .eqs. "Y" then attr_string = " with ""/attributes=resource"";" $! >>> start update PDF <<< $ if debug then say "[update PDF]" $ write pdf - "--!" $ write pdf - "rights identifier ",rights_id,attr_string $! >>> end update PDF <<< $ goto ANOTHER_ID $ endif $ endif $ if debug then say "" $ if debug then say "[directories section]" $! $ explain DIRECTORIES $! www.openvms.compaq.com:8000/72final/5952/5952pro_006.html#dire $! $ASK_DIRECTORIES: $ inq ask "* Do you want to create directories? Y/[N]" $ if ask .eqs. "?" $ then $ help_on DIRECTORIES $ goto ASK_DIRECTORIES $ endif $ ask = f$edit(ask,"upcase") $ if ask .eqs. "" then ask = "N" $ if f$extr(0,1,ask) .eqs. "Y" $ then $ANOTHER_DIR: $ inq ask "* Enter directory specification (=done)" $ if ask .nes. "" $ then $ dir_spec = f$edit(ask,"upcase") - "[" - "]" $! >>> start update PDF <<< $ if debug then say "[update PDF]" $ write pdf - "--!" $ write pdf - "directory [",dir_spec,"] protection private;" $! >>> end update PDF <<< $ goto ANOTHER_DIR $ endif $ endif $ if debug then say "" $ if debug then say "[accounts section]" $! $ explain ACCOUNTS $! www.openvms.compaq.com:8000/72final/5952/5952pro_006.html#acc $! $ASK_ACCOUNTS: $ inq ask "* Do you want to create user accounts? Y/[N]" $ if ask .eqs. "?" $ then $ help_on ACCOUNTS $ goto ASK_ACCOUNTS $ endif $ ask = f$edit(ask,"upcase") $ if ask .eqs. "" then ask = "N" $ if f$extr(0,1,ask) .eqs. "Y" $ then $ANOTHER_ACCOUNT: $ inq ask "* Enter account name (=done)" $ if ask .nes. "" $ then $ username = f$edit(ask,"upcase") $ASK_UIC: $ inq uic_value "* Enter UIC for ''username' (ggg,mmm octal)" $ if uic_value .eqs. "" then goto ASK_UIC $ uic_value = uic_value - "(" - ")" - "[" - "]" $ uic_value = "[" + uic_value + "]" $ASK_DEVICE: $ inq dev_name "* Enter default device" $ if dev_name .eqs. "" then goto ASK_DEVICE $ dev_name = dev_name - ":" - "_" $ dev_name = dev_name + ":" $ASK_DIR: $ inq dir_name "* Enter default directory" $ if dir_name .eqs. "" then goto ASK_DIR $ dir_name = dir_name - "[" - "]" $ dir_name = "[" + dir_name + "]" $ASK_ID: $ inq identifier "* Enter identifier" $ if identifier .eqs. "" then goto ASK_ID $! $ inq pwd "* Enter password [WELCOME]" $ if pwd .eqs. "" then pwd = "WELCOME" $! $ inq pwd_life "* Enter password lifetime [30 days]" $ if pwd_life .eqs. "" then pwd_life = "30-" $ say "(password is created pre-expired)" $ say "" $! $! >>> start update PDF <<< $ if debug then say "[update PDF]" $ write pdf - "--!" $ write pdf - "account ",username," with (" $ write pdf - """/uic=",uic_value,"/device=",dev_name,"/directory=",dir_name,"""," $ write pdf - """",identifier,"""," $ write pdf - """/account=",username,"/pwdlife=""""",pwd_life,"""""""," $ write pdf - """/password=",pwd,"/pwdexpired"");" $! >>> end update PDF <<< goto ANOTHER_ACCOUNT $ endif $ endif $ type sys$input $DECK Now building a list of your application files... (this may take a while if you have many files in your application) $EOD $ files_list = "sys$scratch:dir_''f$getjpi(0,""pid"")'.temp" $ dir/col=1/notrail/nohead/excl=*.dir/out='files_list' src$kit:*.*; $ gosub GET_NR_OF_RECORDS $ say nr_of_rec," files found for your application." $ say "" $ close/nolog tmp_file $ open/read tmp_file 'files_list' $ if debug then say "[update PDF]" $ write pdf - "--!" $LOOP: $ read/end=NO_MORE_FILES tmp_file line $ type = f$parse(line,,,"type") $ if type .eqs. ".PCSI" then goto LOOP !no need for this one, $ if type .eqs. ".PCSI$DESC" then goto LOOP ! or this one, $ if type .eqs. ".PCSI$TEXT" then goto LOOP ! or this other one. $ device = f$parse(line,,,"device") $ version = f$parse(line,,,"version") $ file_spec = line - device - version $! >>> start update PDF <<< $ write pdf "file ",file_spec,";" $! >>> end update PDF <<< $ goto LOOP $! $NO_MORE_FILES: $ if debug then say "[end of building list process]" $ close tmp_file $ delete 'files_list';* $! $! >>> start update PDF <<< $ if debug then say "[update PDF]" $ write pdf - "--!" $ write pdf - "end product;" $ write pdf - "--! End of ",pdf_name," file." $! >>> end update PDF <<< $ close pdf $ close ptf $ say "Done." $ copy = "copy" $ delete = "delete" $ qualif = "" $ if debug then qualif="/log" $ if debug then say "[copy PDF to ''dest_kit']" $ copy'qualif' 'pdf_name' dest$kit: $ status = $status $ if status then delete'qualif' 'pdf_name'; $ if debug then say "[copy PTF to ''dest_kit']" $ copy'qualif' 'ptf_name' dest$kit: $ status = $status $ if status then delete'qualif' 'ptf_name'; $ if there_is_a_pre_install_proc $ then $ if debug then say "[copy pre installation file to ''dest_kit']" $ copy'qualif' 'pre_install_file' dest$kit: $ status = $status $ if status then delete'qualif' 'pre_install_file'; $ endif $ if debug then say "" $ say "The following elements required to build your kit have been created." $ say "" $ dir = "directory/date/size=all" $ if there_is_a_pre_install_proc $ then $ dir dest$kit:'pdf_name';,'ptf_name';,'pre_install_file'; $ else $ dir dest$kit:'pdf_name';,'ptf_name'; $ endif $ say "" $ node = f$trnlnm("sys$node") - "::" $PLEASE_ANSWER: $ inq build_it "* Do you want to build the kit NOW (Y/N)" $ if build_it .eqs. "" .or. - f$locate(build_it,"YN") .eq. 2 then goto PLEASE_ANSWER !no default $ if build_it $ then $ gosub PCSI_BUILD $PLEASE_ANSWER2: $ inq inst_it - "* Do you want to install ''prod_name' on this system (''node') NOW (Y/N)" $ if inst_it .eqs. "" .or. - f$locate(inst_it,"YN") .eq. 2 then goto PLEASE_ANSWER2 !no default $ if debug then set verify $ if inst_it then product install 'prod_name' $ if debug then set noverify $ endif $EXIT: $ say "Goodbye." $ set symbol/scope=global $ exit $!------------------------------------------------------------------------------ $GIVE_HELP: SUBROUTINE $ esc[0,8]=27 $ bold=esc+"[1m" $ off =esc+"[m" $ help_setup = f$trnlnm("help$setup") $ item = p1 $ if p2 .nes. "" then item = p2 $!+ $! Let's see what kind of help we want (help mode = Verbose/Brief/None) $! HELP_SETUP in p1 forces a help text to be displayed *before* a question. $! p1 = "" when the user entered a "?" to a question prompt. $!- $! here we want no help. $ if p1 .eqs. "HELP_SETUP" .and. help_setup .eqs. "N" then exit $ if f$sea("sys$scratch:help.temp") .nes. "" then dele_ sys$scratch:help.temp;* $ help/libr=sys$login:pcsi.hlb/noprompt/nopage/out=sys$scratch:help.temp 'item' $ close/nolog ch $ open/read ch sys$scratch:help.temp $ read ch dummy $ read ch dummy $ read ch dummy $ write sys$output "" $HELP_LOOP: $ read/end=HELP_EOF ch line $ if line .eqs. "" then goto HELP_EOF !>>> blank lines should contain one space $ write sys$output bold,line,off $! here we want the brief version, one line only. $ if p1 .eqs. "HELP_SETUP" .and. help_setup .eqs. "B" then goto HELP_EOF $ goto HELP_LOOP $HELP_EOF: $ close ch $ write sys$output "" $ return $ ENDSUBROUTINE $!----------------------------------------------------------------------------- $CREATE_PRECONF_FILE: $ close/nolog ch $ open/write ch 'pre_install_file' $ write ch "$!+" $ write ch "$! ",pre_install_file $ write ch "$!" $ write ch "$! This file is the pre-installation procedure to be executed by" $ write ch "$! the PCSI utility prior to the installation. It was automatically" $ write ch "$! generated via PCSI_MENU version ",v," on ",f$time() $ write ch "$! by ",first," ",last," (VMS user ",user,") on node ",node,"." $ write ch "$!" $ write ch "$! " $ write ch "$! None." $ write ch "$!" $ write ch "$! " $ write ch "$! Any error messages will be displayed by PCSI during execution." $ write ch "$!" $ write ch "$! " $ write ch "$! (add here what this procedure does)" $ write ch "$!" $ write ch "$! Revision history" $ write ch "$!" $ write ch "$! Version Date Author action" $ write ch - "$! ------- ----------- ---------- --------------------------------------------" $ date = f$extract(0,11,f$time()) $ write ch "$! V1.0-0 ",date," ",user," creation" $ write ch "$!-" $ close ch $ return $! $BUILD_HEADER: $ write pdf "--!+" $ write pdf "--! ",pdf_name $ write pdf "--!" $ write pdf - "--! This file is the Product Description File (PDF) for application ",prod_name $ write pdf "--! automatically generated by PCSI_MENU v",v," on ",f$time() $ write pdf "--! by ",first," ",last," (VMS user ",user,") on node ",node,"." $ write pdf "--!" $ write pdf "--! Revision history" $ write pdf "--!" $ write pdf "--! Version Date Author action" $ write pdf - "--! ------- ----------- ---------- -------------------------------------------" $ date = f$extract(0,11,f$time()) $ write pdf "--! V1.0-0 ",date," ",user," creation (via PCSI_MENU v",v,")" $ write pdf "--!-" $ write pdf "product ",producer," AXPVMS ",prod_name," ",prod_ver," full ;" $ return $! $CREATE_EMPTY_PTF: $!+ $! Note the = sign as the 1st character, and no ";" at the end of the line. $!- $ write ptf - "=product ",producer," AXPVMS ",prod_name," ",prod_ver," full" $!+ $! Unfortunately, comments are NOT allowed (at all) within PTFs... :-( $! So, we bypass this (non) feature with a tricky trick: $!- $ write ptf - "1 'PRODUCT" $ write ptf - "=prompt ",prod_name $ write ptf - " (this is a comment section written into the ",prod_name,".PCSI$TEXT file)" $ write ptf - " This file is the Product Text File (PTF) for application ",prod_name $ write ptf - " automatically generated by PCSI_MENU v",v," on ",f$time() $ write ptf - " by ",first," ",last," (VMS user ",user,") on node ",node,"." $ write ptf - " " $ write ptf - " Revision history" $ write ptf - " " $ write ptf - " Version Date Author action" $ write ptf - " ------- ----------- ---------- -------------------------------------------" $ date = f$extract(0,11,f$time()) $ write ptf - " V1.0-0 ",date," ",user," creation (via PCSI_MENU v",v,")" $ write ptf - " " $ return $! $GET_NR_OF_RECORDS: $ ver=f$ver(0) !or the proc fails... $ define sys$output x.x $ copy/log 'files_list' nl: $ deassign sys$output $ close/nolog x $ open/read x x.x $ read x line $ close x $ nr_of_rec = f$element(0," ",f$extract('f$locate("NL: (",line)'+5,999,line)) $ delete x.x;* $ ver=f$ver(ver) $ return $!------------------------------------------------------------------------------ $PCSI_BUILD: $ on warning then goto FATAL_EXIT $ src = f$trnlnm("''source_kit'") $ if src .eqs. "" then src = source_kit $ dest = f$trnlnm("''dest_kit'") $ if dest .eqs. "" then dest = dest_kit $ if debug then set verify $! $ product package 'prod_name' - /base =AXPVMS - /producer ='producer' - /source ='dest''prod_name' - ! where to find PDF and PTF /destination='dest' - ! where to put .PCSI file /material ='src' - ! where to find product material /format =sequential $! $ if debug then set noverify $ dir 'producer'*'prod_name'*.pcsi $ say "" $ return $! $FATAL_EXIT: $ if debug then set noverify $ say "The PCSI build procedure has failed." $ return Enjoy. D. -- --------------------------------------------------------------------- MORANDI Consulting. WEB: http://Didier.Morandi.Free.fr/index_us.html Pflanzschulstrasse 53, 8004 Zurich, Switzerland. GSM: +41 79 705 4670 19, chemin de la Butte, 31400 Toulouse, France. Disaster Recovery Plans, Computer Security Audits, DEC OpenVMS Expertise On parle français, Man spricht Deutsch, Habla Castellano, English spoken