[leaf-commits] src/bering-uclibc4/buildtool/tools geniso.sh, NONE, 1.1

Andrew <[email protected]>
Newsgroups gmane.linux.leaf.cvs
Message-ID <[email protected]>
Update of /cvsroot/leaf/src/bering-uclibc4/buildtool/tools
In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv16700/tools

Added Files:
	geniso.sh 
Log Message:
Added ISOLINUX .iso boot CD generation (kernel/initrd need to be fixed 
later to properly boot with CD)


--- NEW FILE: geniso.sh ---
#! /bin/sh
#set -x
# script to create the bering-uclibc iso image
# $Id: geniso.sh,v 1.1 2010/06/05 22:40:53 nitr0man Exp $
# (C) 2005 Arne Bernin
# this file is released under the GNU Public Licence (GPL) 
# Version 2 or later

#######################################################################################################################################################
# adjust to your needs:
# Note: you can use pathnames in here (relative is the best of course, set the package path according if
# you call this script... If the path contains a : the string after the : will be used as target filename,
# if you have a file initrd_ide_cd.lrp and want to name it initrd.lrp on the floppy image, use:
# initrd_ide_cd.lrp:initrd.lrp


#######################################################################################################################################################
export LANG=C

print_usage() {
	cat <<EOF
usage: $0 <release version> <kernel version>
$0 creates a ready to use iso Image.
<release version> is the bering-uclibc release, e.g. 2.3beta5.
kernel version is the kernel version you are using.
EOF

}

#### look at how we are called:
if [ "$1" = "" ] ; then
	print_usage
	exit 1
fi


TYPE=$(echo $1 | tr [:lower:] [:upper:])

#################
DATE=$(date "+%B %Y")
VERSION=$1

#### get clear path(s):
# check if we were called with an absolute path or a relative one
echo $0 | grep -q '^/.*'
if [ $? -eq 0 ]  ; then 
MYPATH=$0
else
MYPATH=$(pwd)/$0
fi

export LANG=C

MYPATH1=$(dirname $MYPATH)
# cut of /./, and . at end and tools
MYPATH2=$(echo $MYPATH1 | sed -e 's/\/.\//\//g' | sed -e 's/\/\.$//' | sed -e 's/tools$//')
# strip ending : /
BTROOT=$(echo $MYPATH2 | sed -e 's/\/$//')
IMGPATH=${BTROOT}/image
STGDIR=${BTROOT}/staging
SRCDIR=${BTROOT}/source
TMPDIR=$(mktemp -d -p /tmp CREATE_XXXXXX)
IMG=${TMPDIR}/floppy.img
TOOLSDIR=${BTROOT}/tools
FDDIR=${TOOLSDIR}/image/iso
FDBASEDIR=${TOOLSDIR}/image
if [ -f "$FDDIR/filelist" ] ; then
	. $FDDIR/filelist
else
	echo "$FDDIR/filelist is missing"
	exit 1
fi

echo "FILELIST=$FILELIST"

# set pkgdir
PKGDIR=$BTROOT/package

KVERSION=$2
if [ "$KVERSION" = "" ] ; then
	# find latest version
	KVERSION=`cat $SRCDIR/linux/linux/.config | awk '/version:/ {print $5}'`
fi

# check directory
retval=0

# export mtoolsrc so it will be find:
export MTOOLSRC=${TOOLSDIR}/mtoolsrc 
# create mtoolsrc
echo drive a: file=\"$IMG\" exclusive > $MTOOLSRC
echo MTOOLS_NO_VFAT=0 >> $MTOOLSRC


echo "copying files to $TMPDIR"
# copy base files
find $PKGDIR -maxdepth 1 -type f -exec cp {} $TMPDIR \;
mkdir -p $TMPDIR/contrib
mkdir -p $TMPDIR/testing
find $PKGDIR/testing -maxdepth 1 -type f -exec cp {} $TMPDIR/testing \;
find $PKGDIR/contrib -maxdepth 1 -type f -exec cp {} $TMPDIR/contrib \;
find $PKGDIR/$KVERSION -maxdepth 1 -type f -exec cp {} $TMPDIR \;
cp -R $PKGDIR/* $TMPDIR

echo "creating image"

set -e
# now create the image dir
mkdir -p $IMGPATH

# copy disk + unpack
echo $TMPDIR
mkdir -p $TMPDIR/isolinux
cp $STGDIR/usr/bin/isolinux.bin $TMPDIR/isolinux
retval=$?

set +e
# copy all files
#filelist=$(eval echo "\$FILELIST$TYPE")
for name in ${FILELIST} ; do
	echo $name | grep -q ":"
	if [ $? -eq 0 ] ; then
		src=$(echo $name | cut -d ':' -f 1)
		dst=$(echo $name | cut -d ':' -f 2)
	else
		src=$name
		dst=""
	fi
	echo copying $src to temp dir
	tretval=0
	#if [ "$dst" != "" ] ; then
			cp ${PKGDIR}/$src $TMPDIR/$dst
			tretval=$?
	#fi
	if [ $tretval -ne 0 ] ; then
		retval=1
	fi
done

set -e

cp $FDDIR/leaf.cfg $TMPDIR
cp $STGDIR/boot/linux $TMPDIR
cp $FDDIR/isolinux.cfg $TMPDIR/isolinux
cp $FDDIR/isolinux.dpy $TMPDIR/isolinux
cp $FDDIR/syslinux.ser $TMPDIR/isolinux
cp $FDDIR/configdb.ser $TMPDIR


#
sed -e "s/{DATE}/$DATE/g" -e "s/{VERSION}/$VERSION/g" $FDBASEDIR/isolinux.dpy > $TMPDIR/isolinux.dpy
sed -e "s/{DATE}/$DATE/g" -e "s/{VERSION}/$VERSION/g" $FDBASEDIR/readme > $TMPDIR/readme

set +e

if [ $retval -ne 0 ] ; then
	echo "There have been errors while creating temporary directory!"
else
		set -e
#		mv $IMG ${TMPDIR}/bootdisk.ima
#		cp -R $PKGDIR/* $TMPDIR
#		mkdir -p $TMPDIR/lib/modules
#		(cd $TMPDIR/lib/modules ; tar xvzf ../../Bering-uClibc_modules_$KVERSION.tar.gz ; rm ../../Bering-uClibc_modules_$KVERSION.tar.gz )
#		rm $TMPDIR/lib/modules/$KVERSION/build
		(cd $STGDIR/lib/modules/$KVERSION; tar -czf $TMPDIR/modules.tgz *)
		IMGNAME=$IMGPATH/Bering-uClibc_$VERSION'_'iso_bering-uclibc.iso
#		(cd $TMPDIR ; mkisofs -v -b bootdisk.ima  -c boot.catalog -r -f -J -o $IMGNAME -m moddb.lrp .)
		(cd $TMPDIR ; mkisofs -o $IMGNAME -v -b isolinux/isolinux.bin  -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -l -R -r .)

		set +e
	echo "image moved to $IMGNAME"
fi

rm -rf $TMPDIR
exit $retval


------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.