forked from richardschoen/QshOni
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
167 lines (129 loc) · 4.3 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
#!/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 Bash Command via Qshell"
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="SRCBLDC.CLP"
SRCTEXT="Build cmds from QSHONI/SOURCE file"
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"