From: Philipp Riegger <lists@anderedomain.de>
To: gnap-dev@lists.gentoo.org
Subject: [gnap-dev] [PATCH 1/4] GNAP cleanup
Date: Fri, 03 Aug 2007 16:26:58 +0300 [thread overview]
Message-ID: <1186147618.10651.24.camel@b136a> (raw)
In-Reply-To: <1186146995.10651.18.camel@b136a>
This patch does some cleanup work:
- ginfo was available and used in only one of the gnap_* scripts. Add
it to the other scripts where it might be needed and use it.
- mkdir -p ... \n gtest ... was used very often. I put this in a
function, the error messages are now more detailed (no "kernel temp dir
could not be created", but "/some/very/important/path could not be
created".
- removed ALLTARGET in gnap_make.
- used storedir from catalyst.conf instead of CATALYST_DIR.
- some more stuff, which should be obvious.
If there are any questions, just ask.
Philipp
diff -ur --exclude .svn --exclude upload.sh --exclude diff.sh
gnap-2.0/src/gnap_make gnap-2.0+cleanup/src/gnap_make
--- gnap-2.0/src/gnap_make 2007-07-23 14:14:40.000000000 +0300
+++ gnap-2.0+cleanup/src/gnap_make 2007-08-02 15:55:38.000000000 +0300
@@ -21,6 +21,15 @@
echo -e " ${W}*${N} ${*}"
}
+ginfo() {
+ echo -e " ${G}*${N} ${*}"
+}
+
+gmkdir() {
+ mkdir -p "$1"
+ gtest continued $? "Failed to create directory \"$1\"."
+}
+
gconfirm() {
if [[ "${FORCEYES}" -eq 1 ]]; then
gwarn "${*} forced to yes"
@@ -30,7 +39,7 @@
if [[ -n "${TEMPDIR}" ]]; then
cleanup
fi
- echo Build aborted !
+ echo Build aborted!
exit 2
fi
fi
@@ -77,7 +86,7 @@
echo ' -c catalyst.conf Use specific catalyst.conf file'
echo ' -e specs Specs directory or tar.bz2 file'
echo
- echo "Please man ${GNAPNAME} for more details."
+ echo "Please use man ${GNAPNAME} for more details."
}
cleanup() {
@@ -92,19 +101,24 @@
fi
}
-if [[ "$#" -eq 0 || "${1}" == '-h' ]]; then
+if [[ "$#" -eq 0 ]]; then
usage
exit 0
fi
gbegin 'Checking parameters'
+# Catalyst executable and config file
+CATALYST_BIN="/usr/bin/catayst"
+CATALYST_CONF="/etc/catalyst/catalyst.conf"
+
# Read options
NOTARGET=1
STAMP=$(date +%Y%m%d)
-while getopts ':hs:p:m:o:v:t:fl:c:e:' options; do
- case ${options} in
- h ) usage
+while getopts ':hs:p:m:o:v:t:fl:c:e:' option; do
+ case ${option} in
+ h )
+ usage
exit 0;;
s ) STAGE3FILE="${OPTARG}";;
p ) SNAPSHOTFILE="${OPTARG}";;
@@ -112,7 +126,13 @@
v ) STAMP="${OPTARG}";;
t )
case "${OPTARG}" in
- all ) ALLTARGET=1;;
+ all )
+ STAGE3=1
+ LIVECD1=1
+ LIVECD2=1
+ TARBALL=1
+ MODULES=1
+ NEEDS_SNAPSHOT=1;;
stage3 )
STAGE3=1
NEEDS_SNAPSHOT=1;;
@@ -122,17 +142,19 @@
livecd-stage2 )
LIVECD2=1
NEEDS_SNAPSHOT=1;;
- tarball ) TARBALL=1;;
+ tarball )
+ TARBALL=1;;
extensions )
MODULES=1
NEEDS_SNAPSHOT=1;;
+ * ) gtest 1 'Specified stage is unknown!';;
esac
NOTARGET=0;;
f ) FORCEYES=1;;
l ) GNAPLOGPREFIX="${OPTARG}";;
c ) CATALYST_CONF="${OPTARG}";;
e ) SPECS="${OPTARG}";;
- * ) gtest 1 'Specified options are incomplete or unknown !';;
+ * ) gtest 1 'Specified options are incomplete or unknown!';;
esac
done
@@ -147,8 +169,7 @@
# Prepare specs dir and check common.conf file
SPECDIR="${TEMPDIR}/specs"
if [[ -f "${SPECS}" ]]; then
- mkdir "${SPECDIR}"
- gtest continued $? 'Failed to create specs temporary subdirectory'
+ gmkdir "${SPECDIR}"
tar jx -f "${SPECS}" -C "${SPECDIR}"
gtest continued $? 'Failed to unpack specs'
elif [[ -d "${SPECS}" ]]; then
@@ -158,7 +179,7 @@
gtest continued 1 "${SPECS} not found, provide a valid -e option"
fi
test -f "${SPECDIR}/common.conf"
-gtest continued $? "Incorrect specdir: ${SPECDIR}/common.conf not
found !"
+gtest continued $? "Incorrect specdir: ${SPECDIR}/common.conf not
found!"
source "${SPECDIR}/common.conf"
export CHOST
export CFLAGS
@@ -169,30 +190,16 @@
# catalyst.conf file
test -f "${CATALYST_CONF}"
-gtest continued $? "${CATALYST_CONF} file not found !"
+gtest continued $? "${CATALYST_CONF} file not found!"
source "${CATALYST_CONF}"
-# Default targets is complete core build
-if [[ "${ALLTARGET}" -eq 1 ]]; then
- STAGE3=1
- LIVECD1=1
- LIVECD2=1
- TARBALL=1
- MODULES=1
- NEEDS_SNAPSHOT=1
-fi
-
# At least one target is needed
test "${NOTARGET}" -eq 0
gtest continued $? \
'No target specified. You should provide at least one -t option.'
-# CATALYST_DIR must exist
-if [[ ! -d "${CATALYST_DIR}" ]]; then
- mkdir "${CATALYST_DIR}"
- gtest continued $? \
- "Error: failed to create ${CATALYST_DIR} directory."
-fi
+# storedir must exist
+gmkdir "${storedir}"
# Stage3 needs a seed stage
if [[ "${STAGE3}" -eq 1 ]]; then
@@ -211,17 +218,14 @@
test -f "${STAGE3FILE}"
gtest continued $? "${STAGE3FILE} is not a valid stage3 tarball"
fi
-gtest 0
# If extensions and no stage3, warn that we'll use seedstage as stage3
-STAGE3LOC="${CATALYST_DIR}/builds/${RELTYPE}/stage3-${SUBARCH}-${STAMP}.tar.bz2"
+STAGE3LOC="${storedir}/builds/${RELTYPE}/stage3-${SUBARCH}-${STAMP}.tar.bz2"
if [[ "${MODULES}" -eq 1 || "${LIVECD1}" -eq 1 ]]; then
if [[ "${STAGE3}" -ne 1 && ! -f "${STAGE3LOC}" ]]; then
gwarn '"livecd-stage1" or "extensions" was selected without
"stage3".'
- gconfirm 'Should I use the seed stage as stage3 result ?'
- if [[ ! -d "${CATALYST_DIR}/builds/${RELTYPE}" ]]; then
- mkdir -p "${CATALYST_DIR}/builds/${RELTYPE}"
- fi
+ gconfirm 'Should I use the seed stage as stage3 result?'
+ gmkdir "${storedir}/builds/${RELTYPE}"
cp "${STAGE3FILE}" "${STAGE3LOC}"
fi
fi
@@ -242,14 +246,12 @@
if [[ "${MODULES}" -eq 1 ]]; then
TARGETLIST="${TARGETLIST}[extensions]"
fi
-gwarn 'The following targets will be called:'
-gwarn "${TARGETLIST}"
+ginfo 'The following targets will be called:'
+ginfo "${TARGETLIST}"
# Confirm tarball overwrite if TARBALL stage selected
-if [[ "${TARBALL}" -eq 1 ]]; then
- if [[ -e "gnap-${GNAPVERSION}-${STAMP}.tar" ]]; then
- gconfirm "gnap-${GNAPVERSION}-${STAMP}.tar already exists, overwrite"
- fi
+if [[ "${TARBALL}" -eq 1 -a -e "gnap-${GNAPVERSION}-${STAMP}.tar" ]];
then
+ gconfirm "gnap-${GNAPVERSION}-${STAMP}.tar already exists, overwrite"
fi
# Logfile setup and confirmation
@@ -275,17 +277,14 @@
if [[ "${NEEDS_SNAPSHOT}" -eq 1 ]]; then
gbegin 'Preparing portage snapshot'
- if [[ ! -d "${CATALYST_DIR}/snapshots" ]]; then
- mkdir -p "${CATALYST_DIR}/snapshots"
- fi
+ gmkdir "${storedir}/snapshots"
if [[ -z "${PORTAGE_OVERLAYS}" ]]; then
- cp "${SNAPSHOTFILE}"
"${CATALYST_DIR}/snapshots/portage-${STAMP}.tar.bz2"
+ cp "${SNAPSHOTFILE}" "${storedir}/snapshots/portage-${STAMP}.tar.bz2"
gtest $? "Snapshot preparation failed, ${SEELOGFILES}"
else
TEMPPRTDIR="${TEMPDIR}/portage"
- mkdir "${TEMPPRTDIR}"
- gtest continued $? 'Failed to create portage temporary subdirectory'
+ gmkdir "${TEMPPRTDIR}"
tar jxf "${SNAPSHOTFILE}" -C "${TEMPPRTDIR}" \
>> "${GNAPLOGPREFIX}.out" 2>> "${GNAPLOGPREFIX}.err"
@@ -295,7 +294,7 @@
gtest continued $? "Failed to copy ${overlay}"
done
- tar jcf "${CATALYST_DIR}/snapshots/portage-${STAMP}.tar.bz2" \
+ tar jcf "${storedir}/snapshots/portage-${STAMP}.tar.bz2" \
-C "${TEMPPRTDIR}" . \
>> "${GNAPLOGPREFIX}.out" 2>> "${GNAPLOGPREFIX}.err"
gtest $? "Snapshot preparation failed, ${SEELOGFILES}"
@@ -306,10 +305,8 @@
if [[ "${STAGE3}" -eq 1 ]]; then
gbegin "${G}[stage3]${N} stage (base system build)"
- if [[ ! -d "${CATALYST_DIR}/builds/${RELTYPE}" ]]; then
- mkdir -p "${CATALYST_DIR}/builds/${RELTYPE}"
- fi
- cp "${STAGE3FILE}"
"${CATALYST_DIR}/builds/${RELTYPE}/seedstage.tar.bz2"
+ gmkdir "${storedir}/builds/${RELTYPE}"
+ cp "${STAGE3FILE}" "${storedir}/builds/${RELTYPE}/seedstage.tar.bz2"
TEMPCONF="${TEMPDIR}/stage3.conf"
touch "${TEMPCONF}"
@@ -328,7 +325,7 @@
$CATALYST_BIN -c "${CATALYST_CONF}" -f "${TEMPCONF}" \
>> "${GNAPLOGPREFIX}.out" 2>> "${GNAPLOGPREFIX}.err"
gtest $? "[stage3] failed, ${SEELOGFILES}"
- rm "${CATALYST_DIR}/builds/${RELTYPE}/seedstage.tar.bz2"
+ rm "${storedir}/builds/${RELTYPE}/seedstage.tar.bz2"
fi
# LIVECD-STAGE1 phase
@@ -389,16 +386,14 @@
gbegin "${G}[tarball]${N} phase (Creation of core and basefs
components)"
test -e "gnap-${GNAPVERSION}-${STAMP}.iso"
gtest continued $? "No gnap-${GNAPVERSION}-${STAMP}.iso file to
convert !"
- test -d "${CATALYST_DIR}/tmp/gnap/livecd-stage1-${SUBARCH}-${STAMP}"
+ test -d "${storedir}/tmp/gnap/livecd-stage1-${SUBARCH}-${STAMP}"
gtest $? 'Missing livecd-stage2 results'
gbegin ' Creating core component'
TEMPMNTDIR="${TEMPDIR}/mount"
- mkdir "${TEMPMNTDIR}"
- gtest continued $? 'Failed to create mount temporary subdirectory'
+ gmkdir "${TEMPMNTDIR}"
TEMPISODIR="${TEMPDIR}/iso"
- mkdir "${TEMPISODIR}"
- gtest continued $? 'Failed to create iso temporary subdirectory'
+ gmkdir "${TEMPISODIR}"
mount -o loop "gnap-${GNAPVERSION}-${STAMP}.iso" ${TEMPMNTDIR} && \
cp -r ${TEMPMNTDIR}/* ${TEMPISODIR}
@@ -419,14 +414,14 @@
gbegin ' Creating basefs component'
tar jcf "gnap-basefs-${GNAPVERSION}-${STAMP}.tar.bz2" \
- -C "${CATALYST_DIR}/tmp/gnap/livecd-stage2-${SUBARCH}-${STAMP}" .
+ -C "${storedir}/tmp/gnap/livecd-stage2-${SUBARCH}-${STAMP}" .
gtest $? 'Unable to create basefs tarball'
fi
# EXTENSIONS phase
if [[ "${MODULES}" -eq 1 ]]; then
gbegin "${G}[extensions]${N} stage start"
- GRP_PREFIX="${CATALYST_DIR}/builds/${RELTYPE}/grp-${SUBARCH}-${STAMP}"
+ GRP_PREFIX="${storedir}/builds/${RELTYPE}/grp-${SUBARCH}-${STAMP}"
SPECMODULE="${SPECDIR}/extensions.conf"
mod_list=$(grep '^extensions:' "${SPECMODULE}" 2>/dev/null);
mod_list="${mod_list/extensions:/}"
@@ -460,12 +455,10 @@
$CATALYST_BIN -c "${CATALYST_CONF}" -f "${TEMPCONF}" \
>> "${GNAPLOGPREFIX}.out" 2>> "${GNAPLOGPREFIX}.err"
- gtest continued $? \
- "Extension build failed, ${SEELOGFILES}"
+ gtest continued $? "Extension build failed, ${SEELOGFILES}"
TEMPMODULEDIR="${TEMPDIR}/module_${mod_name}"
- mkdir "${TEMPMODULEDIR}"
- gtest continued $? 'Failed to create module temporary subdirectory'
+ gmkdir "${TEMPMODULEDIR}"
for pkg in $( ls ${GRP_PREFIX}/${mod_name}/All/*.tbz2 ); do
tar jxf $pkg -C "${TEMPMODULEDIR}" -p \
>> "${GNAPLOGPREFIX}.out" 2>> "${GNAPLOGPREFIX}.err"
@@ -488,5 +481,5 @@
fi
cleanup
-echo 'Build successful !'
+echo 'Build successful!'
exit 0
diff -ur --exclude .svn --exclude upload.sh --exclude diff.sh
gnap-2.0/src/specs/common.conf gnap-2.0+cleanup/src/specs/common.conf
--- gnap-2.0/src/specs/common.conf 2007-07-23 14:14:39.000000000 +0300
+++ gnap-2.0+cleanup/src/specs/common.conf 2007-07-17 15:40:34.000000000
+0300
@@ -1,9 +1,3 @@
-# Catalyst executable and support files
-CATALYST_NAME='catalyst'
-CATALYST_BIN="/usr/bin/${CATALYST_NAME}"
-CATALYST_CONF="/etc/${CATALYST_NAME}/${CATALYST_NAME}.conf"
-CATALYST_DIR="/var/tmp/${CATALYST_NAME}"
-
# Profile and build flags to use
SUBARCH="x86"
PROFILE="uclibc/x86/hardened"
diff -ur --exclude .svn --exclude upload.sh --exclude diff.sh
gnap-2.0/tools/gnap_overlay gnap-2.0+cleanup/tools/gnap_overlay
--- gnap-2.0/tools/gnap_overlay 2007-07-23 14:14:39.000000000 +0300
+++ gnap-2.0+cleanup/tools/gnap_overlay 2007-08-02 15:56:18.000000000
+0300
@@ -3,8 +3,9 @@
GNAPNAME=$(basename "$0")
echo "GNAP overlay tool ${GNAPNAME} ${VERSION}"
-GNAPCORE='/usr/lib/gnap/gnap-core.tar'
-GNAPMBR='/usr/lib/gnap/mbr/mbr.bin'
+GNAPLIBDIR='/usr/lib/gnap'
+GNAPCORE="${GNAPLIBDIR}/gnap-core.tar"
+GNAPMBR="${GNAPLIBDIR}/mbr/mbr.bin"
TEMPDIR=''
IMG_SIZE=15
@@ -24,6 +25,11 @@
echo -e " ${G}*${N} ${*}"
}
+gmkdir() {
+ mkdir -p "$1"
+ gtest continued $? "Failed to create directory \"$1\"."
+}
+
gconfirm() {
if [[ "${FORCEYES}" -eq 1 ]]; then
gwarn "${*} forced to yes"
@@ -33,7 +39,7 @@
if [[ -n "${TEMPDIR}" || -n "${LOOP}" ]]; then
cleanup
fi
- echo 'Overlay aborted !'
+ echo 'Overlay aborted!'
exit 2
fi
fi
@@ -98,7 +104,7 @@
echo ' -S size Size of image file in megabyte'
echo ' The disk target options also apply, except -d.'
echo
- echo "Please man ${GNAPNAME} for more details."
+ echo "Please use man ${GNAPNAME} for more details."
}
cleanup() {
@@ -126,8 +132,17 @@
gbegin 'Checking parameters'
# Read options
-while getopts ':hg:o:c:nfi:d:l:r:ms:S:L:' options; do
- case ${options} in
+NOLOGO=0
+FORCEYES=0
+OUTPUT=''
+TYPE=''
+CREATE='n'
+TARGETROOT=''
+CACHE=''
+SERIAL=''
+BAUDRATE=''
+while getopts ':hg:o:c:nfi:d:l:r:ms:S:L:' option; do
+ case ${option} in
h ) usage
exit 0;;
g ) GNAPCORE="${OPTARG}";;
@@ -150,7 +165,7 @@
m ) CACHE='docache ';;
s ) SERIAL="console=ttyS0,${OPTARG}n81"
BAUDRATE="${OPTARG}";;
- * ) gtest 1 'Specified options are incomplete or unknown !';;
+ * ) gtest 1 'Specified options are incomplete or unknown!';;
esac
done
@@ -192,7 +207,7 @@
gwarn "${W}dd if=${GNAPMBR} of=${PARENTDEV} bs=512 count=1${N} if
needed"
gwarn "${OUTPUT} must contain an active partition:"
gwarn " use ${W}fdisk ${PARENTDEV}${N} if needed"
- gwarn "Current data on ${OUTPUT} will be ${B}destroyed${N} !"
+ gwarn "Current data on ${OUTPUT} will be ${B}destroyed${N}!"
gconfirm 'Are you sure you want to continue ?'
fi
@@ -201,20 +216,18 @@
TEMPDIR=$(mktemp -d -t gnap_overlay.XXXXXX)
gtest continued $? 'Failed to create temporary directory'
TEMPCOREDIR="${TEMPDIR}/core"
-mkdir "${TEMPCOREDIR}"
-gtest continued $? 'Failed to create core temporary subdirectory'
+gmkdir "${TEMPCOREDIR}"
tar x -C "${TEMPCOREDIR}" -f "${GNAPCORE}"
gtest $? 'Failed to extract core'
gbegin 'Preparing overlay'
TEMPOVERDIR="${TEMPDIR}/overlay"
-mkdir "${TEMPOVERDIR}"
-gtest $? 'Failed to create overlay temporary subdirectory'
+gmkdir "${TEMPOVERDIR}"
if [[ -n "${BAUDRATE}" ]]; then
gbegin 'Adding baudrate for serial console'
- mkdir -p "${TEMPOVERDIR}/etc/gnap" && \
- echo -n "${BAUDRATE}" > "${TEMPOVERDIR}/etc/gnap/baudrate"
+ gmkdir "${TEMPOVERDIR}/etc/gnap"
+ echo -n "${BAUDRATE}" > "${TEMPOVERDIR}/etc/gnap/baudrate"
gtest $? 'Failed to create /etc/gnap/baudrate'
fi
for overlay in ${OVERLAYS} ; do
@@ -231,8 +244,7 @@
if [[ -n "${OVERLAYCONF}" ]]; then
gbegin "Adding ${OVERLAYCONF} (overlay.conf file)"
if [[ ! -d "${TEMPOVERDIR}/etc" ]]; then
- mkdir "${TEMPOVERDIR}/etc"
- gtest continued $? 'Failed to create /etc overlay directory'
+ gmkdir "${TEMPOVERDIR}/etc"
fi
cp "${OVERLAYCONF}" "${TEMPOVERDIR}/etc/overlay.conf"
gtest $? "Failed to copy ${OVERLAYCONF}"
@@ -256,7 +268,7 @@
# Target specific actions
if [[ "${TYPE}" == 'iso' ]]; then
if [[ -f "${OUTPUT}" ]]; then
- gconfirm "File ${OUTPUT} already exists, overwrite ?"
+ gconfirm "File ${OUTPUT} already exists, overwrite?"
fi
rm "${TEMPCOREDIR}/syslinux.cfg"
gbegin "Building ${OUTPUT} ISO file"
@@ -285,7 +297,7 @@
if [[ "${CREATE}" == y ]]; then
if [[ -f "${OUTPUT}" ]]; then
- gconfirm "File ${OUTPUT} already exists, overwrite ?"
+ gconfirm "File ${OUTPUT} already exists, overwrite?"
fi
gbegin 'Creating image file'
@@ -328,8 +340,7 @@
gbegin "Mounting ${OUTPUT}"
TEMPMOUNTDIR="${TEMPDIR}/mount"
- mkdir "${TEMPMOUNTDIR}"
- gtest continued $? 'Failed to create mount temporary subdirectory'
+ gmkdir "${TEMPMOUNTDIR}"
mount -t msdos "${OUTPUT}" "${TEMPMOUNTDIR}"
gtest $?
@@ -375,5 +386,5 @@
# Successful finish
cleanup
-echo 'Overlay successful !'
+echo 'Overlay successful!'
exit 0
diff -ur --exclude .svn --exclude upload.sh --exclude diff.sh
gnap-2.0/tools/gnap_remaster gnap-2.0+cleanup/tools/gnap_remaster
--- gnap-2.0/tools/gnap_remaster 2007-07-23 14:14:39.000000000 +0300
+++ gnap-2.0+cleanup/tools/gnap_remaster 2007-08-02 15:56:39.000000000
+0300
@@ -3,11 +3,12 @@
GNAPNAME=$(basename "$0")
echo "GNAP remastering tool ${GNAPNAME} ${VERSION}"
-GNAPCORE='/usr/lib/gnap/gnap-core.tar'
-GNAPBASEFS='/usr/lib/gnap/gnap-basefs.tar.bz2'
-GNAPEXTDIR='/usr/lib/gnap/extensions'
-OUTPUT='mygnap-core.tar'
+GNAPLIBDIR='/usr/lib/gnap'
+GNAPEXTDIR="${GNAPLIBDIR}/extensions"
TEMPDIR=''
+GNAPCORE="${GNAPLIBDIR}/gnap-core.tar"
+GNAPBASEFS="${GNAPLIBDIR}/gnap-basefs.tar.bz2"
+OUTPUT='mygnap-core.tar'
G=$'\e[32;01m'
B=$'\e[31;01m'
@@ -21,6 +22,11 @@
echo -e " ${W}*${N} ${*}"
}
+gmkdir() {
+ mkdir -p "$1"
+ gtest continued $? "Failed to create directory \"$1\"."
+}
+
gconfirm() {
if [[ "${FORCEYES}" -eq 1 ]]; then
gwarn "${*} forced to yes"
@@ -30,7 +36,7 @@
if [[ -n "${TEMPDIR}" ]]; then
cleanup
fi
- echo 'Remaster aborted !'
+ echo 'Remaster aborted!'
exit 2
fi
fi
@@ -79,9 +85,9 @@
echo ' -g gnap_core Original GNAP core file'
echo ' -b basefs basefs.tar.bz2 file to use as base'
echo ' -d extdir Directory where to find extensions'
- echo ' -f Force all answers to yes (dangerous !)'
+ echo ' -f Force all answers to yes (dangerous!)'
echo
- echo "Please man ${GNAPNAME} for more details."
+ echo "Please use man ${GNAPNAME} for more details."
}
cleanup() {
@@ -104,8 +110,14 @@
gbegin 'Checking parameters'
# Read options
-while getopts ':he:k:m:o:g:b:d:f' options; do
- case ${options} in
+EXTENSIONS=''
+KERNEXT=''
+MODEXT=''
+GNAPBASEFS=''
+GNAPEXTDIR=''
+FORCEYES=0
+while getopts ':he:k:m:o:g:b:d:f' option; do
+ case ${option} in
h ) usage
exit 0;;
e ) EXTENSIONS="${EXTENSIONS} ${OPTARG}";;
@@ -116,7 +128,7 @@
b ) GNAPBASEFS="${OPTARG}";;
d ) GNAPEXTDIR="${OPTARG}";;
f ) FORCEYES=1;;
- * ) gtest 1 'Specified options are incomplete or unknown !';;
+ * ) gtest 1 'Specified options are incomplete or unknown!';;
esac
done
@@ -146,8 +158,7 @@
TEMPDIR=$(mktemp -d -t gnap_remaster.XXXXXX)
gtest continued $? 'Failed to create temporary directory'
TEMPOVERDIR="${TEMPDIR}/basefs"
-mkdir "${TEMPOVERDIR}"
-gtest continued $? 'Failed to create basefs temporary subdirectory'
+gmkdir "${TEMPOVERDIR}"
tar jx -C "${TEMPOVERDIR}" -f "${GNAPBASEFS}"
gtest $? 'Failed to unpack basefs'
@@ -163,8 +174,7 @@
# Preparing new core
gbegin 'Extracting core tarball'
TEMPCOREDIR="${TEMPDIR}/core"
-mkdir "${TEMPCOREDIR}"
-gtest continued $? 'Failed to create core temporary subdirectory'
+gmkdir "${TEMPCOREDIR}"
tar x -C "${TEMPCOREDIR}" -f "${GNAPCORE}" --exclude image.squashfs
gtest $? 'Failed to extract core'
@@ -172,8 +182,7 @@
if [[ -f "${KERNEXT}" ]]; then
gbegin "Replacing kernel and initrd using ${KERNEXT}"
TEMPKERNDIR="${TEMPDIR}/kernel"
- mkdir "${TEMPKERNDIR}"
- gtest continued $? 'Failed to create kernel temporary subdirectory'
+ gmkdir "${TEMPKERNDIR}"
tar jx -C "${TEMPKERNDIR}" -f "${KERNEXT}"
gtest continued $? 'Failed to extract kernpackage'
@@ -205,6 +214,6 @@
# Successful finish
cleanup
-echo 'Remaster successful !'
+echo 'Remaster successful!'
exit 0
diff -ur --exclude .svn --exclude upload.sh --exclude diff.sh
gnap-2.0/tools/packlister.pl gnap-2.0+cleanup/tools/packlister.pl
--- gnap-2.0/tools/packlister.pl 2007-07-23 14:14:39.000000000 +0300
+++ gnap-2.0+cleanup/tools/packlister.pl 2007-07-09 21:10:18.000000000
+0300
@@ -1,49 +1,77 @@
-sub dump
+#! /usr/bin/perl
+#
+# packlister.pl prints out the given version number and a list of
+# packages found in the corresponding catalyst package cache and
+# grp cache.
+#
+# Usage: packlister.pl <version>
+# packlister.pl <version> | reducedsnapshot.pl
+# packlister.pl <version> > packlisterfile
+
+sub find_and_dump
{
- while (<FIND>)
- {
- if (/^(\d+)\s+(.+)\/(.+)\/(.+)$/)
- {
- $size = $1;
- $cstage = $2;
- $cat = $3;
- $name = $4;
- if ($cstage =~ /.*\/(.+)-x86-.+/)
+ if (scalar @_ == 0)
{
- $stage=$1;
+ return;
}
- else
+
+ open (FIND, "find $_ -name '*.tbz2' -exec ls -Ls {} \\; | "
+ . "grep -v '/All/' |");
+
+ while (<FIND>)
{
- print STDERR "ERROR ($cstage)\n";
+ if (/^(\d+)\s+(.+)\/([A-Za-z0-9+_]+[A-Za-z0-9+_.-]*)\/(.+)$/)
+ {
+ $size = $1;
+ $cstage = $2;
+ $cat = $3;
+ $name = $4;
+
+ # There might be more than x86 supported in future versions.
+ if ($cstage =~ /.*\/(.+)-x86-.+/)
+ {
+ $stage=$1;
+ }
+ else
+ {
+ print STDERR "ERROR ($cstage)\n";
+ }
+
+ # FIXME: The second regex (elsif) seems to match the stuff
+ # the first one also matches. Is this needed?
+ if ($name =~ /^(.+)-(.+-r\d+)\.tbz2/)
+ {
+ $packages{"$cat/$1"} = "$2 - $size Kb - $stage";
+ }
+ elsif ($name =~ /^(.+)-(.+)\.tbz2/)
+ {
+ $packages{"$cat/$1"} = "$2 - $size Kb - $stage";
+ }
+ else
+ {
+ print STDERR "ERROR ($name)\n"
+ }
+ }
+ else
+ {
+ print STDERR "ERROR : $_";
+ }
}
- if ($name =~ /^(.+)-(.+-r\d+)\.tbz2/)
- {
- $packages{"$cat/$1"} = "$2 - $size Kb - $stage";
- }
- elsif ($name =~ /^(.+)-(.+)\.tbz2/)
- {
- $packages{"$cat/$1"} = "$2 - $size Kb - $stage";
- }
- else
- {
- print STDERR "ERROR ($name)\n"
- }
- }
- else
- {
- print STDERR "ERROR : $_";
- }
- }
+
+ close (FIND);
+}
+
+# Check script parameters
+if (scalar @ARGV == 0)
+{
+ die "Usage: $ENV{_} <version>\n";
}
+
+# Print version and file list based on catalyst
print "$ARGV[0]\n";
-$loc = "/var/tmp/catalyst/packages/gnap/*$ARGV[0]";
-open (FIND,"find $loc -name '*.tbz2' -exec ls -Ls {} \\; | grep -v
'/All/' |");
-&dump();
-close FIND;
-$loc = "/var/tmp/catalyst/builds/gnap/grp*$ARGV[0]/*";
-open (FIND,"find $loc -name '*.tbz2' -exec ls -Ls {} \\; | grep -v
'/All/' |");
-&dump();
-close FIND;
+&find_and_dump("/var/tmp/catalyst/packages/gnap/*$ARGV[0]");
+&find_and_dump("/var/tmp/catalyst/packages/gnap/grp*$ARGV[0]/*");
+
#No need to grab for kernel sources as they are found in the /ALL/
directory
#$kernel=`grep sys-kernel gnap_make-$ARGV[0].out | grep merged | grep
sources`;
#if ($kernel =~ /(sys-kernel\/.*-sources)-(.*) merged/)
@@ -54,11 +82,13 @@
#{
# print STDERR "Kernel not found: $kernel\n";
#}
+
foreach $key (sort(keys(%packages)))
{
- print STDOUT "$key $packages{$key}\n";
+ print STDOUT "$key $packages{$key}\n";
}
- #Groff is part of the stage3 tarball but not remerged so we have to
add it manually
- print STDOUT "sys-apps/groff 1.19.2-r1 - 116 Kb - stage3\n";
- #htbinit is merged with kernel sources and somehow missed by the
script
- print STDOUT "net-misc/htbinit 0.8.5-r1 - 116 Kb - livecd-stage2\n";
+
+#Groff is part of the stage3 tarball but not remerged so we have to add
it manually
+print STDOUT "sys-apps/groff 1.19.2-r1 - 116 Kb - stage3\n";
+#htbinit is merged with kernel sources and somehow missed by the script
+print STDOUT "net-misc/htbinit 0.8.5-r1 - 116 Kb - livecd-stage2\n";
diff -ur --exclude .svn --exclude upload.sh --exclude diff.sh
gnap-2.0/tools/reducedsnapshot.pl gnap-2.0
+cleanup/tools/reducedsnapshot.pl
--- gnap-2.0/tools/reducedsnapshot.pl 2007-07-23 14:14:39.000000000
+0300
+++ gnap-2.0+cleanup/tools/reducedsnapshot.pl 2007-07-23
14:16:49.000000000 +0300
@@ -1,3 +1,13 @@
+#! /usr/bin/perl
+#
+# resucedsnapshot.pl creates a reduced portage snapshot based on a
+# dfault set (eclasses, profiles) and a packagelist created by
+# packlister.pl.
+#
+# Usage: packlister.pl <version> | reducedsnapshot.pl
+# reducedsnapshot.pl packlisterfile
+# reducedsnapshot.pl < packlisterfile
+
@minportage = (
"portage/eclass",
"portage/profiles/arch.list",
@@ -14,19 +24,21 @@
"portage/profiles/uclibc",
"portage/profiles/updates",
"portage/profiles/use.desc",
- "portage/profiles/use.local.desc");
+ "portage/profiles/use.local.desc"
+);
+
print "Building package list...\n";
$version = <>;
chop $version;
while (<>)
{
- ($pack,$ver,,,,)=split;
- push (@minportage,"portage/$pack");
- push (@minportage,"portage/metadata/cache/$pack-$ver");
+ ($pack,$ver,,,,) = split;
+ push (@minportage, "portage/$pack");
+ push (@minportage, "portage/metadata/cache/$pack-$ver");
}
+
print "Extracting portage...\n";
system "mkdir tmp_port";
-
system "tar jx -C tmp_port
-f /var/tmp/catalyst/snapshots/portage-$version.tar.bz2";
print "Creating reduced portage snapshot...\n";
system "tar jc -C tmp_port -f redportage-$version.tar.bz2 @minportage";
--
gnap-dev@gentoo.org mailing list
next prev parent reply other threads:[~2007-08-03 13:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-03 13:16 [gnap-dev] [PATCH 0/4] GNAP improvements, probably for 2.1 Philipp Riegger
2007-08-03 13:26 ` Philipp Riegger [this message]
2007-08-03 13:32 ` [gnap-dev] [PATCH 2/4] GNAP split Philipp Riegger
2007-08-03 13:37 ` [gnap-dev] [PATCH 3/4] GNAP namespace Philipp Riegger
2007-08-03 13:53 ` [gnap-dev] [PATCH 4/4] GNAP environment Philipp Riegger
2007-08-03 13:57 ` [gnap-dev] [PATCH 0/4] GNAP improvements, probably for 2.1 Philipp Riegger
2007-08-03 14:01 ` Philipp Riegger
2007-08-03 14:02 ` Philipp Riegger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1186147618.10651.24.camel@b136a \
--to=lists@anderedomain.de \
--cc=gnap-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox