source: trunk/dsys/funcBUILD@ 19

Last change on this file since 19 was 1, checked in by katerina, 19 years ago

Initial import

File size: 5.4 KB
RevLine 
[1]1#########################################################################
2#
3# Subroutine for bulding from source
4#
5#########################################################################
6
7#------------------------------------------------------------------------
8# List available sources
9#------------------------------------------------------------------------
10listSRC() {
11
12
13 OKSRCLIST=""; export OKSRCLIST
14
15 echo > $tmpF;
16
17 needEXE ls gpg
18
19 cd "${basedir}/source" || printFATAL "could not cd to ${basedir}/source"
20
21 LIST=`ls samhain*.tar.gz 2>/dev/null`
22
23 if test x"$LIST" = x
24 then
25 printFATAL "No source tarball found in ${basedir}/source. Please use 'deploy.sh download'."
26 fi
27
28 for ff in $LIST
29 do
30 sh_version=`echo "$ff" | sed 's/.*samhain\-//g' | sed 's/\.tar\.gz//g'`
31 if test x"${sh_version}" = x
32 then
33 printFATAL "Cannot determine version for $ff"
34 fi
35
36 if test "$ff" != "samhain-${sh_version}.tar.gz"
37 then
38 printFATAL "Version number not correctly extracted from $ff"
39 fi
40
41 if test -f "samhain-${sh_version}.tar.gz.asc"
42 then
43 :
44 else
45 printWARNING "No detached signature for $ff found"
46 continue
47 fi
48
49 sig_lines=`(LANG="C"; gpg --status-fd 1 --verify "samhain-${sh_version}.tar.gz.asc" "samhain-${sh_version}.tar.gz" 2>/dev/null)`
50 sig_ok=`echo ${sig_lines} | grep 'GOODSIG'`
51 sig_nokey=`echo ${sig_lines} | grep 'NO_PUBKEY'`
52
53 if test x"${sig_nokey}" != x
54 then
55 printWARNING "Public key (ID 0F571F6C) not found, trying to import it."
56 gpg --import ${basedir}/private/0F571F6C.asc 2>&5
57 sig_lines=`(LANG="C"; gpg --status-fd 1 --verify "samhain-${sh_version}.tar.gz.asc" "samhain-${sh_version}.tar.gz" 2>/dev/null)`
58 sig_ok=`echo ${sig_lines} | grep 'GOODSIG'`
59 sig_nokey=`echo ${sig_lines} | grep 'NO_PUBKEY'`
60 fi
61
62 if test x"${sig_nokey}" != x
63 then
64 printFATAL "Importing public key failed."
65 fi
66
67 if test x"${sig_ok}" = x
68 then
69 printWARNING "File $ff has no good signature"
70 continue
71 fi
72
73 if test x"$1" = x
74 then
75 OKSRCLIST="$OKSRCLIST ${sh_version}"
76 else
77 if test x"$1" = x"${sh_version}"
78 then
79 OKSRCLIST="${sh_version}"
80 return 0
81 fi
82 fi
83 done
84
85 if test x"$OKSRCLIST" = x
86 then
87 printFATAL "No source tarball found. Please use 'deploy.sh download'."
88 fi
89
90 for dd in $OKSRCLIST
91 do
92 echo $dd >> "$tmpF"
93 done
94
95 OKSRCLIST=`cat "$tmpF" | sort -r | sed 9q`
96 export OKSRCLIST
97
98 rm -f "$tmpF" && touch "$tmpF"
99 echo $OKSRCLIST > "$tmpF"
100
101 return 0
102}
103
104selBVERSION() {
105 #---------------------------------------------------------------------
106 # Select version to build
107 #---------------------------------------------------------------------
108 if test x"$src_version" = x
109 then
110 if test x"$assumeyes" = x1
111 then
112 printFATAL "No version selected, aborting."
113 fi
114
115 promptINFO "Checking which versions are available"
116
117 ((listSRC | tee -a "$lastlog") 6>&1 1>&2 2>&6 | \
118 tee -a "$lastlog") 6>&1 1>&2 2>&6
119 OKSRCLIST=`cat "$tmpF"`
120 n=0
121 for word in $OKSRCLIST
122 do
123 n=`expr $n + 1`
124 eval part$n="$word"
125 done
126
127 command="promptMENU 'Please select version to build' "
128 for word in $OKSRCLIST
129 do
130 command="$command '${word}'"
131 done
132 eval ${command}
133 m=$?
134 if test x$m = x1
135 then
136 (exit 0); exit 0;
137 elif test x$m = "x-1"
138 then
139 printFATAL "Something went wrong !"
140 else
141 src_version="$MENU"; export src_version
142 fi
143
144 else
145 ((listSRC "$src_version" | tee -a "$lastlog") 6>&1 1>&2 2>&6 | \
146 tee -a "$lastlog") 6>&1 1>&2 2>&6
147 fi
148}
149
150selBARCH() {
151 #---------------------------------------------------------------------
152 # Select arch to build
153 #---------------------------------------------------------------------
154 if test x"$arch" = x
155 then
156 if test x"$assumeyes" = x1
157 then
158 printFATAL "No operating system selected, aborting."
159 fi
160 cd "$basedir"/configs || printFATAL "Cannot cd to $basedir/configs !"
161 LIST=`ls *.configure 2>/dev/null`
162 if test x"$LIST" = x
163 then
164 printFATAL "No config files found in ${basedir}/configs."
165 fi
166
167 n=0
168 command="promptMENU 'Please select operating system of build host' "
169 ALIST=""
170 FLIST=""
171 for ff in $LIST
172 do
173 n=`expr $n + 1`
174 osp=`echo $ff | sed s/\.configure//`
175 ALIST="$ALIST $osp"
176 FLIST="$FLIST $osp"
177 if test $n -lt 8
178 then
179 command="$command '${osp}'"
180 fi
181 done
182 command="$command other"
183
184 eval ${command}
185 m=$?
186 if test x$m = x1
187 then
188 (exit 0); exit 0;
189 elif test x$m = "x-1"
190 then
191 printFATAL "Something went wrong !"
192 else
193 arch="$MENU"; export arch
194 if test x"$arch" = xother
195 then
196 promptINPUT "Please select operating system of build host from $FLIST or enter new one"
197 if test x$m = x1
198 then
199 (exit 0); exit 0;
200 elif test x$m = "x-1"
201 then
202 printFATAL "Something went wrong !"
203 else
204 found=`echo $FLIST | sed -n /$INPUT/p 2>/dev/null`
205 if test x"$found" = x
206 then
207 printLOG "Copy configuration for $INPUT from generic"
208 cp generic.configure "${INPUT}.configure"
209 fi
210 arch="$INPUT"; export arch
211 fi
212 fi
213 fi
214
215 fi
216 # arch selected or exited
217}
218
219selBFORMAT() {
220 if test x"$format" = x
221 then
222 promptMENU "Please select format of binary package" "run" "rpm" "deb" "tbz2" "solaris-pkg" "depot"
223 if test x$m = x1
224 then
225 (exit 0); exit 0
226 elif test x$m = "x-1"
227 then
228 printFATAL "Something went wrong !"
229 else
230 format="$MENU"; export format
231 fi
232 fi
233}
Note: See TracBrowser for help on using the repository browser.