public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] livecd-ng-1.0.ebuild
@ 2003-04-18  4:14 Tony Clark
  2003-04-18 16:27 ` Sylvain
  0 siblings, 1 reply; 2+ messages in thread
From: Tony Clark @ 2003-04-18  4:14 UTC (permalink / raw
  To: gentoo-dev

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I've been trying to make a live customised cd from the above ebuild.  There 
seems to be a couple of problems with the ebuild.

power livecd # livecd-ng gentoo-basic initrd
Using current working directory as LIVECD_ROOT.
cp: cannot stat `./archives/gcloop_0.66-1.tar.gz': No such file or directory
cp: cannot stat `./archives/busybox-0.60.5.tar.bz2': No such file or directory
/usr/sbin/livecd-ng: aborting.

I haven't been able to find gcloop anywhere.  I found cloop and copied that to 
gcloop.  Likewise I grabed a copy of busybox and put it where the script was 
looking for it.
livecd-ng gentoo-basic initrd runs now for a while however it bombs out with 
3000+0 records in
3000+0 records out
mke2fs 1.32 (09-Nov-2002)
cp: cannot stat `/pub/tmp/gentoo-basic/tmp/cloop-0.66/cloop_ucl.o': No such 
file or directory
chroot_generate: error: can't find ucl cloop module

