1 |
This patch does some cleanup work: |
2 |
- ginfo was available and used in only one of the gnap_* scripts. Add |
3 |
it to the other scripts where it might be needed and use it. |
4 |
- mkdir -p ... \n gtest ... was used very often. I put this in a |
5 |
function, the error messages are now more detailed (no "kernel temp dir |
6 |
could not be created", but "/some/very/important/path could not be |
7 |
created". |
8 |
- removed ALLTARGET in gnap_make. |
9 |
- used storedir from catalyst.conf instead of CATALYST_DIR. |
10 |
- some more stuff, which should be obvious. |
11 |
|
12 |
If there are any questions, just ask. |
13 |
|
14 |
Philipp |
15 |
|
16 |
|
17 |
diff -ur --exclude .svn --exclude upload.sh --exclude diff.sh |
18 |
gnap-2.0/src/gnap_make gnap-2.0+cleanup/src/gnap_make |
19 |
--- gnap-2.0/src/gnap_make 2007-07-23 14:14:40.000000000 +0300 |
20 |
+++ gnap-2.0+cleanup/src/gnap_make 2007-08-02 15:55:38.000000000 +0300 |
21 |
@@ -21,6 +21,15 @@ |
22 |
echo -e " ${W}*${N} ${*}" |
23 |
} |
24 |
|
25 |
+ginfo() { |
26 |
+ echo -e " ${G}*${N} ${*}" |
27 |
+} |
28 |
+ |
29 |
+gmkdir() { |
30 |
+ mkdir -p "$1" |
31 |
+ gtest continued $? "Failed to create directory \"$1\"." |
32 |
+} |
33 |
+ |
34 |
gconfirm() { |
35 |
if [[ "${FORCEYES}" -eq 1 ]]; then |
36 |
gwarn "${*} forced to yes" |
37 |
@@ -30,7 +39,7 @@ |
38 |
if [[ -n "${TEMPDIR}" ]]; then |
39 |
cleanup |
40 |
fi |
41 |
- echo Build aborted ! |
42 |
+ echo Build aborted! |
43 |
exit 2 |
44 |
fi |
45 |
fi |
46 |
@@ -77,7 +86,7 @@ |
47 |
echo ' -c catalyst.conf Use specific catalyst.conf file' |
48 |
echo ' -e specs Specs directory or tar.bz2 file' |
49 |
echo |
50 |
- echo "Please man ${GNAPNAME} for more details." |
51 |
+ echo "Please use man ${GNAPNAME} for more details." |
52 |
} |
53 |
|
54 |
cleanup() { |
55 |
@@ -92,19 +101,24 @@ |
56 |
fi |
57 |
} |
58 |
|
59 |
-if [[ "$#" -eq 0 || "${1}" == '-h' ]]; then |
60 |
+if [[ "$#" -eq 0 ]]; then |
61 |
usage |
62 |
exit 0 |
63 |
fi |
64 |
|
65 |
gbegin 'Checking parameters' |
66 |
|
67 |
+# Catalyst executable and config file |
68 |
+CATALYST_BIN="/usr/bin/catayst" |
69 |
+CATALYST_CONF="/etc/catalyst/catalyst.conf" |
70 |
+ |
71 |
# Read options |
72 |
NOTARGET=1 |
73 |
STAMP=$(date +%Y%m%d) |
74 |
-while getopts ':hs:p:m:o:v:t:fl:c:e:' options; do |
75 |
- case ${options} in |
76 |
- h ) usage |
77 |
+while getopts ':hs:p:m:o:v:t:fl:c:e:' option; do |
78 |
+ case ${option} in |
79 |
+ h ) |
80 |
+ usage |
81 |
exit 0;; |
82 |
s ) STAGE3FILE="${OPTARG}";; |
83 |
p ) SNAPSHOTFILE="${OPTARG}";; |
84 |
@@ -112,7 +126,13 @@ |
85 |
v ) STAMP="${OPTARG}";; |
86 |
t ) |
87 |
case "${OPTARG}" in |
88 |
- all ) ALLTARGET=1;; |
89 |
+ all ) |
90 |
+ STAGE3=1 |
91 |
+ LIVECD1=1 |
92 |
+ LIVECD2=1 |
93 |
+ TARBALL=1 |
94 |
+ MODULES=1 |
95 |
+ NEEDS_SNAPSHOT=1;; |
96 |
stage3 ) |
97 |
STAGE3=1 |
98 |
NEEDS_SNAPSHOT=1;; |
99 |
@@ -122,17 +142,19 @@ |
100 |
livecd-stage2 ) |
101 |
LIVECD2=1 |
102 |
NEEDS_SNAPSHOT=1;; |
103 |
- tarball ) TARBALL=1;; |
104 |
+ tarball ) |
105 |
+ TARBALL=1;; |
106 |
extensions ) |
107 |
MODULES=1 |
108 |
NEEDS_SNAPSHOT=1;; |
109 |
+ * ) gtest 1 'Specified stage is unknown!';; |
110 |
esac |
111 |
NOTARGET=0;; |
112 |
f ) FORCEYES=1;; |
113 |
l ) GNAPLOGPREFIX="${OPTARG}";; |
114 |
c ) CATALYST_CONF="${OPTARG}";; |
115 |
e ) SPECS="${OPTARG}";; |
116 |
- * ) gtest 1 'Specified options are incomplete or unknown !';; |
117 |
+ * ) gtest 1 'Specified options are incomplete or unknown!';; |
118 |
esac |
119 |
done |
120 |
|
121 |
@@ -147,8 +169,7 @@ |
122 |
# Prepare specs dir and check common.conf file |
123 |
SPECDIR="${TEMPDIR}/specs" |
124 |
if [[ -f "${SPECS}" ]]; then |
125 |
- mkdir "${SPECDIR}" |
126 |
- gtest continued $? 'Failed to create specs temporary subdirectory' |
127 |
+ gmkdir "${SPECDIR}" |
128 |
tar jx -f "${SPECS}" -C "${SPECDIR}" |
129 |
gtest continued $? 'Failed to unpack specs' |
130 |
elif [[ -d "${SPECS}" ]]; then |
131 |
@@ -158,7 +179,7 @@ |
132 |
gtest continued 1 "${SPECS} not found, provide a valid -e option" |
133 |
fi |
134 |
test -f "${SPECDIR}/common.conf" |
135 |
-gtest continued $? "Incorrect specdir: ${SPECDIR}/common.conf not |
136 |
found !" |
137 |
+gtest continued $? "Incorrect specdir: ${SPECDIR}/common.conf not |
138 |
found!" |
139 |
source "${SPECDIR}/common.conf" |
140 |
export CHOST |
141 |
export CFLAGS |
142 |
@@ -169,30 +190,16 @@ |
143 |
|
144 |
# catalyst.conf file |
145 |
test -f "${CATALYST_CONF}" |
146 |
-gtest continued $? "${CATALYST_CONF} file not found !" |
147 |
+gtest continued $? "${CATALYST_CONF} file not found!" |
148 |
source "${CATALYST_CONF}" |
149 |
|
150 |
-# Default targets is complete core build |
151 |
-if [[ "${ALLTARGET}" -eq 1 ]]; then |
152 |
- STAGE3=1 |
153 |
- LIVECD1=1 |
154 |
- LIVECD2=1 |
155 |
- TARBALL=1 |
156 |
- MODULES=1 |
157 |
- NEEDS_SNAPSHOT=1 |
158 |
-fi |
159 |
- |
160 |
# At least one target is needed |
161 |
test "${NOTARGET}" -eq 0 |
162 |
gtest continued $? \ |
163 |
'No target specified. You should provide at least one -t option.' |
164 |
|
165 |
-# CATALYST_DIR must exist |
166 |
-if [[ ! -d "${CATALYST_DIR}" ]]; then |
167 |
- mkdir "${CATALYST_DIR}" |
168 |
- gtest continued $? \ |
169 |
- "Error: failed to create ${CATALYST_DIR} directory." |
170 |
-fi |
171 |
+# storedir must exist |
172 |
+gmkdir "${storedir}" |
173 |
|
174 |
# Stage3 needs a seed stage |
175 |
if [[ "${STAGE3}" -eq 1 ]]; then |
176 |
@@ -211,17 +218,14 @@ |
177 |
test -f "${STAGE3FILE}" |
178 |
gtest continued $? "${STAGE3FILE} is not a valid stage3 tarball" |
179 |
fi |
180 |
-gtest 0 |
181 |
|
182 |
# If extensions and no stage3, warn that we'll use seedstage as stage3 |
183 |
-STAGE3LOC="${CATALYST_DIR}/builds/${RELTYPE}/stage3-${SUBARCH}-${STAMP}.tar.bz2" |
184 |
+STAGE3LOC="${storedir}/builds/${RELTYPE}/stage3-${SUBARCH}-${STAMP}.tar.bz2" |
185 |
if [[ "${MODULES}" -eq 1 || "${LIVECD1}" -eq 1 ]]; then |
186 |
if [[ "${STAGE3}" -ne 1 && ! -f "${STAGE3LOC}" ]]; then |
187 |
gwarn '"livecd-stage1" or "extensions" was selected without |
188 |
"stage3".' |
189 |
- gconfirm 'Should I use the seed stage as stage3 result ?' |
190 |
- if [[ ! -d "${CATALYST_DIR}/builds/${RELTYPE}" ]]; then |
191 |
- mkdir -p "${CATALYST_DIR}/builds/${RELTYPE}" |
192 |
- fi |
193 |
+ gconfirm 'Should I use the seed stage as stage3 result?' |
194 |
+ gmkdir "${storedir}/builds/${RELTYPE}" |
195 |
cp "${STAGE3FILE}" "${STAGE3LOC}" |
196 |
fi |
197 |
fi |
198 |
@@ -242,14 +246,12 @@ |
199 |
if [[ "${MODULES}" -eq 1 ]]; then |
200 |
TARGETLIST="${TARGETLIST}[extensions]" |
201 |
fi |
202 |
-gwarn 'The following targets will be called:' |
203 |
-gwarn "${TARGETLIST}" |
204 |
+ginfo 'The following targets will be called:' |
205 |
+ginfo "${TARGETLIST}" |
206 |
|
207 |
# Confirm tarball overwrite if TARBALL stage selected |
208 |
-if [[ "${TARBALL}" -eq 1 ]]; then |
209 |
- if [[ -e "gnap-${GNAPVERSION}-${STAMP}.tar" ]]; then |
210 |
- gconfirm "gnap-${GNAPVERSION}-${STAMP}.tar already exists, overwrite" |
211 |
- fi |
212 |
+if [[ "${TARBALL}" -eq 1 -a -e "gnap-${GNAPVERSION}-${STAMP}.tar" ]]; |
213 |
then |
214 |
+ gconfirm "gnap-${GNAPVERSION}-${STAMP}.tar already exists, overwrite" |
215 |
fi |
216 |
|
217 |
# Logfile setup and confirmation |
218 |
@@ -275,17 +277,14 @@ |
219 |
if [[ "${NEEDS_SNAPSHOT}" -eq 1 ]]; then |
220 |
gbegin 'Preparing portage snapshot' |
221 |
|
222 |
- if [[ ! -d "${CATALYST_DIR}/snapshots" ]]; then |
223 |
- mkdir -p "${CATALYST_DIR}/snapshots" |
224 |
- fi |
225 |
+ gmkdir "${storedir}/snapshots" |
226 |
|
227 |
if [[ -z "${PORTAGE_OVERLAYS}" ]]; then |
228 |
- cp "${SNAPSHOTFILE}" |
229 |
"${CATALYST_DIR}/snapshots/portage-${STAMP}.tar.bz2" |
230 |
+ cp "${SNAPSHOTFILE}" "${storedir}/snapshots/portage-${STAMP}.tar.bz2" |
231 |
gtest $? "Snapshot preparation failed, ${SEELOGFILES}" |
232 |
else |
233 |
TEMPPRTDIR="${TEMPDIR}/portage" |
234 |
- mkdir "${TEMPPRTDIR}" |
235 |
- gtest continued $? 'Failed to create portage temporary subdirectory' |
236 |
+ gmkdir "${TEMPPRTDIR}" |
237 |
|
238 |
tar jxf "${SNAPSHOTFILE}" -C "${TEMPPRTDIR}" \ |
239 |
>> "${GNAPLOGPREFIX}.out" 2>> "${GNAPLOGPREFIX}.err" |
240 |
@@ -295,7 +294,7 @@ |
241 |
gtest continued $? "Failed to copy ${overlay}" |
242 |
done |
243 |
|
244 |
- tar jcf "${CATALYST_DIR}/snapshots/portage-${STAMP}.tar.bz2" \ |
245 |
+ tar jcf "${storedir}/snapshots/portage-${STAMP}.tar.bz2" \ |
246 |
-C "${TEMPPRTDIR}" . \ |
247 |
>> "${GNAPLOGPREFIX}.out" 2>> "${GNAPLOGPREFIX}.err" |
248 |
gtest $? "Snapshot preparation failed, ${SEELOGFILES}" |
249 |
@@ -306,10 +305,8 @@ |
250 |
if [[ "${STAGE3}" -eq 1 ]]; then |
251 |
gbegin "${G}[stage3]${N} stage (base system build)" |
252 |
|
253 |
- if [[ ! -d "${CATALYST_DIR}/builds/${RELTYPE}" ]]; then |
254 |
- mkdir -p "${CATALYST_DIR}/builds/${RELTYPE}" |
255 |
- fi |
256 |
- cp "${STAGE3FILE}" |
257 |
"${CATALYST_DIR}/builds/${RELTYPE}/seedstage.tar.bz2" |
258 |
+ gmkdir "${storedir}/builds/${RELTYPE}" |
259 |
+ cp "${STAGE3FILE}" "${storedir}/builds/${RELTYPE}/seedstage.tar.bz2" |
260 |
|
261 |
TEMPCONF="${TEMPDIR}/stage3.conf" |
262 |
touch "${TEMPCONF}" |
263 |
@@ -328,7 +325,7 @@ |
264 |
$CATALYST_BIN -c "${CATALYST_CONF}" -f "${TEMPCONF}" \ |
265 |
>> "${GNAPLOGPREFIX}.out" 2>> "${GNAPLOGPREFIX}.err" |
266 |
gtest $? "[stage3] failed, ${SEELOGFILES}" |
267 |
- rm "${CATALYST_DIR}/builds/${RELTYPE}/seedstage.tar.bz2" |
268 |
+ rm "${storedir}/builds/${RELTYPE}/seedstage.tar.bz2" |
269 |
fi |
270 |
|
271 |
# LIVECD-STAGE1 phase |
272 |
@@ -389,16 +386,14 @@ |
273 |
gbegin "${G}[tarball]${N} phase (Creation of core and basefs |
274 |
components)" |
275 |
test -e "gnap-${GNAPVERSION}-${STAMP}.iso" |
276 |
gtest continued $? "No gnap-${GNAPVERSION}-${STAMP}.iso file to |
277 |
convert !" |
278 |
- test -d "${CATALYST_DIR}/tmp/gnap/livecd-stage1-${SUBARCH}-${STAMP}" |
279 |
+ test -d "${storedir}/tmp/gnap/livecd-stage1-${SUBARCH}-${STAMP}" |
280 |
gtest $? 'Missing livecd-stage2 results' |
281 |
|
282 |
gbegin ' Creating core component' |
283 |
TEMPMNTDIR="${TEMPDIR}/mount" |
284 |
- mkdir "${TEMPMNTDIR}" |
285 |
- gtest continued $? 'Failed to create mount temporary subdirectory' |
286 |
+ gmkdir "${TEMPMNTDIR}" |
287 |
TEMPISODIR="${TEMPDIR}/iso" |
288 |
- mkdir "${TEMPISODIR}" |
289 |
- gtest continued $? 'Failed to create iso temporary subdirectory' |
290 |
+ gmkdir "${TEMPISODIR}" |
291 |
|
292 |
mount -o loop "gnap-${GNAPVERSION}-${STAMP}.iso" ${TEMPMNTDIR} && \ |
293 |
cp -r ${TEMPMNTDIR}/* ${TEMPISODIR} |
294 |
@@ -419,14 +414,14 @@ |
295 |
|
296 |
gbegin ' Creating basefs component' |
297 |
tar jcf "gnap-basefs-${GNAPVERSION}-${STAMP}.tar.bz2" \ |
298 |
- -C "${CATALYST_DIR}/tmp/gnap/livecd-stage2-${SUBARCH}-${STAMP}" . |
299 |
+ -C "${storedir}/tmp/gnap/livecd-stage2-${SUBARCH}-${STAMP}" . |
300 |
gtest $? 'Unable to create basefs tarball' |
301 |
fi |
302 |
|
303 |
# EXTENSIONS phase |
304 |
if [[ "${MODULES}" -eq 1 ]]; then |
305 |
gbegin "${G}[extensions]${N} stage start" |
306 |
- GRP_PREFIX="${CATALYST_DIR}/builds/${RELTYPE}/grp-${SUBARCH}-${STAMP}" |
307 |
+ GRP_PREFIX="${storedir}/builds/${RELTYPE}/grp-${SUBARCH}-${STAMP}" |
308 |
SPECMODULE="${SPECDIR}/extensions.conf" |
309 |
mod_list=$(grep '^extensions:' "${SPECMODULE}" 2>/dev/null); |
310 |
mod_list="${mod_list/extensions:/}" |
311 |
@@ -460,12 +455,10 @@ |
312 |
|
313 |
$CATALYST_BIN -c "${CATALYST_CONF}" -f "${TEMPCONF}" \ |
314 |
>> "${GNAPLOGPREFIX}.out" 2>> "${GNAPLOGPREFIX}.err" |
315 |
- gtest continued $? \ |
316 |
- "Extension build failed, ${SEELOGFILES}" |
317 |
+ gtest continued $? "Extension build failed, ${SEELOGFILES}" |
318 |
|
319 |
TEMPMODULEDIR="${TEMPDIR}/module_${mod_name}" |
320 |
- mkdir "${TEMPMODULEDIR}" |
321 |
- gtest continued $? 'Failed to create module temporary subdirectory' |
322 |
+ gmkdir "${TEMPMODULEDIR}" |
323 |
for pkg in $( ls ${GRP_PREFIX}/${mod_name}/All/*.tbz2 ); do |
324 |
tar jxf $pkg -C "${TEMPMODULEDIR}" -p \ |
325 |
>> "${GNAPLOGPREFIX}.out" 2>> "${GNAPLOGPREFIX}.err" |
326 |
@@ -488,5 +481,5 @@ |
327 |
fi |
328 |
|
329 |
cleanup |
330 |
-echo 'Build successful !' |
331 |
+echo 'Build successful!' |
332 |
exit 0 |
333 |
diff -ur --exclude .svn --exclude upload.sh --exclude diff.sh |
334 |
gnap-2.0/src/specs/common.conf gnap-2.0+cleanup/src/specs/common.conf |
335 |
--- gnap-2.0/src/specs/common.conf 2007-07-23 14:14:39.000000000 +0300 |
336 |
+++ gnap-2.0+cleanup/src/specs/common.conf 2007-07-17 15:40:34.000000000 |
337 |
+0300 |
338 |
@@ -1,9 +1,3 @@ |
339 |
-# Catalyst executable and support files |
340 |
-CATALYST_NAME='catalyst' |
341 |
-CATALYST_BIN="/usr/bin/${CATALYST_NAME}" |
342 |
-CATALYST_CONF="/etc/${CATALYST_NAME}/${CATALYST_NAME}.conf" |
343 |
-CATALYST_DIR="/var/tmp/${CATALYST_NAME}" |
344 |
- |
345 |
# Profile and build flags to use |
346 |
SUBARCH="x86" |
347 |
PROFILE="uclibc/x86/hardened" |
348 |
diff -ur --exclude .svn --exclude upload.sh --exclude diff.sh |
349 |
gnap-2.0/tools/gnap_overlay gnap-2.0+cleanup/tools/gnap_overlay |
350 |
--- gnap-2.0/tools/gnap_overlay 2007-07-23 14:14:39.000000000 +0300 |
351 |
+++ gnap-2.0+cleanup/tools/gnap_overlay 2007-08-02 15:56:18.000000000 |
352 |
+0300 |
353 |
@@ -3,8 +3,9 @@ |
354 |
|
355 |
GNAPNAME=$(basename "$0") |
356 |
echo "GNAP overlay tool ${GNAPNAME} ${VERSION}" |
357 |
-GNAPCORE='/usr/lib/gnap/gnap-core.tar' |
358 |
-GNAPMBR='/usr/lib/gnap/mbr/mbr.bin' |
359 |
+GNAPLIBDIR='/usr/lib/gnap' |
360 |
+GNAPCORE="${GNAPLIBDIR}/gnap-core.tar" |
361 |
+GNAPMBR="${GNAPLIBDIR}/mbr/mbr.bin" |
362 |
TEMPDIR='' |
363 |
IMG_SIZE=15 |
364 |
|
365 |
@@ -24,6 +25,11 @@ |
366 |
echo -e " ${G}*${N} ${*}" |
367 |
} |
368 |
|
369 |
+gmkdir() { |
370 |
+ mkdir -p "$1" |
371 |
+ gtest continued $? "Failed to create directory \"$1\"." |
372 |
+} |
373 |
+ |
374 |
gconfirm() { |
375 |
if [[ "${FORCEYES}" -eq 1 ]]; then |
376 |
gwarn "${*} forced to yes" |
377 |
@@ -33,7 +39,7 @@ |
378 |
if [[ -n "${TEMPDIR}" || -n "${LOOP}" ]]; then |
379 |
cleanup |
380 |
fi |
381 |
- echo 'Overlay aborted !' |
382 |
+ echo 'Overlay aborted!' |
383 |
exit 2 |
384 |
fi |
385 |
fi |
386 |
@@ -98,7 +104,7 @@ |
387 |
echo ' -S size Size of image file in megabyte' |
388 |
echo ' The disk target options also apply, except -d.' |
389 |
echo |
390 |
- echo "Please man ${GNAPNAME} for more details." |
391 |
+ echo "Please use man ${GNAPNAME} for more details." |
392 |
} |
393 |
|
394 |
cleanup() { |
395 |
@@ -126,8 +132,17 @@ |
396 |
gbegin 'Checking parameters' |
397 |
|
398 |
# Read options |
399 |
-while getopts ':hg:o:c:nfi:d:l:r:ms:S:L:' options; do |
400 |
- case ${options} in |
401 |
+NOLOGO=0 |
402 |
+FORCEYES=0 |
403 |
+OUTPUT='' |
404 |
+TYPE='' |
405 |
+CREATE='n' |
406 |
+TARGETROOT='' |
407 |
+CACHE='' |
408 |
+SERIAL='' |
409 |
+BAUDRATE='' |
410 |
+while getopts ':hg:o:c:nfi:d:l:r:ms:S:L:' option; do |
411 |
+ case ${option} in |
412 |
h ) usage |
413 |
exit 0;; |
414 |
g ) GNAPCORE="${OPTARG}";; |
415 |
@@ -150,7 +165,7 @@ |
416 |
m ) CACHE='docache ';; |
417 |
s ) SERIAL="console=ttyS0,${OPTARG}n81" |
418 |
BAUDRATE="${OPTARG}";; |
419 |
- * ) gtest 1 'Specified options are incomplete or unknown !';; |
420 |
+ * ) gtest 1 'Specified options are incomplete or unknown!';; |
421 |
esac |
422 |
done |
423 |
|
424 |
@@ -192,7 +207,7 @@ |
425 |
gwarn "${W}dd if=${GNAPMBR} of=${PARENTDEV} bs=512 count=1${N} if |
426 |
needed" |
427 |
gwarn "${OUTPUT} must contain an active partition:" |
428 |
gwarn " use ${W}fdisk ${PARENTDEV}${N} if needed" |
429 |
- gwarn "Current data on ${OUTPUT} will be ${B}destroyed${N} !" |
430 |
+ gwarn "Current data on ${OUTPUT} will be ${B}destroyed${N}!" |
431 |
gconfirm 'Are you sure you want to continue ?' |
432 |
fi |
433 |
|
434 |
@@ -201,20 +216,18 @@ |
435 |
TEMPDIR=$(mktemp -d -t gnap_overlay.XXXXXX) |
436 |
gtest continued $? 'Failed to create temporary directory' |
437 |
TEMPCOREDIR="${TEMPDIR}/core" |
438 |
-mkdir "${TEMPCOREDIR}" |
439 |
-gtest continued $? 'Failed to create core temporary subdirectory' |
440 |
+gmkdir "${TEMPCOREDIR}" |
441 |
tar x -C "${TEMPCOREDIR}" -f "${GNAPCORE}" |
442 |
gtest $? 'Failed to extract core' |
443 |
|
444 |
gbegin 'Preparing overlay' |
445 |
TEMPOVERDIR="${TEMPDIR}/overlay" |
446 |
-mkdir "${TEMPOVERDIR}" |
447 |
-gtest $? 'Failed to create overlay temporary subdirectory' |
448 |
+gmkdir "${TEMPOVERDIR}" |
449 |
|
450 |
if [[ -n "${BAUDRATE}" ]]; then |
451 |
gbegin 'Adding baudrate for serial console' |
452 |
- mkdir -p "${TEMPOVERDIR}/etc/gnap" && \ |
453 |
- echo -n "${BAUDRATE}" > "${TEMPOVERDIR}/etc/gnap/baudrate" |
454 |
+ gmkdir "${TEMPOVERDIR}/etc/gnap" |
455 |
+ echo -n "${BAUDRATE}" > "${TEMPOVERDIR}/etc/gnap/baudrate" |
456 |
gtest $? 'Failed to create /etc/gnap/baudrate' |
457 |
fi |
458 |
for overlay in ${OVERLAYS} ; do |
459 |
@@ -231,8 +244,7 @@ |
460 |
if [[ -n "${OVERLAYCONF}" ]]; then |
461 |
gbegin "Adding ${OVERLAYCONF} (overlay.conf file)" |
462 |
if [[ ! -d "${TEMPOVERDIR}/etc" ]]; then |
463 |
- mkdir "${TEMPOVERDIR}/etc" |
464 |
- gtest continued $? 'Failed to create /etc overlay directory' |
465 |
+ gmkdir "${TEMPOVERDIR}/etc" |
466 |
fi |
467 |
cp "${OVERLAYCONF}" "${TEMPOVERDIR}/etc/overlay.conf" |
468 |
gtest $? "Failed to copy ${OVERLAYCONF}" |
469 |
@@ -256,7 +268,7 @@ |
470 |
# Target specific actions |
471 |
if [[ "${TYPE}" == 'iso' ]]; then |
472 |
if [[ -f "${OUTPUT}" ]]; then |
473 |
- gconfirm "File ${OUTPUT} already exists, overwrite ?" |
474 |
+ gconfirm "File ${OUTPUT} already exists, overwrite?" |
475 |
fi |
476 |
rm "${TEMPCOREDIR}/syslinux.cfg" |
477 |
gbegin "Building ${OUTPUT} ISO file" |
478 |
@@ -285,7 +297,7 @@ |
479 |
|
480 |
if [[ "${CREATE}" == y ]]; then |
481 |
if [[ -f "${OUTPUT}" ]]; then |
482 |
- gconfirm "File ${OUTPUT} already exists, overwrite ?" |
483 |
+ gconfirm "File ${OUTPUT} already exists, overwrite?" |
484 |
fi |
485 |
|
486 |
gbegin 'Creating image file' |
487 |
@@ -328,8 +340,7 @@ |
488 |
|
489 |
gbegin "Mounting ${OUTPUT}" |
490 |
TEMPMOUNTDIR="${TEMPDIR}/mount" |
491 |
- mkdir "${TEMPMOUNTDIR}" |
492 |
- gtest continued $? 'Failed to create mount temporary subdirectory' |
493 |
+ gmkdir "${TEMPMOUNTDIR}" |
494 |
mount -t msdos "${OUTPUT}" "${TEMPMOUNTDIR}" |
495 |
gtest $? |
496 |
|
497 |
@@ -375,5 +386,5 @@ |
498 |
|
499 |
# Successful finish |
500 |
cleanup |
501 |
-echo 'Overlay successful !' |
502 |
+echo 'Overlay successful!' |
503 |
exit 0 |
504 |
diff -ur --exclude .svn --exclude upload.sh --exclude diff.sh |
505 |
gnap-2.0/tools/gnap_remaster gnap-2.0+cleanup/tools/gnap_remaster |
506 |
--- gnap-2.0/tools/gnap_remaster 2007-07-23 14:14:39.000000000 +0300 |
507 |
+++ gnap-2.0+cleanup/tools/gnap_remaster 2007-08-02 15:56:39.000000000 |
508 |
+0300 |
509 |
@@ -3,11 +3,12 @@ |
510 |
|
511 |
GNAPNAME=$(basename "$0") |
512 |
echo "GNAP remastering tool ${GNAPNAME} ${VERSION}" |
513 |
-GNAPCORE='/usr/lib/gnap/gnap-core.tar' |
514 |
-GNAPBASEFS='/usr/lib/gnap/gnap-basefs.tar.bz2' |
515 |
-GNAPEXTDIR='/usr/lib/gnap/extensions' |
516 |
-OUTPUT='mygnap-core.tar' |
517 |
+GNAPLIBDIR='/usr/lib/gnap' |
518 |
+GNAPEXTDIR="${GNAPLIBDIR}/extensions" |
519 |
TEMPDIR='' |
520 |
+GNAPCORE="${GNAPLIBDIR}/gnap-core.tar" |
521 |
+GNAPBASEFS="${GNAPLIBDIR}/gnap-basefs.tar.bz2" |
522 |
+OUTPUT='mygnap-core.tar' |
523 |
|
524 |
G=$'\e[32;01m' |
525 |
B=$'\e[31;01m' |
526 |
@@ -21,6 +22,11 @@ |
527 |
echo -e " ${W}*${N} ${*}" |
528 |
} |
529 |
|
530 |
+gmkdir() { |
531 |
+ mkdir -p "$1" |
532 |
+ gtest continued $? "Failed to create directory \"$1\"." |
533 |
+} |
534 |
+ |
535 |
gconfirm() { |
536 |
if [[ "${FORCEYES}" -eq 1 ]]; then |
537 |
gwarn "${*} forced to yes" |
538 |
@@ -30,7 +36,7 @@ |
539 |
if [[ -n "${TEMPDIR}" ]]; then |
540 |
cleanup |
541 |
fi |
542 |
- echo 'Remaster aborted !' |
543 |
+ echo 'Remaster aborted!' |
544 |
exit 2 |
545 |
fi |
546 |
fi |
547 |
@@ -79,9 +85,9 @@ |
548 |
echo ' -g gnap_core Original GNAP core file' |
549 |
echo ' -b basefs basefs.tar.bz2 file to use as base' |
550 |
echo ' -d extdir Directory where to find extensions' |
551 |
- echo ' -f Force all answers to yes (dangerous !)' |
552 |
+ echo ' -f Force all answers to yes (dangerous!)' |
553 |
echo |
554 |
- echo "Please man ${GNAPNAME} for more details." |
555 |
+ echo "Please use man ${GNAPNAME} for more details." |
556 |
} |
557 |
|
558 |
cleanup() { |
559 |
@@ -104,8 +110,14 @@ |
560 |
gbegin 'Checking parameters' |
561 |
|
562 |
# Read options |
563 |
-while getopts ':he:k:m:o:g:b:d:f' options; do |
564 |
- case ${options} in |
565 |
+EXTENSIONS='' |
566 |
+KERNEXT='' |
567 |
+MODEXT='' |
568 |
+GNAPBASEFS='' |
569 |
+GNAPEXTDIR='' |
570 |
+FORCEYES=0 |
571 |
+while getopts ':he:k:m:o:g:b:d:f' option; do |
572 |
+ case ${option} in |
573 |
h ) usage |
574 |
exit 0;; |
575 |
e ) EXTENSIONS="${EXTENSIONS} ${OPTARG}";; |
576 |
@@ -116,7 +128,7 @@ |
577 |
b ) GNAPBASEFS="${OPTARG}";; |
578 |
d ) GNAPEXTDIR="${OPTARG}";; |
579 |
f ) FORCEYES=1;; |
580 |
- * ) gtest 1 'Specified options are incomplete or unknown !';; |
581 |
+ * ) gtest 1 'Specified options are incomplete or unknown!';; |
582 |
esac |
583 |
done |
584 |
|
585 |
@@ -146,8 +158,7 @@ |
586 |
TEMPDIR=$(mktemp -d -t gnap_remaster.XXXXXX) |
587 |
gtest continued $? 'Failed to create temporary directory' |
588 |
TEMPOVERDIR="${TEMPDIR}/basefs" |
589 |
-mkdir "${TEMPOVERDIR}" |
590 |
-gtest continued $? 'Failed to create basefs temporary subdirectory' |
591 |
+gmkdir "${TEMPOVERDIR}" |
592 |
|
593 |
tar jx -C "${TEMPOVERDIR}" -f "${GNAPBASEFS}" |
594 |
gtest $? 'Failed to unpack basefs' |
595 |
@@ -163,8 +174,7 @@ |
596 |
# Preparing new core |
597 |
gbegin 'Extracting core tarball' |
598 |
TEMPCOREDIR="${TEMPDIR}/core" |
599 |
-mkdir "${TEMPCOREDIR}" |
600 |
-gtest continued $? 'Failed to create core temporary subdirectory' |
601 |
+gmkdir "${TEMPCOREDIR}" |
602 |
|
603 |
tar x -C "${TEMPCOREDIR}" -f "${GNAPCORE}" --exclude image.squashfs |
604 |
gtest $? 'Failed to extract core' |
605 |
@@ -172,8 +182,7 @@ |
606 |
if [[ -f "${KERNEXT}" ]]; then |
607 |
gbegin "Replacing kernel and initrd using ${KERNEXT}" |
608 |
TEMPKERNDIR="${TEMPDIR}/kernel" |
609 |
- mkdir "${TEMPKERNDIR}" |
610 |
- gtest continued $? 'Failed to create kernel temporary subdirectory' |
611 |
+ gmkdir "${TEMPKERNDIR}" |
612 |
|
613 |
tar jx -C "${TEMPKERNDIR}" -f "${KERNEXT}" |
614 |
gtest continued $? 'Failed to extract kernpackage' |
615 |
@@ -205,6 +214,6 @@ |
616 |
|
617 |
# Successful finish |
618 |
cleanup |
619 |
-echo 'Remaster successful !' |
620 |
+echo 'Remaster successful!' |
621 |
exit 0 |
622 |
|
623 |
diff -ur --exclude .svn --exclude upload.sh --exclude diff.sh |
624 |
gnap-2.0/tools/packlister.pl gnap-2.0+cleanup/tools/packlister.pl |
625 |
--- gnap-2.0/tools/packlister.pl 2007-07-23 14:14:39.000000000 +0300 |
626 |
+++ gnap-2.0+cleanup/tools/packlister.pl 2007-07-09 21:10:18.000000000 |
627 |
+0300 |
628 |
@@ -1,49 +1,77 @@ |
629 |
-sub dump |
630 |
+#! /usr/bin/perl |
631 |
+# |
632 |
+# packlister.pl prints out the given version number and a list of |
633 |
+# packages found in the corresponding catalyst package cache and |
634 |
+# grp cache. |
635 |
+# |
636 |
+# Usage: packlister.pl <version> |
637 |
+# packlister.pl <version> | reducedsnapshot.pl |
638 |
+# packlister.pl <version> > packlisterfile |
639 |
+ |
640 |
+sub find_and_dump |
641 |
{ |
642 |
- while (<FIND>) |
643 |
- { |
644 |
- if (/^(\d+)\s+(.+)\/(.+)\/(.+)$/) |
645 |
- { |
646 |
- $size = $1; |
647 |
- $cstage = $2; |
648 |
- $cat = $3; |
649 |
- $name = $4; |
650 |
- if ($cstage =~ /.*\/(.+)-x86-.+/) |
651 |
+ if (scalar @_ == 0) |
652 |
{ |
653 |
- $stage=$1; |
654 |
+ return; |
655 |
} |
656 |
- else |
657 |
+ |
658 |
+ open (FIND, "find $_ -name '*.tbz2' -exec ls -Ls {} \\; | " |
659 |
+ . "grep -v '/All/' |"); |
660 |
+ |
661 |
+ while (<FIND>) |
662 |
{ |
663 |
- print STDERR "ERROR ($cstage)\n"; |
664 |
+ if (/^(\d+)\s+(.+)\/([A-Za-z0-9+_]+[A-Za-z0-9+_.-]*)\/(.+)$/) |
665 |
+ { |
666 |
+ $size = $1; |
667 |
+ $cstage = $2; |
668 |
+ $cat = $3; |
669 |
+ $name = $4; |
670 |
+ |
671 |
+ # There might be more than x86 supported in future versions. |
672 |
+ if ($cstage =~ /.*\/(.+)-x86-.+/) |
673 |
+ { |
674 |
+ $stage=$1; |
675 |
+ } |
676 |
+ else |
677 |
+ { |
678 |
+ print STDERR "ERROR ($cstage)\n"; |
679 |
+ } |
680 |
+ |
681 |
+ # FIXME: The second regex (elsif) seems to match the stuff |
682 |
+ # the first one also matches. Is this needed? |
683 |
+ if ($name =~ /^(.+)-(.+-r\d+)\.tbz2/) |
684 |
+ { |
685 |
+ $packages{"$cat/$1"} = "$2 - $size Kb - $stage"; |
686 |
+ } |
687 |
+ elsif ($name =~ /^(.+)-(.+)\.tbz2/) |
688 |
+ { |
689 |
+ $packages{"$cat/$1"} = "$2 - $size Kb - $stage"; |
690 |
+ } |
691 |
+ else |
692 |
+ { |
693 |
+ print STDERR "ERROR ($name)\n" |
694 |
+ } |
695 |
+ } |
696 |
+ else |
697 |
+ { |
698 |
+ print STDERR "ERROR : $_"; |
699 |
+ } |
700 |
} |
701 |
- if ($name =~ /^(.+)-(.+-r\d+)\.tbz2/) |
702 |
- { |
703 |
- $packages{"$cat/$1"} = "$2 - $size Kb - $stage"; |
704 |
- } |
705 |
- elsif ($name =~ /^(.+)-(.+)\.tbz2/) |
706 |
- { |
707 |
- $packages{"$cat/$1"} = "$2 - $size Kb - $stage"; |
708 |
- } |
709 |
- else |
710 |
- { |
711 |
- print STDERR "ERROR ($name)\n" |
712 |
- } |
713 |
- } |
714 |
- else |
715 |
- { |
716 |
- print STDERR "ERROR : $_"; |
717 |
- } |
718 |
- } |
719 |
+ |
720 |
+ close (FIND); |
721 |
+} |
722 |
+ |
723 |
+# Check script parameters |
724 |
+if (scalar @ARGV == 0) |
725 |
+{ |
726 |
+ die "Usage: $ENV{_} <version>\n"; |
727 |
} |
728 |
+ |
729 |
+# Print version and file list based on catalyst |
730 |
print "$ARGV[0]\n"; |
731 |
-$loc = "/var/tmp/catalyst/packages/gnap/*$ARGV[0]"; |
732 |
-open (FIND,"find $loc -name '*.tbz2' -exec ls -Ls {} \\; | grep -v |
733 |
'/All/' |"); |
734 |
-&dump(); |
735 |
-close FIND; |
736 |
-$loc = "/var/tmp/catalyst/builds/gnap/grp*$ARGV[0]/*"; |
737 |
-open (FIND,"find $loc -name '*.tbz2' -exec ls -Ls {} \\; | grep -v |
738 |
'/All/' |"); |
739 |
-&dump(); |
740 |
-close FIND; |
741 |
+&find_and_dump("/var/tmp/catalyst/packages/gnap/*$ARGV[0]"); |
742 |
+&find_and_dump("/var/tmp/catalyst/packages/gnap/grp*$ARGV[0]/*"); |
743 |
+ |
744 |
#No need to grab for kernel sources as they are found in the /ALL/ |
745 |
directory |
746 |
#$kernel=`grep sys-kernel gnap_make-$ARGV[0].out | grep merged | grep |
747 |
sources`; |
748 |
#if ($kernel =~ /(sys-kernel\/.*-sources)-(.*) merged/) |
749 |
@@ -54,11 +82,13 @@ |
750 |
#{ |
751 |
# print STDERR "Kernel not found: $kernel\n"; |
752 |
#} |
753 |
+ |
754 |
foreach $key (sort(keys(%packages))) |
755 |
{ |
756 |
- print STDOUT "$key $packages{$key}\n"; |
757 |
+ print STDOUT "$key $packages{$key}\n"; |
758 |
} |
759 |
- #Groff is part of the stage3 tarball but not remerged so we have to |
760 |
add it manually |
761 |
- print STDOUT "sys-apps/groff 1.19.2-r1 - 116 Kb - stage3\n"; |
762 |
- #htbinit is merged with kernel sources and somehow missed by the |
763 |
script |
764 |
- print STDOUT "net-misc/htbinit 0.8.5-r1 - 116 Kb - livecd-stage2\n"; |
765 |
+ |
766 |
+#Groff is part of the stage3 tarball but not remerged so we have to add |
767 |
it manually |
768 |
+print STDOUT "sys-apps/groff 1.19.2-r1 - 116 Kb - stage3\n"; |
769 |
+#htbinit is merged with kernel sources and somehow missed by the script |
770 |
+print STDOUT "net-misc/htbinit 0.8.5-r1 - 116 Kb - livecd-stage2\n"; |
771 |
diff -ur --exclude .svn --exclude upload.sh --exclude diff.sh |
772 |
gnap-2.0/tools/reducedsnapshot.pl gnap-2.0 |
773 |
+cleanup/tools/reducedsnapshot.pl |
774 |
--- gnap-2.0/tools/reducedsnapshot.pl 2007-07-23 14:14:39.000000000 |
775 |
+0300 |
776 |
+++ gnap-2.0+cleanup/tools/reducedsnapshot.pl 2007-07-23 |
777 |
14:16:49.000000000 +0300 |
778 |
@@ -1,3 +1,13 @@ |
779 |
+#! /usr/bin/perl |
780 |
+# |
781 |
+# resucedsnapshot.pl creates a reduced portage snapshot based on a |
782 |
+# dfault set (eclasses, profiles) and a packagelist created by |
783 |
+# packlister.pl. |
784 |
+# |
785 |
+# Usage: packlister.pl <version> | reducedsnapshot.pl |
786 |
+# reducedsnapshot.pl packlisterfile |
787 |
+# reducedsnapshot.pl < packlisterfile |
788 |
+ |
789 |
@minportage = ( |
790 |
"portage/eclass", |
791 |
"portage/profiles/arch.list", |
792 |
@@ -14,19 +24,21 @@ |
793 |
"portage/profiles/uclibc", |
794 |
"portage/profiles/updates", |
795 |
"portage/profiles/use.desc", |
796 |
- "portage/profiles/use.local.desc"); |
797 |
+ "portage/profiles/use.local.desc" |
798 |
+); |
799 |
+ |
800 |
print "Building package list...\n"; |
801 |
$version = <>; |
802 |
chop $version; |
803 |
while (<>) |
804 |
{ |
805 |
- ($pack,$ver,,,,)=split; |
806 |
- push (@minportage,"portage/$pack"); |
807 |
- push (@minportage,"portage/metadata/cache/$pack-$ver"); |
808 |
+ ($pack,$ver,,,,) = split; |
809 |
+ push (@minportage, "portage/$pack"); |
810 |
+ push (@minportage, "portage/metadata/cache/$pack-$ver"); |
811 |
} |
812 |
+ |
813 |
print "Extracting portage...\n"; |
814 |
system "mkdir tmp_port"; |
815 |
- |
816 |
system "tar jx -C tmp_port |
817 |
-f /var/tmp/catalyst/snapshots/portage-$version.tar.bz2"; |
818 |
print "Creating reduced portage snapshot...\n"; |
819 |
system "tar jc -C tmp_port -f redportage-$version.tar.bz2 @minportage"; |
820 |
|
821 |
-- |
822 |
gnap-dev@g.o mailing list |