source: trunk/dsys/funcBUILD@ 298

Last change on this file since 298 was 27, checked in by rainer, 19 years ago

Support for server-to-server relay and more user policies

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