-
Notifications
You must be signed in to change notification settings - Fork 20
/
build.sh
311 lines (237 loc) · 7.4 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
#!/QOpenSys/usr/bin/qsh
#----------------------------------------------------------------
# Script name: build.sh
# Author: Richard Schoen
# Purpose: Create QSHONI library, copies source members and compiles objects
#----------------------------------------------------------------
SRCLIB="QSHONI"
SRCLIBTEXT="QShell on IBM i"
SRCFILE="SOURCE"
SRCCCSID="37"
dashes="---------------------------------------------------------------------------"
function cpy_member
{
# ----------------------------------------------------------------
# Copy source member and set source type
# ----------------------------------------------------------------
SRCMEMBER=`echo "${CURFILE^^}" | cut -d'.' -f1` # Parse PC file name prefix to member name
SRCTYPE=`echo "${CURFILE^^}" | cut -d'.' -f2` # Parse PC file name extenstion to souce type
system -v "CPYFRMSTMF FROMSTMF('${PWD}/${CURFILE}') TOMBR('/QSYS.LIB/${SRCLIB}.LIB/${SRCFILE}.FILE/${SRCMEMBER}.MBR') MBROPT(*REPLACE) DBFCCSID(*FILE)"
system -v "CHGPFM FILE(${SRCLIB}/${SRCFILE}) MBR($SRCMEMBER) SRCTYPE(${SRCTYPE}) TEXT('${SRCTEXT}')"
}
echo "$dashes"
echo "Starting Build of ${SRCLIBTEXT} library ${SRCLIB}"
# Create library, clear library and create source file
system -v "CRTLIB ${SRCLIB} TYPE(*PROD) TEXT('${SRCLIBTEXT}')"
system -v "CLRLIB LIB(${SRCLIB})"
system -v "CRTSRCPF FILE(${SRCLIB}/${SRCFILE}) RCDLEN(120) CCSID(${SRCCCSID})"
# Copy all the source members and set source types
CURFILE="QSHBASH.CMD"
SRCTEXT="Run Bash Command via Qshell"
cpy_member
CURFILE="QSHBASHC.CLLE"
SRCTEXT="Run Bash Command via Qshell"
cpy_member
CURFILE="QSHEXEC.CMD"
SRCTEXT="Run QShell Command Line"
cpy_member
CURFILE="QSHEXECC.CLLE"
SRCTEXT="Run QShell Command Line"
cpy_member
CURFILE="QSHLOGSCAC.CLP"
SRCTEXT="Scan Qshell Log File for Value"
cpy_member
CURFILE="QSHLOGSCAN.CMD"
SRCTEXT="Scan Qshell Log File for Value"
cpy_member
CURFILE="QSHLOGSCAR.RPGLE"
SRCTEXT="Scan Qshell Log File for Value"
cpy_member
CURFILE="QSHPATH.CMD"
SRCTEXT="Set Open Source Package Path Environment Variables"
cpy_member
CURFILE="QSHPATHC.CLLE"
SRCTEXT="Set Open Source Package Path Environment Variables"
cpy_member
CURFILE="QSHSTDOUTR.RPGLE"
SRCTEXT="Read and parse stdout log"
cpy_member
CURFILE="QSHIFSCHKR.RPGLE"
SRCTEXT="Check for IFS File Existence"
cpy_member
CURFILE="QSHIFSCHKC.CLP"
SRCTEXT="Check for IFS File Existence"
cpy_member
CURFILE="QSHIFSCHK.CMD"
SRCTEXT="Check for IFS File Existence"
cpy_member
CURFILE="QSHPYRUN.CMD"
SRCTEXT="Run Python Script via Qshell"
cpy_member
CURFILE="QSHPYRUNC.CLLE"
SRCTEXT="Run Python Script via Qshell"
cpy_member
CURFILE="QSHDEMO01R.RPGLE"
SRCTEXT="Read Outfile STDOUTQSH and display via DSPLY cmd"
cpy_member
CURFILE="QSHQRYTMP.CMD"
SRCTEXT="SQL Query Data to Selected Temp Table with RUNSQL"
cpy_member
CURFILE="QSHQRYTMPC.CLP"
SRCTEXT="SQL Query Data to Selected Temp Table with RUNSQL"
cpy_member
CURFILE="QSHCURL.CMD"
SRCTEXT="Run Curl Command via QShell"
cpy_member
CURFILE="QSHCURLC.CLP"
SRCTEXT="Run Curl Command via QShell"
cpy_member
CURFILE="QSHPORTCHK.CMD"
SRCTEXT="Check for active TCP/IP Local Port"
cpy_member
CURFILE="QSHPORTCHC.CLP"
SRCTEXT="Check for active TCP/IP Local Port"
cpy_member
CURFILE="QSHPORTEND.CMD"
SRCTEXT="End All Jobs for Active TCP/IP Local Port"
cpy_member
CURFILE="QSHPORTENC.CLP"
SRCTEXT="End All Jobs for Active TCP/IP Local Port"
cpy_member
CURFILE="QSHSETPROC.CLP"
SRCTEXT="Set up .profile, .bash_profile and .bashrc files"
cpy_member
CURFILE="QSHSETPROF.CMD"
SRCTEXT="Set up .profile, .bash_profile and .bashrc files"
cpy_member
CURFILE="QSHBASHRC.TXT"
SRCTEXT="User .bashrc bash template for Opn Src Pkgs"
cpy_member
CURFILE="QSHBASHPRF.TXT"
SRCTEXT="User .bash_profile bash template for Opn Src Pkgs"
cpy_member
CURFILE="QSHPROFILE.TXT"
SRCTEXT="User QShell .profile template for Opn Src Pkgs"
cpy_member
CURFILE="QSHEXECSRC.CMD"
SRCTEXT="Run QShell .sh script from Source File Member"
cpy_member
CURFILE="QSHEXECSCC.CLLE"
SRCTEXT="Run QShell .sh script from Source File Member"
cpy_member
CURFILE="QSHBASHSRC.CMD"
SRCTEXT="Run Bash .sh script from Source File Member"
cpy_member
CURFILE="QSHBASHSCC.CLLE"
SRCTEXT="Run Bash .sh script from Source File Member"
cpy_member
CURFILE="DB2UTIL.CMD"
SRCTEXT="Execute db2util Query to IFS Output File via bash"
cpy_member
CURFILE="DB2UTILC.CLLE"
SRCTEXT="Execute db2util Query to IFS Output File via bash"
cpy_member
CURFILE="QSHPYCALL.CMD"
SRCTEXT="Run Python Script via Qshell and Return Parms"
cpy_member
CURFILE="QSHPYCALLC.CLLE"
SRCTEXT="Run Python Script via Qshell and Return Parms"
cpy_member
CURFILE="QSHPYCALLT.CLLE"
SRCTEXT="Test Call to QSHPYCALL"
cpy_member
CURFILE="QSHGETPARM.CMD"
SRCTEXT="Scan Qshell Log File for Parameter Values"
cpy_member
CURFILE="QSHGETPARR.RPGLE"
SRCTEXT="Run Python Script via Qshell and Return Parms"
cpy_member
CURFILE="QSHPHPRUN.CMD"
SRCTEXT="Run PHP Script via QShell"
cpy_member
CURFILE="QSHPHPRUNC.CLLE"
SRCTEXT="Run PHP Script via QShell"
cpy_member
CURFILE="QSHCALL.CMD"
SRCTEXT="Run QShell Command Line and Return Parms"
cpy_member
CURFILE="QSHCALLC.CLLE"
SRCTEXT="Run QShell Command Line and Return Parms"
cpy_member
CURFILE="QSHCALLT.CLLE"
SRCTEXT="Test Call to QSHCALL"
cpy_member
CURFILE="QSHCALLT.CLLE"
SRCTEXT="Test Call to QSHCALL"
cpy_member
CURFILE="QSHCPYSRC.CMD"
SRCTEXT="Copy Source Member to IFS File"
cpy_member
CURFILE="QSHCPYSRCC.CLLE"
SRCTEXT="Copy Source Member to IFS File"
cpy_member
CURFILE="QSHONISRV.RPGLE"
SRCTEXT="QShell on i - Wrapper Service Program"
cpy_member
CURFILE="QSHONISRVH.RPGLE"
SRCTEXT="QShell on i - Wrapper Service Program - Include"
cpy_member
CURFILE="QSHONISRVD.BNDDIR"
SRCTEXT="QShell on i - Wrapper Service Program-Bind Source"
cpy_member
CURFILE="QSHONIPR01.RPGLE"
SRCTEXT="QSHONISRV Service Program Tester 1 - QSHEXEC"
cpy_member
CURFILE="QSHONIPR02.RPGLE"
SRCTEXT="QSHONISRV Service Program Tester 2 - QSHBASH"
cpy_member
CURFILE="QSHONIPR03.RPGLE"
SRCTEXT="QSHONISRV Service Program Tester 3 - QSHCALL"
cpy_member
CURFILE="QSHIFSSIZ.CMD"
SRCTEXT="Retrieve IFS Object Size using stat64"
cpy_member
CURFILE="QSHIFSSIZC.CLLE"
SRCTEXT="Retrieve IFS Object Size using stat64"
cpy_member
CURFILE="QSHQRYSRC.CMD"
SRCTEXT="SQL Query Data via SQL Source Member to Temp Table"
cpy_member
CURFILE="QSHQRYSRCC.CLP"
SRCTEXT="SQL Query Data via SQL Source Member to Temp Table"
cpy_member
CURFILE="QSHQRYSRCR.RPGLE"
SRCTEXT="SQL Query Data via SQL Source Member to Temp Table"
cpy_member
CURFILE="QSHSAVLIB.CMD"
SRCTEXT="Save Library to IFS Save File"
cpy_member
CURFILE="QSHSAVLIBC.CLP"
SRCTEXT="Save Library to IFS Save File"
cpy_member
CURFILE="QSHSAVIFS.CMD"
SRCTEXT="Save IFS Objects to IFS Save File"
cpy_member
CURFILE="QSHSAVIFSC.CLP"
SRCTEXT="Save IFS Objects to IFS Save File"
cpy_member
CURFILE="SRCBLDC.CLP"
SRCTEXT="Build cmds from QSHONI/SOURCE file"
cpy_member
CURFILE="SQLTEST1.SQL"
SRCTEXT="SQL Test 1 - Query Qcustcdt - All Records"
cpy_member
CURFILE="SQLTEST2.SQL"
SRCTEXT="SQL Test 2 - Query Qcustcdt - Cusnum = 938472"
cpy_member
CURFILE="README.TXT"
SRCTEXT="Read Me Docs on Setup"
cpy_member
CURFILE="VERSION.TXT"
SRCTEXT="Version Notes"
cpy_member
# Create and run build program
system -q "CRTCLPGM PGM(${SRCLIB}/SRCBLDC) SRCFILE(${SRCLIB}/${SRCFILE})"
system -v "CALL PGM(${SRCLIB}/SRCBLDC)"
echo "${SRCLIBTEXT} library ${SRCLIB} was created and programs compiled."
echo "$dashes"