| 1 |
$! File: Backup_gawk_src.com |
| 2 |
$! |
| 3 |
$! Procedure to create backup save sets for installing in a PCSI kit. |
| 4 |
$! |
| 5 |
$! To comply with most Open Source licenses, the source used for building |
| 6 |
$! a kit will be packaged with the distribution kit for the binary. |
| 7 |
$! |
| 8 |
$! Backup save sets are the only storage format that I can expect a |
| 9 |
$! VMS system to be able to extract ODS-5 filenames and directories. |
| 10 |
$! |
| 11 |
$! The make_pcsi_kit_name.com needs to be run before this procedure to |
| 12 |
$! properly name the files that will be created. |
| 13 |
$! |
| 14 |
$! This file is created from a template file for the purpose of making it |
| 15 |
$! easier to port Unix code, particularly open source code to VMS. |
| 16 |
$! Therefore permission is freely granted for any use. |
| 17 |
$! |
| 18 |
$! 13-Jun-2009 J. Malmberg |
| 19 |
$! |
| 20 |
$!=========================================================================== |
| 21 |
$! |
| 22 |
$! Save default |
| 23 |
$ default_dir = f$environment("DEFAULT") |
| 24 |
$! |
| 25 |
$ arch_type = f$getsyi("ARCH_NAME") |
| 26 |
$ arch_code = f$extract(0, 1, arch_type) |
| 27 |
$! |
| 28 |
$ if arch_code .nes. "V" |
| 29 |
$ then |
| 30 |
$ set proc/parse=extended |
| 31 |
$ endif |
| 32 |
$! |
| 33 |
$ ss_abort = 44 |
| 34 |
$ status = ss_abort |
| 35 |
$! |
| 36 |
$ kit_name = f$trnlnm("GNV_PCSI_KITNAME") |
| 37 |
$ if kit_name .eqs. "" |
| 38 |
$ then |
| 39 |
$ write sys$output "@MAKE_PCSI_GAWK_KIT_NAME.COM has not been run." |
| 40 |
$ goto all_exit |
| 41 |
$ endif |
| 42 |
$ producer = f$trnlnm("GNV_PCSI_PRODUCER") |
| 43 |
$ if producer .eqs. "" |
| 44 |
$ then |
| 45 |
$ write sys$output "@MAKE_PCSI_GAWK_KIT_NAME.COM has not been run." |
| 46 |
$ goto all_exit |
| 47 |
$ endif |
| 48 |
$ filename_base = f$trnlnm("GNV_PCSI_FILENAME_BASE") |
| 49 |
$ if filename_base .eqs. "" |
| 50 |
$ then |
| 51 |
$ write sys$output "@MAKE_PCSI_GAWK_KIT_NAME.COM has not been run." |
| 52 |
$ goto all_exit |
| 53 |
$ endif |
| 54 |
$! |
| 55 |
$ node_swvers = f$getsyi("NODE_SWVERS") |
| 56 |
$ node_swvers_type = f$extract(0, 1, node_swvers) |
| 57 |
$ node_swvers_vers = f$extract(1, f$length(node_swvers), node_swvers) |
| 58 |
$ swvers_maj = f$element(0, ".", node_swvers_vers) |
| 59 |
$ node_swvers_min_update = f$element(1, ".", node_swvers_vers) |
| 60 |
$ swvers_min = f$element(0, "-", node_swvers_min_update) |
| 61 |
$ swvers_update = f$element(1, "-", node_swvers_min_update) |
| 62 |
$! |
| 63 |
$ if swvers_update .eqs. "-" then swvers_update = "" |
| 64 |
$! |
| 65 |
$ vms_vers = f$fao("!2ZB!2ZB!AS", 'swvers_maj', 'swvers_min', swvers_update) |
| 66 |
$! |
| 67 |
$! |
| 68 |
$! |
| 69 |
$! If available make an interchange save set |
| 70 |
$!------------------------------------------- |
| 71 |
$ interchange = "" |
| 72 |
$ if arch_code .eqs. "V" |
| 73 |
$ then |
| 74 |
$ interchange = "/interchange/exclude=[.$5ngit...]*.*" |
| 75 |
$ endif |
| 76 |
$ if (swvers_maj .ges. "8") .and. (swvers_min .ges. 4) |
| 77 |
$ then |
| 78 |
$ interchange = "/interchange/noconvert/exclude=[.^.git...]*.*" |
| 79 |
$ endif |
| 80 |
$! |
| 81 |
$! |
| 82 |
$! Put things back on error. |
| 83 |
$ on warning then goto all_exit |
| 84 |
$! |
| 85 |
$ current_default = f$environment("DEFAULT") |
| 86 |
$ my_dir = f$parse(current_default,,,"DIRECTORY") - "[" - "<" - ">" - "]" |
| 87 |
$! |
| 88 |
$ src_root = "src_root:" |
| 89 |
$ if f$trnlnm("src_root1") .nes. "" then src_root = "src_root1:" |
| 90 |
$ backup'interchange' 'src_root'[gawk...]*.*;0 - |
| 91 |
'filename_base'_original_src.bck/sav |
| 92 |
$ status = $status |
| 93 |
$! |
| 94 |
$! There may be a VMS specific source kit |
| 95 |
$!----------------------------------------- |
| 96 |
$ vms_root = "vms_root:" |
| 97 |
$ if f$trnlnm("vms_root1") .nes. "" then vms_root = "vms_root1:" |
| 98 |
$ files_found = 0 |
| 99 |
$ define/user sys$error nl: |
| 100 |
$ define/user sys$output nl: |
| 101 |
$ directory 'vms_root'[...]*.*;*/exc=*.dir |
| 102 |
$ if '$severity' .eq. 1 then files_found = 1 |
| 103 |
$! |
| 104 |
$ if files_found .eq. 1 |
| 105 |
$ then |
| 106 |
$ backup'interchange' 'vms_root'[gawk...]*.*;0 - |
| 107 |
'filename_base'_vms_src.bck/sav |
| 108 |
$ status = $status |
| 109 |
$ endif |
| 110 |
$! |
| 111 |
$all_exit: |
| 112 |
$ set def 'default_dir' |
| 113 |
$ exit |