1$! File: Backup_gnv_curl_src.com
2$!
3$! $Id$
4$!
5$! Procedure to create backup save sets for installing in a PCSI kit.
6$!
7$! To comply with most Open Source licenses, the source used for building
8$! a kit will be packaged with the distribution kit for the binary.
9$!
10$! Backup save sets are the only storage format that I can expect a
11$! VMS system to be able to extract ODS-5 filenames and directories.
12$!
13$! The make_pcsi_kit_name.com needs to be run before this procedure to
14$! properly name the files that will be created.
15$!
16$! This file is created from a template file for the purpose of making it
17$! easier to port Unix code, particularly open source code to VMS.
18$! Therefore permission is freely granted for any use.
19$!
20$! Copyright 2009 - 2020, John Malmberg
21$!
22$! Permission to use, copy, modify, and/or distribute this software for any
23$! purpose with or without fee is hereby granted, provided that the above
24$! copyright notice and this permission notice appear in all copies.
25$!
26$! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
27$! WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
28$! MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
29$! ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
30$! WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
31$! ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
32$! OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
33$!
34$! 13-Jun-2009 J. Malmberg
35$!
36$!===========================================================================
37$!
38$! Save default
39$ default_dir = f$environment("DEFAULT")
40$!
41$ arch_type = f$getsyi("ARCH_NAME")
42$ arch_code = f$extract(0, 1, arch_type)
43$!
44$ if arch_code .nes. "V"
45$ then
46$   set proc/parse=extended
47$ endif
48$!
49$ ss_abort = 44
50$ status = ss_abort
51$!
52$ kit_name = f$trnlnm("GNV_PCSI_KITNAME")
53$ if kit_name .eqs. ""
54$ then
55$   write sys$output "@MAKE_PCSI_CURL_KIT_NAME.COM has not been run."
56$   goto all_exit
57$ endif
58$ producer = f$trnlnm("GNV_PCSI_PRODUCER")
59$ if producer .eqs. ""
60$ then
61$   write sys$output "@MAKE_PCSI_CURL_KIT_NAME.COM has not been run."
62$   goto all_exit
63$ endif
64$ filename_base = f$trnlnm("GNV_PCSI_FILENAME_BASE")
65$ if filename_base .eqs. ""
66$ then
67$   write sys$output "@MAKE_PCSI_CURL_KIT_NAME.COM has not been run."
68$   goto all_exit
69$ endif
70$!
71$ node_swvers = f$getsyi("NODE_SWVERS")
72$ node_swvers_type = f$extract(0, 1, node_swvers)
73$ node_swvers_vers = f$extract(1, f$length(node_swvers), node_swvers)
74$ swvers_maj = f$element(0, ".", node_swvers_vers)
75$ node_swvers_min_update = f$element(1, ".", node_swvers_vers)
76$ swvers_min = f$element(0, "-", node_swvers_min_update)
77$ swvers_update = f$element(1, "-", node_swvers_min_update)
78$!
79$ if swvers_update .eqs. "-" then swvers_update = ""
80$!
81$ vms_vers = f$fao("!2ZB!2ZB!AS", 'swvers_maj', 'swvers_min', swvers_update)
82$!
83$!
84$!
85$! If available make an interchange save set
86$!-------------------------------------------
87$ interchange = ""
88$ if arch_code .eqs. "V"
89$ then
90$   interchange = "/interchange"
91$ endif
92$ if (swvers_maj .ges. "8") .and. (swvers_min .ges. 4)
93$ then
94$   interchange = "/interchange/noconvert"
95$ endif
96$!
97$!
98$! Move to the base directories
99$ set def [--]
100$!
101$! Put things back on error.
102$ on warning then goto all_exit
103$!
104$ current_default = f$environment("DEFAULT")
105$ my_dir = f$parse(current_default,,,"DIRECTORY") - "[" - "<" - ">" - "]"
106$!
107$ src_root = "src_root:"
108$ if f$trnlnm("src_root1") .nes. "" then src_root = "src_root1:"
109$ backup'interchange' 'src_root'[curl...]*.*;0 -
110           'filename_base'_original_src.bck/sav
111$ status = $status
112$!
113$! There may be a VMS specific source kit
114$!-----------------------------------------
115$ vms_root = "vms_root:"
116$ if f$trnlnm("vms_root1") .nes. "" then vms_root = "vms_root1:"
117$ files_found = 0
118$ define/user sys$error nl:
119$ define/user sys$output nl:
120$ directory 'vms_root'[...]*.*;*/exc=*.dir
121$ if '$severity' .eq. 1 then files_found = 1
122$!
123$ if files_found .eq. 1
124$ then
125$   backup'interchange' 'vms_root'[curl...]*.*;0 -
126            'filename_base'_vms_src.bck/sav
127$   status = $status
128$ endif
129$!
130$all_exit:
131$ set def 'default_dir'
132$ exit
133