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