Can anyone tell me what gcloop is.  I am guessing it is cloop with patches :(

There is a bug (19272) which basically covers the above problems.  The 
documentation in the readme for livecd-ng doesn't matchup too well with the 
script either.

My immediate problem is how to solve the gcloop problem and get the 
cloop_ucl.o module built.  Then hopefully I can debug the custom livecd

Thanks
tony
 
- -- 
Contract ASIC and FPGA design.
Telephone +46 702 894 667
http://pgp.mit.edu:11371/pks/lookup?op=vindex&search=0x633E2623

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iQCVAwUBPp97mmkjRGZD9pCjAQLwsgP/erNi4/E+M09pm/qwNJmsCoGdceWxvbIE
Zfjxi6lo13dXBBkdcHEzpeJgHRmkN/4Hs6Q/65rj2MYzd5gr2s3sjXxN3l66Yc/c
XACXNHXl2EozSLacI4lhe22sSyI4FIPRhHsW88AirpuQKRoqZ9yJ+U4Xmbu8qhoe
9jx9yagFZrs=
=e5qC
-----END PGP SIGNATURE-----


--
gentoo-dev@gentoo.org mailing list


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [gentoo-dev] livecd-ng-1.0.ebuild
  2003-04-18  4:14 [gentoo-dev] livecd-ng-1.0.ebuild Tony Clark
@ 2003-04-18 16:27 ` Sylvain
  0 siblings, 0 replies; 2+ messages in thread
From: Sylvain @ 2003-04-18 16:27 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 2317 bytes --]

Hi !

clopp module can be found here :
http://www.knopper.net/download/knoppix/
busybox has already its ebuild

I slightly change the /usr/sbin/livecd-ng script
it is attached.
try a diff between you livecd-ng and this one.

hope it helps...

regards,

sylvain



Le Fri, 18 Apr 2003 06:14:10 +0200
Tony Clark <tclark@telia.com> a écrit:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> I've been trying to make a live customised cd from the above ebuild.  There 
> seems to be a couple of problems with the ebuild.
> 
> power livecd # livecd-ng gentoo-basic initrd
> Using current working directory as LIVECD_ROOT.
> cp: cannot stat `./archives/gcloop_0.66-1.tar.gz': No such file or directory
> cp: cannot stat `./archives/busybox-0.60.5.tar.bz2': No such file or directory
> /usr/sbin/livecd-ng: aborting.
> 
> I haven't been able to find gcloop anywhere.  I found cloop and copied that to 
> gcloop.  Likewise I grabed a copy of busybox and put it where the script was 
> looking for it.
> livecd-ng gentoo-basic initrd runs now for a while however it bombs out with 
> 3000+0 records in
> 3000+0 records out
> mke2fs 1.32 (09-Nov-2002)
> cp: cannot stat `/pub/tmp/gentoo-basic/tmp/cloop-0.66/cloop_ucl.o': No such 
> file or directory
> chroot_generate: error: can't find ucl cloop module
> 
> Can anyone tell me what gcloop is.  I am guessing it is cloop with patches :(
> 
> There is a bug (19272) which basically covers the above problems.  The 
> documentation in the readme for livecd-ng doesn't matchup too well with the 
> script either.
> 
> My immediate problem is how to solve the gcloop problem and get the 
> cloop_ucl.o module built.  Then hopefully I can debug the custom livecd
> 
> Thanks
> tony
>  
> - -- 
> Contract ASIC and FPGA design.
> Telephone +46 702 894 667
> http://pgp.mit.edu:11371/pks/lookup?op=vindex&search=0x633E2623
> 
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.1 (GNU/Linux)
> 
> iQCVAwUBPp97mmkjRGZD9pCjAQLwsgP/erNi4/E+M09pm/qwNJmsCoGdceWxvbIE
> Zfjxi6lo13dXBBkdcHEzpeJgHRmkN/4Hs6Q/65rj2MYzd5gr2s3sjXxN3l66Yc/c
> XACXNHXl2EozSLacI4lhe22sSyI4FIPRhHsW88AirpuQKRoqZ9yJ+U4Xmbu8qhoe
> 9jx9yagFZrs=
> =e5qC
> -----END PGP SIGNATURE-----
> 
> 
> --
> gentoo-dev@gentoo.org mailing list
> 

[-- Attachment #2: livecd-ng --]
[-- Type: application/octet-stream, Size: 17991 bytes --]

#!/bin/bash
# Daniel Robbins, 28 Sep 2002 <drobbins@gentoo.org>
# Copyright 2002 Gentoo Technologies, Inc; http://www.gentoo.org
# Released under the GNU General Public License version 2

## HELP AND BASIC ARGUMENT PROCESSING
#####################################

usage() {
  cat <<EOF
livecd-ng: Gentoo Linux LiveCD-generation tool
Syntax: livecd <profile> <command1> ...

Essential Commands:
 fetch		Fetch required sources
 build		Build a bootable LiveCD tree (requires 'fetch')
 delete		Remove chroot directory (to allow 'build' to work)
 kernbuild	Perform only the kernel building steps (requires 'build')
 initrd		Generate the bootable LiveCD initrd (requires 'kernbuild')
 clean		Prepare chroot for CD by removing extraneous data
 cloop		Create compressed loopback filesystem
 isogen		Generate the final bootable LiveCD ISO image (requires 'prep')

Cleanup Commands:
 initrd-delete	Clean the LiveCD initrd directory
 umount		Unmount things that are bound to chroot directories 
           (e.g. /usr/portage) 

Other Commands:
  enter		Use "chroot" to start a shell inside the CD root.
            can be used to modify the CD before preparing an iso.

 -h|--help	Display this screen

Copyright 2002 Gentoo Technologies, Inc. (http://www.gentoo.org)
Distributed under the GNU Public License version 2
EOF
}

if [ "$1" = "-h" ] || [ "$1" = "--help" ]
then
	usage
	exit 1
fi

if [ "`whoami`" != "root" ]
then
	echo "$0: This script requires root privileges to operate."
	exit 1
fi

if [ -z "$LIVECD_ROOT" ]
then
	echo "Using current working directory as LIVECD_ROOT."
	export LIVECD_ROOT=.
fi

if [ -z "$1" ]
then
	echo "$0: Please specify a profile to use."
	exit 1
fi

if [ ! -d "${LIVECD_ROOT}/profiles/${1}" ]
then
	echo "$0: Cannot find profile directory:"
	echo "${LIVECD_ROOT}/profiles/${1}"
	exit 1
fi

if [ ! -e "${LIVECD_ROOT}/profiles/${1}/settings" ]
then
	echo "$0: Profile \"${1}\" missing \"settings\" file."
	exit 1
fi

if [ ! -e "${LIVECD_ROOT}/profiles/global/settings" ] || [ ! -e "${HOME}/.livecd-ng" ] 
then
	echo "$0: Cannot find global or ~/.livecd-ng settings."
	exit 1
fi

PROG=${0}

## ERROR HANDLING
#####################################

die() {
	if [ -n "$1" ]
	then
		echo "${PROG}: error: $1"
	else
		echo "${PROG}: aborting."
	fi
	exit 1
}

## CONVENIENCE FUNCTIONS
#####################################

#"zapmost" is used to remove an entire directory tree, *except* for certain
#specified files. Arg 1 is the tree, args 2+ are the items to keep, which can
#be files or directories at the root or deeper levels.

#example calls:
#zapmost /usr/share/locales en_us
#zapmost /usr/share/terminfo l/linux

zapmost() {
	local rootdir
	rootdir="${CD_BUILDCHROOT}${1}/"
	[ ! -e  "$rootdir" ] && echo "zapmost: $rootdir not found; skipping..." && return 1
	install -d ${CD_BUILDTEMP}/zap
	local dirs
	shift
	local x
	for x in ${*}
	do
		if [ "${x##*/}" = "${x}" ]
		then
			#one deep
			mv ${rootdir}${x} ${CD_BUILDTEMP}/zap
		else
			#more than one deep; create intermediate directories
			dirs=${x%/*}
			install -d ${CD_BUILDTEMP}/zap/${dirs}
			mv ${rootdir}${x} ${CD_BUILDTEMP}/zap/${x}
		fi
	done
	rm -rf ${rootdir}*
	mv ${CD_BUILDTEMP}/zap/* ${rootdir}
}

## GRABBING PROFILE SETTINGS
#####################################

CD_PROFILE=${1}
source ~/.livecd-ng || die "Couldn't find local settings in ~/.livecd-ng." 
source ${LIVECD_ROOT}/profiles/global/settings
source ${LIVECD_ROOT}/profiles/${CD_PROFILE}/settings
if [ "$KERNCONFIG" = "" ]
then
	KERNCONFIG="kernel-config"
fi
CD_BUILDTEMP=${CD_BUILDROOT}/tmp
CD_BUILDCHROOT=${CD_BUILDROOT}/cdroot
export CCACHEDIR=${CCACHEDIR:-/root/.ccache}
CD_STAGEFILE="${CD_STAGELOC}/${CD_STAGETARBALL##*/}"
LOOP_ROOT=${CD_BUILDROOT}/looproot
ISO_ROOT=${CD_BUILDROOT}/isoroot
CLOOP_TARBALL=cloop_0.68-2.tar.gz
CLOOP_DIR=cloop-0.68
BUSYBOX_TARBALL=busybox-0.60.5.tar.bz2
BUSYBOX_DIR=busybox-0.60.5
LOOP_FILE=${CD_BUILDROOT}/livecd.loop
CLOOP_FILE=${CD_BUILDROOT}/livecd.cloop
LOOP_MODE=cloop

#A good way to view/debug the environment....
#set | grep CD_

umount_all() {
	local x
	for x in /usr/portage /proc /home/distfiles /dev ${CCACHEDIR} /tmp/livecd -initrd 
	do
		umount ${CD_BUILDCHROOT}${x} 2>/dev/null || true
	done
	umount ${LOOP_ROOT} 2>/dev/null || true
}

mount_all() {
	mount -o bind /dev $CD_BUILDCHROOT/dev || chroot_die
	mount -o bind /proc $CD_BUILDCHROOT/proc || chroot_die
	mount -o bind $CD_PORTDIR $CD_BUILDCHROOT/usr/portage || chroot_die
	[ ! -e $CD_BUILDCHROOT/tmp/livecd ] && install -d $CD_BUILDCHROOT/tmp/livecd
	mount -o bind $CD_BUILDTEMP $CD_BUILDCHROOT/tmp/livecd || chroot_die
	mount -o bind ${CCACHEDIR} ${CD_BUILDCHROOT}/${CCACHEDIR} || chroot_die
	mount -o bind $CD_DISTDIR $CD_BUILDCHROOT/home/distfiles || chroot_die
}

chroot_die() {
	umount_all
	if [ -n "$1" ]
	then
		echo "chroot_generate: error: $1"
	else
		echo "chroot_generate: aborting."
	fi
	exit 1
}

#clean up if we are interrupted:
trap "chroot_die" SIGINT SIGQUIT

pre_fetch() {
	#extract stage tarball...
	if [ ! -e "$CD_STAGEFILE" ] 
	then
		( cd $CD_STAGELOC; wget $CD_STAGETARBALL )
	fi
}

build_setup() {
	cat > $CD_BUILDTEMP/build-setup << EOF
#env-update is important for gcc-3.2.1-r6 and higher.
env-update
source /etc/profile
export DISTDIR=/home/distfiles
export CONFIG_PROTECT='-*'
#lilo appears to need to write to /etc do do awking
export FEATURES="-sandbox ccache"
export PATH="/usr/bin/ccache:\${PATH}"
#lilo will try to mount /boot if it's in /etc/fstab, so let's move it out of the way...
export CFLAGS="$CD_CFLAGS"
export CXXFLAGS="$CD_CFLAGS"
export USE="$CD_USE"
export PKGDIR=/tmp/livecd/packages
export CLEAN_DELAY=0
[ ! -e /tmp/log ] && install -d /tmp/log

ewrapper() {
	local opts
	local pkgs
	for x in \$*
	do
		if [ "\${x:0:1}" = "-" ]
		then
			opts="\$opts \$x"
		else
			pkgs="\$pkgs \$x"
		fi
	done
	for x in \$pkgs
	do
		echo ">>> Emerging \${x}..."
#once the --buildpkg bug is fixed, we may have to --buildpkg --usepkg
		emerge --buildpkg \$opts \$x 2>&1 | cat >> /tmp/log/emerge.log 
		if [ \$? -ne 0 ]
		then
			echo ">>> Error emerging \${x}."
			exit 1
		fi
	done
}

cwrapper() {
	echo ">>> Executing \${*}..."
	\${*} 2>&1 | cat >> /tmp/log/build.log
	if [ \$? -ne 0 ]
	then
		echo ">>> Error executing \${*}."
		exit 1
	fi
}
EOF
	}

stage1_build() {
	cp "${LIVECD_ROOT}/profiles/global/aux-files/freeramdisk.c" $CD_BUILDTEMP || die
	cp ${LIVECD_ROOT}/profiles/${CD_PROFILE}/stage1-* $CD_BUILDTEMP || die
	cat > $CD_BUILDTEMP/stage1-build << EOF
cd /tmp/livecd
source /tmp/livecd/build-setup || exit 1
mv /etc/fstab /etc/fstab.bak
#update portage, then get ccache up and running.
#on separate line to allow for a portage db upgrade
emerge --noreplace portage 
ewrapper --noreplace ccache
#build our packages...
for x in \`cat /tmp/livecd/stage1-packages | grep -v ^#\`
do
	emerge --buildpkg --usepkg --noreplace --pretend \$x
	ewrapper --buildpkg --usepkg --noreplace \$x || exit 1 
done
if [ -e /tmp/livecd/stage1-experimental ]
then
	export ACCEPT_KEYWORDS="~x86"
	for x in \`cat /tmp/livecd/stage1-experimental | grep -v ^#\`
	do
		emerge --buildpkg --usepkg --noreplace --pretend \$x
		ewrapper --buildpkg --usepkg --noreplace \$x || exit 1 
	done
fi
#Handle 2.5 kernels....
if [ -e /usr/src/linux-beta ]
then
	ln -s linux-beta /usr/src/linux
fi
gcc ${CFLAGS} freeramdisk.c -o /sbin/freeramdisk || exit 1
strip /sbin/freeramdisk
EOF
	chmod +x $CD_BUILDTEMP/stage1-build
	chroot $CD_BUILDCHROOT /tmp/livecd/stage1-build
	[ $? -ne 0 ] && chroot_die "stage 1 build failure"
}

stage2_build() {
	cp "${LIVECD_ROOT}/profiles/${CD_PROFILE}/stage2-packages" $CD_BUILDTEMP || die
	cat > $CD_BUILDTEMP/stage2-build << EOF
cd /tmp/livecd
source /tmp/livecd/build-setup || exit 1
#build our packages...
for x in \`cat /tmp/livecd/stage2-packages | grep -v ^#\`
do
	#don't build or use packages, since these guys are kernel-dependent and we want them to sync with the current
	#kernel compile.
	emerge --noreplace --pretend \$x
	emerge --noreplace \$x || exit 1 
done
cd /usr/src/linux
cwrapper make _modinst_post
EOF
	chmod +x $CD_BUILDTEMP/stage2-build
	chroot $CD_BUILDCHROOT /tmp/livecd/stage2-build
	[ $? -ne 0 ] && chroot_die "stage 2 build failure"
}

kernel_build() {
	cp "${LIVECD_ROOT}/profiles/${CD_PROFILE}/${KERNCONFIG}" "${CD_BUILDCHROOT}/usr/src/linux/.config" || chroot_die
	cat > $CD_BUILDTEMP/kernel-build << EOF
source /tmp/livecd/build-setup
cd /usr/src/linux
if [ ! -d /tmp/livecd/kernel/.complete ]
then
	install -d /tmp/livecd/kernel
	make oldconfig || exit 1
	make dep || exit 1
	make bzImage || exit 1
	make modules modules_install || true
	cp arch/i386/boot/bzImage /tmp/livecd/kernel/
	touch /tmp/livecd/kernel/.complete
fi
EOF
	chmod +x $CD_BUILDTEMP/kernel-build
	chroot $CD_BUILDCHROOT /tmp/livecd/kernel-build
	[ $? -ne 0 ] && chroot_die "Chroot kernel/2nd package build failure"
}

initrd_build() {
	cp ${LIVECD_ROOT}/archives/${CLOOP_TARBALL} ${LIVECD_ROOT}/archives/${BUSYBOX_TARBALL} $CD_BUILDTEMP || die
	cat > $CD_BUILDTEMP/initrd-build << EOF
source /tmp/livecd/build-setup
cd /tmp/livecd
if [ "$LOOP_MODE" = "cloop" ]
then
	rm -rf ${CLOOP_DIR}
	cwrapper tar xzf ${CLOOP_TARBALL}
	cd ${CLOOP_DIR} 
	make
	cd ..
fi
rm -rf ${BUSYBOX_DIR}
cwrapper tar xjf ${BUSYBOX_TARBALL}
cd ${BUSYBOX_DIR}
cp Config.h Config.h.orig
sed -e "s://#define BB_INSMOD:#define BB_INSMOD:" \
-e "s://#define BB_PIVOT_ROOT:#define BB_PIVOT_ROOT:" \
-e "s://#define BB_LOADKMAP:#define BB_LOADKMAP:" \
-e "s://#define BB_LOSETUP:#define BB_LOSETUP:" \
-e "s://#define BB_RMMOD:#define BB_RMMOD:" Config.h.orig > Config.h
cwrapper make clean
cwrapper make DOSTATIC=true
EOF
	chmod +x $CD_BUILDTEMP/initrd-build
	chroot $CD_BUILDCHROOT /tmp/livecd/initrd-build
	[ $? -ne 0 ] && chroot_die "Chroot kernel/2nd package build failure"
}

initrd_create() {
	install -d ${CD_BUILDCHROOT}-initrd
	dd if=/dev/zero of=${CD_BUILDROOT}/initrd bs=1k count=3000
	mke2fs -F -q -N3000 ${CD_BUILDROOT}/initrd
	mount -t ext2 -o loop ${CD_BUILDROOT}/initrd ${CD_BUILDCHROOT}-initrd
	#makeinitrd
	if [ ! -e ${CD_BUILDCHROOT}-initrd/bin ]
	then
		install -d ${CD_BUILDCHROOT}-initrd/{bin,etc,usr,proc,tmp}	
		ln -s bin ${CD_BUILDCHROOT}-initrd/sbin
		ln -s ../bin ${CD_BUILDCHROOT}-initrd/usr/bin
		ln -s ../bin ${CD_BUILDCHROOT}-initrd/usr/sbin
		install -d ${CD_BUILDCHROOT}-initrd/keymaps
		#keymap stuff is from the excellent tomsrtbt boot disk.
		cp ${LIVECD_ROOT}/profiles/global/keymaps/key.lst ${CD_BUILDCHROOT}-initrd/keymaps
		tar xzf ${LIVECD_ROOT}/profiles/global/keymaps/bin-keymaps.tar.gz -C ${CD_BUILDCHROOT}-initrd/keymaps
		(mkdir ${CD_BUILDCHROOT}-initrd/dev;cd ${CD_BUILDCHROOT}-initrd/dev;MAKEDEV generic-i386;MAKEDEV scd)
		cat >${CD_BUILDCHROOT}-initrd/etc/fstab <<EOF
/dev/ram0       /             cramfs defaults
proc            /proc         proc   defaults  0 0
EOF
	fi
	install -m755 ${LIVECD_ROOT}/profiles/global/linuxrc ${CD_BUILDCHROOT}-initrd
	cp ${CD_BUILDTEMP}/${BUSYBOX_DIR}/busybox ${CD_BUILDCHROOT}-initrd/bin || chroot_die

	# Generate busybox links. We really do not need all of them but its good to
	# have a fall back in case we need them someday.
	for i in '[' ash basename cat chroot clear cp dirname echo env false find \
	grep gunzip gzip insmod ln ls loadkmap losetup lsmod mkdir mknod modprobe more mount mv \
	pivot_root ps pwd rm rmdir rmmod sh sleep tar test touch true umount uname \
	xargs yes zcat chmod chown; do 
		rm -f ${CD_BUILDCHROOT}-initrd/bin/$i
		ln ${CD_BUILDCHROOT}-initrd/bin/busybox ${CD_BUILDCHROOT}-initrd/bin/$i || chroot_die 
	done 
	install -d ${CD_BUILDCHROOT}-initrd/modules/storage
	if [ "$LOOP_MODE" = "cloop" ]
	then
		cp ${CD_BUILDTEMP}/${CLOOP_DIR}/cloop.o ${CD_BUILDCHROOT}-initrd/modules/cloop.o || chroot_die "can't find cloop module"
	fi
	local mymod
	for i in $STORAGE_MODULES
	do
		mymod=`find ${CD_BUILDCHROOT}/lib/modules -name "${i}.o"`
		if [ -z "${mymod}" ]
		then
			echo "Error: ${i}.o not found; skipping..."
			continue
		fi
		cp $mymod ${CD_BUILDCHROOT}-initrd/modules/storage
	done
	#tweak our storage module settings based on our initrd
	cat ${LIVECD_ROOT}/profiles/global/linuxrc | sed "s/##STORAGE_MODULES##/${STORAGE_MODULES}/" > ${CD_BUILDCHROOT}-initrd/linuxrc || chroot_die
	chmod +x ${CD_BUILDCHROOT}-initrd/linuxrc
	umount ${CD_BUILDCHROOT}-initrd
	gzip -f -9 ${CD_BUILDROOT}/initrd
}

cloop_create() {
	umount_all
	install -d ${LOOP_ROOT} || chroot_die
	dd if=/dev/zero of=${LOOP_FILE} bs=1k count=${LOOP_SIZE} || chroot_die
	mke2fs -F -q ${LOOP_FILE} || chroot_die
	mount -t ext2 -o loop ${LOOP_FILE} ${LOOP_ROOT} || chroot_die
	cp -a ${CD_BUILDCHROOT}/* ${LOOP_ROOT} || chroot_die
	umount ${LOOP_ROOT} || chroot_die
	if [ "$LOOP_MODE" = "cloop" ]
	then
		cat ${LOOP_FILE} | ${CD_BUILDTEMP}/${CLOOP_DIR}/create_compressed_fs - 65536 > ${CLOOP_FILE} || chroot_die
	fi
}

iso_create() {
	install -d ${ISO_ROOT} || die
	install -d ${ISO_ROOT}/isolinux
	cp ${LIVECD_ROOT}/archives/isolinux.bin ${ISO_ROOT}/isolinux || die
	cp ${LIVECD_ROOT}/profiles/global/isolinux.cfg ${ISO_ROOT}/isolinux || die
	cp ${LIVECD_ROOT}/profiles/global/{*.lss,*.msg} ${ISO_ROOT}/isolinux || die
	cp ${CD_BUILDROOT}/initrd.gz ${ISO_ROOT}/isolinux/initrd || die
	cp ${CD_BUILDTEMP}/kernel/bzImage ${ISO_ROOT}/isolinux/gentoo || die
	#Can't get isolinux to boot memtest, whether memtest.bin or the kernel image version
	#cp ${LIVECD_ROOT}/profiles/global/memtest/memtest.bin ${ISO_ROOT}/isolinux || die
	if [ "$LOOP_MODE" = "cloop" ]
	then
		cp ${CLOOP_FILE} ${ISO_ROOT} || die
	else
		cp ${LOOP_FILE} ${ISO_ROOT} || die
	fi
	mkisofs -J -R -l -o ${CD_BUILDROOT}/livecd.iso -b isolinux/isolinux.bin -c isolinux/boot.cat \
	-no-emul-boot -boot-load-size 4 -boot-info-table ${ISO_ROOT}
}

chroot_generate() {
	umount_all
	[ ! -e "$CD_STAGEFILE" ] && chroot_die "$CD_STAGEFILE not found; please run \"fetch\" first."
	[ -e "$CD_BUILDCHROOT" ] && chroot_die "$CD_BUILDCHROOT already exists; please run $0 $CD_PROFILE delete before running $0 $CD_PROFILE build"
	#create build chroot directory and extract stage tarball
	install -d "$CD_BUILDCHROOT"
	echo ">>> Extracting stage tarball..."
	tar xjpf $CD_STAGEFILE -C $CD_BUILDCHROOT || die "stage tarball extraction error"
	#set up our private temp directory and the mount-point inside the chroot.
	install -d "$CD_BUILDTEMP" "${CD_BUILDCHROOT}/tmp/livecd" || die "couldn't create chroot temp. directories"
	#set up ccache so we can get funky.
	if [ ! -d "${CD_BUILDCHROOT}/${CCACHEDIR}" ] 
	then
		install -d "${CD_BUILDCHROOT}/${CCACHEDIR}" || die "couldn't initialize ccache dir"
	fi
	#set up distfile mount-point...
	install -d "${CD_BUILDCHROOT}/home/distfiles" || die "couldn't create /home/distfiles mountpoint"

	#set up the profile symlink so that it points to the profile we want
	rm -f "${CD_BUILDCHROOT}/etc/make.profile"
	ln -s ../usr/portage/profiles/${CD_PORTAGE_PROFILE} ${CD_BUILDCHROOT}/etc/make.profile

	#copy our local resolv.conf and hosts over for now; this allows downloading to work.  
	cp /etc/resolv.conf /etc/hosts ${CD_BUILDCHROOT}/etc

	#let's do this....
	mount_all
	build_setup
	stage1_build
	kernel_build
	stage2_build
	umount_all
}

chroot_enter() {
	umount_all
	mount_all
	chroot $CD_BUILDCHROOT
	umount_all
}

chroot_clean() {
	umount_all
	echo "$CD_HOSTNAME" > ${CD_BUILDCHROOT}/etc/hostname || die
	cp ${LIVECD_ROOT}/profiles/global/aux-files/modules ${CD_BUILDCHROOT}/etc/init.d || die
	cp ${LIVECD_ROOT}/profiles/global/aux-files/checkroot ${CD_BUILDCHROOT}/etc/init.d || die
	cp ${LIVECD_ROOT}/profiles/global/aux-files/local ${CD_BUILDCHROOT}/etc/init.d || die
	cp ${LIVECD_ROOT}/profiles/global/aux-files/fstab ${CD_BUILDCHROOT}/etc || die
	cp ${LIVECD_ROOT}/profiles/global/net-setup ${CD_BUILDCHROOT}/usr/sbin || die
	chmod +x ${CD_BUILDCHROOT}/usr/sbin/net-setup  || die
	local mymotd
	mymotd=${LIVECD_ROOT}/profiles/${CD_PROFILE}/motd
	[ -e $mymotd ] && cp $mymotd ${CD_BUILDCHROOT}/etc
	echo "CDBOOT=1" >> ${CD_BUILDCHROOT}/etc/rc.conf || die
	echo "127.0.0.1 cdimage localhost" > ${CD_BUILDCHROOT}/etc/hosts || die
	cp ${LIVECD_ROOT}/profiles/global/aux-files/inittab ${CD_BUILDCHROOT}/etc || die
	mount_all
	cat > $CD_BUILDTEMP/chroot-clean << EOF
#!/bin/bash
source /etc/profile
if [ -e /etc/init.d/metalog ]
then 
	rc-update add metalog default
elif [ -e /etc/init.d/sysklogd ]
then
	rc-update add sysklogd default
fi
#remove standard keymap support:
rc-update del keymaps
rc-update del consolefont
EOF
	chmod +x $CD_BUILDTEMP/chroot-clean
	chroot $CD_BUILDCHROOT /tmp/livecd/chroot-clean
	[ $? -ne 0 ] && chroot_die "chroot-clean failure"
	umount_all
	rm -rf ${CD_BUILDCHROOT}/etc/localtime 
	cp ${CD_BUILDCHROOT}/usr/share/zoneinfo/GMT ${CD_BUILDCHROOT}/etc/localtime || die

	if [ -e "${LIVECD_ROOT}/profiles/global/openglify" ]
	then
		source ${LIVECD_ROOT}/profiles/global/openglify
	fi	
	if [ -e "${LIVECD_ROOT}/profiles/global/clean" ] 
	then
		source ${LIVECD_ROOT}/profiles/global/clean
	else
		echo "No global clean script found; skipping."
	fi
	if [ -e "${LIVECD_ROOT}/profiles/${CD_PROFILE}/clean" ]
	then
		source ${LIVECD_ROOT}/profiles/${CD_PROFILE}/clean
	else
		echo "No ${CD_PROFILE} clean script found; skipping."
	fi
	umount_all
}

# ordre recommandé : fetch build initrd clean cloop isogen umount
case "$2" in
    fetch)	
    	pre_fetch;;
    build)  
    	chroot_generate;;
	cloop)
		cloop_create;;
    initrd) 
		mount_all
		initrd_build
		umount_all
		initrd_create
		;;
    initrd-delete)
    	umount_all
		rm -rf ${CD_BUILDTEMP}/${CLOOP_DIR} || die
		rm -rf ${CD_BUILDTEMP}/${BUSYBOX_DIR} || die
		rm -rf ${CD_BUILDCHROOT}-initrd 
		rm -rf ${CD_BUILDTEMP}/kernel
		rm -rf ${CD_BUILDROOT}/isoroot
		;;
    shebang)
		initrd_generate
		mount_all
		;;
    prep)   
    	chroot_prep
		;;
    isogen) 
    	iso_create
		;;
    enter)  
    	chroot_enter
		;;
    umount)	
    	umount_all
		;;
	kernbuild) 
		umount_all
		mount_all
		kernel_build
		umount_all
		;;
    clean) 
		chroot_clean
		;;
    delete)
    	umount_all
		rm -rf $CD_BUILDCHROOT
	;;
    *) 
		usage 
		exit 1
		;;
esac
exit 0


[-- Attachment #3: Type: text/plain, Size: 37 bytes --]

--
gentoo-dev@gentoo.org mailing list

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-04-18 16:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-04-18  4:14 [gentoo-dev] livecd-ng-1.0.ebuild Tony Clark
2003-04-18 16:27 ` Sylvain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox