[Lunar-commits] CVS: lunar-iso/scripts blank, NONE, 1.1 burn, NONE,
1.1 dirs, NONE, 1.1 discover, NONE, 1.1 etc, NONE, 1.1 init,
NONE, 1.1 initrd, NONE, 1.1 isofs, NONE, 1.1 isolinux, NONE,
1.1 memtest, NONE, 1.1 proper, NONE, 1.1 rebuild, NONE,
1.1 unpack, NONE, 1.1
Auke Kok
sofar at lunar-linux.org
Mon Nov 22 20:43:37 UTC 2004
Update of /var/cvs/lunar/lunar-iso/scripts
In directory espresso.foo-projects.org:/tmp/cvs-serv5259
Added Files:
blank burn dirs discover etc init initrd isofs isolinux
memtest proper rebuild unpack
Log Message:
Initial import
--- NEW FILE: blank ---
#!/bin/bash
cdrecord -v dev=ATAPI:0,0,0 blank=fast
--- NEW FILE: burn ---
#!/bin/bash -x
cdrecord -dao -v dev=ATAPI:0,0,0 lunar-${ISO_VERSION}.iso
--- NEW FILE: dirs ---
#!/bin/bash
(
cd $ISO_TARGET
mkdir -p bin boot dev etc home lib mnt media
mkdir -p proc root sbin srv tmp usr var opt
mkdir -p usr/{bin,games,include,lib,libexec,local,sbin,share,src}
mkdir -p usr/share/{dict,doc,info,locale,man,misc,terminfo,zoneinfo}
mkdir -p usr/share/man/man{1,2,3,4,5,6,7,8}
ln -sf share/doc usr/doc
ln -sf share/man usr/man
ln -sf share/info usr/info
mkdir -p etc/init.d etc/rc{0,1,2,3,4,5,6,S}.d
mkdir -p etc/lunar/local/depends
ln -s . etc/rc.d
mkdir -p var/log/lunar/{install,md5sum,compile}
mkdir -p var/{cache,empty,lib,lock,log,run,spool,state,tmp}
mkdir -p var/{cache,lib,log,spool,state}/lunar
mkdir -p var/state/discover
mkdir -p var/spool/mail
mkdir -p media/{cdrom0,cdrom1,floppy0,floppy1,mem0,mem1}
chmod 0700 root
chmod 1777 tmp var/tmp
)
touch $ISO_TARGET/.dirs
--- NEW FILE: discover ---
#!/bin/bash
. /etc/lunar/config
unset VERBOSE
optimize
BUILD_DIRECTORY=${ISO_SOURCE}/discover
cd ${ISO_SOURCE}/discover
# build curl without ssl first statically
(
run_details curl
unpack $(sources curl)
cd $SOURCE_DIRECTORY
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --without-ssl
make
cd ${ISO_SOURCE}/discover
cp $SOURCE_DIRECTORY/lib/.libs/libcurl.a .
rm -rf $SOURCE_DIRECTORY
)
(
run_details discover
unpack $(sources discover)
cd $SOURCE_DIRECTORY
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
make LDFLAGS=-all-static -C portability
make LDFLAGS=-all-static -C sysdeps
make LDFLAGS=-all-static -C lib
make -C discover
cd discover
gcc -s -Wl,-O1 -o discover discover.o -ldl ${ISO_SOURCE}/discover/libcurl.a ../lib/.libs/libdiscover.a ../portability/.libs/libportability.a /usr/lib/libexpat.a ${ISO_SOURCE}/discover/libcurl.a -s -Wl,-O1 /usr/lib/libdl.a /usr/lib/libdl.a /usr/lib/libz.a ../portability/.libs/libportability.a -lc ../lib/.libs/libdiscover.a
cd ${ISO_SOURCE}/discover
cp $SOURCE_DIRECTORY/discover.dtd .
cp $SOURCE_DIRECTORY/etc/conffile.dtd .
cp $SOURCE_DIRECTORY/etc/discover.conf .
cp $SOURCE_DIRECTORY/discover/discover .
rm -rf $SOURCE_DIRECTORY
)
(
run_details discover-data
unpack $(sources discover-data)
cd $SOURCE_DIRECTORY
sed -i "s:/usr/local:/usr:g" Makefile
sed -i "s:(datadir)/tools:(prefix)/bin:g" Makefile
make
mkdir ${ISO_SOURCE}/discover/data
cp *.xml ${ISO_SOURCE}/discover/data
cd ${ISO_SOURCE}/discover
rm -rf $SOURCE_DIRECTORY
)
rm libcurl.a
--- NEW FILE: etc ---
#!/bin/bash
# big bang: copy everything we need present
cp -a $ISO_SOURCE/template/etc/* $ISO_TARGET/etc/
# module related stuff
cp $ISO_TARGET/etc/skel/.bash* $ISO_TARGET/root/
cp $ISO_TARGET/etc/skel/.vimrc $ISO_TARGET/root/
# random misc stuff
mkdir -p $ISO_TARGET/var/lock/subsys
echo "Lunar Linux ${ISO_CNAME}" > $ISO_TARGET/etc/lunar.release
# rerun ldconfig to make sure we're not stale
touch $ISO_TARGET/etc/ld.so.conf
chroot $ISO_TARGET ldconfig
# prepare our moonbase!
if [ ! -f $ISO_SOURCE/template/moonbase.tar.bz2 ]; then
echo "Cannot find template/moonbase.tar.bz2!"
exit 1
fi
(
echo "+ installing moonbase"
cd $ISO_TARGET/var/lib/lunar
tar xjf $ISO_SOURCE/template/moonbase.tar.bz2
tar tjlf $ISO_SOURCE/template/moonbase.tar.bz2 | sed 's/^/\/var\/lib\/lunar\//g' > $ISO_TARGET/var/log/lunar/install/moonbase-${ISO_DATE}
cd $ISO_SOURCE
chroot $ISO_TARGET /sbin/lsh add_module moonbase installed $ISO_DATE
echo "+ installing module.index"
chroot $ISO_TARGET /sbin/lsh create_module_index
echo "+ installing depends.cache"
chroot $ISO_TARGET /sbin/lsh create_depends_cache
)
# manual fixes needed before compiling:
[ ! -e $ISO_TARGET/lib/cpp ] && ln -s /usr/bin/cpp $ISO_TARGET/lib/cpp
[ ! -e $ISO_TARGET/usr/include/gnu/stubs.h ] && mkdir -p $ISO_TARGET/usr/include/gnu && cp /usr/include/gnu/stubs.h $ISO_TARGET/usr/include/gnu/stubs.h
touch $ISO_TARGET/.etcf
--- NEW FILE: init ---
#!/bin/bash
if grep -qw $ISO_TARGET/proc /proc/mounts ; then
umount $ISO_TARGET/proc
fi
if [ -d "$ISO_TARGET" ] ; then
rm -rf $ISO_TARGET
fi
mkdir -p $ISO_TARGET
touch $ISO_TARGET/.init
--- NEW FILE: initrd ---
#!/bin/bash
. /etc/lunar/config
cd $ISO_SOURCE/initrd
umount template/dev
umount template/proc
rm -rf BUILD
cp -a template BUILD
# compile the initrd image
mkdir -p BUILD/lib/modules/${ISO_KVER}-ll-${ISO_KREL}/kernel/drivers/
cp -a $ISO_TARGET/lib/modules/${ISO_KVER}-ll-${ISO_KREL}/kernel/drivers/{ide,scsi} BUILD/lib/modules/${ISO_KVER}-ll-${ISO_KREL}/kernel/drivers/
# TODO compile multiple kernels:
depmod -b BUILD/ -a -F $ISO_TARGET/usr/src/linux-${ISO_KVER}/System.map
# install discover in the initrd BUILD
mkdir -p BUILD/{bin,etc} BUILD/usr/share/discover/dtd
cp $ISO_SOURCE/discover/discover BUILD/bin/
cp $ISO_SOURCE/discover/discover.conf BUILD/etc/
cp $ISO_SOURCE/discover/conffile.dtd BUILD/usr/share/discover/dtd/
cp $ISO_SOURCE/discover/discover.dtd BUILD/usr/share/discover/dtd/
cp $ISO_SOURCE/discover/data/* BUILD/usr/share/discover/
# make sure this is absolutely minimal:
for file in $(find BUILD/{lib,bin,sbin,usr}); do
strip $file 2> /dev/null
done
# calculate the size of the initrd image
SIZE=$(du -kcs BUILD | tail -1 | cut -f1)
echo "+ estimated $SIZE"
SIZE=7220
echo "+ used size $SIZE"
dd if=/dev/zero of=initrd.raw bs=1024 count=$SIZE
mkfs.ext2 -b 1024 -m 0 -i 1024 -N 2100 initrd.raw
mkdir BUILD.mnt
losetup /dev/loop/0 initrd.raw
mount /dev/loop/0 BUILD.mnt
cp -a BUILD/* BUILD.mnt/
df -h BUILD.mnt/
umount BUILD.mnt
tune2fs -l /dev/loop/0 | grep -e 'Free'
losetup -d /dev/loop/0
[ -f initrd ] && rm initrd
gzip -c initrd.raw > initrd
rm -rf initrd.raw BUILD.mnt BUILD
--- NEW FILE: isofs ---
#!/bin/bash
cd $ISO_TARGET
touch .lunar-cd
mkisofs -o ../lunar-${ISO_VERSION}.iso -R \
-V "Lunar-Linux ${ISO_CODENAME}" -v \
-d -D -N -no-emul-boot -boot-load-size 4 -boot-info-table \
-b isolinux/isolinux.bin \
-c isolinux/boot.cat \
-A "Lunar-${ISO_VERSION}" .
rm -f .lunar.cd
--- NEW FILE: isolinux ---
#!/bin/bash
. /etc/lunar/config
rm -rf $ISO_TARGET/isolinux
mkdir $ISO_TARGET/isolinux
cp $ISO_SOURCE/initrd/initrd $ISO_TARGET/isolinux/
cp $ISO_SOURCE/kernel/linux $ISO_TARGET/isolinux/
cp $ISO_SOURCE/kernel/safe $ISO_TARGET/isolinux/
cp $ISO_SOURCE/memtest/memtest $ISO_TARGET/isolinux/
cd $ISO_SOURCE/isolinux
for file in f{1,2,3}.txt boot.cat isolinux.bin isolinux.cfg ; do
VERBOSE=off
cp $file $ISO_TARGET/isolinux
sedit "s:%VERSION%:${ISO_VERSION}:g" $ISO_TARGET/isolinux/f?.txt
sedit "s:%CODENAME%:${ISO_CODENAME}:g" $ISO_TARGET/isolinux/f?.txt
done
--- NEW FILE: memtest ---
#!/bin/bash
. /etc/lunar/config
unset VERBOSE
optimize
BUILD_DIRECTORY=${ISO_SOURCE}/memtest
cd ${ISO_SOURCE}/memtest
# build curl without ssl first statically
(
run_details memtest86+
unpack $(sources memtest86+)
cd $SOURCE_DIRECTORY
make
cd ${ISO_SOURCE}/memtest
cp $SOURCE_DIRECTORY/memtest.bin memtest
rm -rf $SOURCE_DIRECTORY
)
--- NEW FILE: proper ---
#!/bin/bash
echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
echo "+ PRIMARY COMPILE PHASE COMPLETED +"
echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
echo ""
echo "Broken compiles:"
(cd $ISO_TARGET/var/build && ls -1)
echo ""
echo "Press ENTER to continue with cleanup && .iso generation"
read
umount $ISO_TARGET/proc
. /etc/lunar/config
unset VERBOSE
optimize
echo "+ setting sane ccache limits"
chroot $ISO_TARGET ccache -C
chroot $ISO_TARGET ccache -M 256M
# store the list of stuff in /var/cache that needs to be resurrected:
echo "+ creating list of prepackaged modules"
> $ISO_TARGET/prepackaged
for mod in $(cat conf/base.list conf/extended.list) ; do
grep "^$mod:" $ISO_TARGET/var/state/lunar/packages >> $ISO_TARGET/prepackaged
done
echo "+ wiping sources"
rm -f $ISO_TARGET/var/spool/lunar/*
for mod in $(cat sources.list) ; do
for file in $(lvu sources $mod) ; do
echo -n "."
if [ -f ${ISO_SOURCE}/spool/$file ] ; then
cp -p ${ISO_SOURCE}/spool/$file $ISO_TARGET/var/spool/lunar/
fi
done
done
echo "+ cleaning out file structure"
cat $ISO_TARGET/var/log/lunar/install/* | sort | tac | while read LINE; do
rm -f "$ISO_TARGET$LINE" 2> /dev/null
done
echo "+ cleaning temporary and unneeded files"
rm -rf $ISO_TARGET/var/log/lunar/*/* > /dev/null
rm -f $ISO_TARGET/var/log/ccache > /dev/null
rm -rf $ISO_TARGET/usr/share/{info,man,doc}/* > /dev/null
rm -rf $ISO_TARGET/usr/include > /dev/null
rm -rf $ISO_TARGET/etc/ssh/ssh_host_*key $ISO_TARGET/etc/ssh/ssh_host_*key.pub
rm -rf $ISO_TARGET/tmp/*
rm -rf $ISO_TARGET/var/tmp/*
rm -rf $ISO_TARGET/var/lock/*
rm -rf $ISO_TARGET/var/run/*
rm -rf $ISO_TARGET/var/state/lunar/module_history/*
> $ISO_TARGET/var/log/lunar/activity
rm -f $ISO_TARGET/root/.bash_history
# this is a space killer:
echo "+ stripping binaries"
find $ISO_TARGET -name "*.a" -o -name "*.so*" -exec strip {} \; 2> /dev/null
# moonbase
echo "+ archiving moonbase"
if [ -d $ISO_TARGET/var/lib/lunar/moonbase ] ; then (
cd $ISO_TARGET/var/lib/lunar
tar cjf moonbase.tar.bz2 moonbase/
rm -rf moonbase
); fi
# kernel src!
##echo "+ archiving kernel source"
##if [ -d $ISO_TARGET/usr/src/linux-${ISO_KVER} ]; then (
## chroot $ISO_TARGET depmod -F /usr/src/linux/System.map
## cd $ISO_TARGET/usr/src &&
## tar cjf linux-${ISO_KVER}.tar.bz2 linux-${ISO_KVER}/
## rm -rf linux-${ISO_KVER}
##); fi
echo "+ finishing up"
chroot $ISO_TARGET ldconfig
# copy the installed code over:
cp lunar-install/init.d/lunar-install $ISO_TARGET/etc/init.d/
ln -s /etc/init.d/lunar-install $ISO_TARGET/etc/rc3.d/S20lunar-install
cp lunar-install/sbin/lunar-install $ISO_TARGET/sbin/
sedit "s:%VERSION%:${ISO_VERSION}:g" $ISO_TARGET/sbin/lunar-install $ISO_TARGET/etc/motd
sedit "s:%CODENAME%:${ISO_CODENAME}:g" $ISO_TARGET/sbin/lunar-install $ISO_TARGET/etc/motd
# need more:
ln -s ../init.d/discover $ISO_TARGET/etc/rcS.d/S30discover
touch BUILD/.proper
--- NEW FILE: rebuild ---
#!/bin/bash
echo "+ Starting rebuild of all modules"
. /etc/lunar/config
export VERBOSE=off
optimize
# first things first
chroot $ISO_TARGET /sbin/ldconfig
# rebuild all modules
chroot $ISO_TARGET lunar set ARCHIVE on
chroot $ISO_TARGET lin kernel-headers
chroot $ISO_TARGET lin makedev
mount -t proc proc $ISO_TARGET/proc
chroot $ISO_TARGET /dev/install-devices.sh
chroot $ISO_TARGET rm -rf /var/build/makedev-*
echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
echo "+ STARTING KERNEL COMPILE +"
echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
echo ""
chroot $ISO_TARGET lin linux
echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
echo "+ STARTING CONFIGURING MODULES +"
echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
echo ""
for mod in $(cat conf/base.list conf/extended.list) ; do
chroot $ISO_TARGET /sbin/lin --deps $mod
done
echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
echo "+ STARTING COMPILE PHASE OF ALL MODULES +"
echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
echo ""
chroot $ISO_TARGET lin perl
for mod in $(cat conf/base.list conf/extended.list) ; do
chroot $ISO_TARGET /sbin/lin -c $mod
done
echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
echo "+ REBUILD FINISHED +"
echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
umount $ISO_TARGET/proc
touch $ISO_TARGET/.rebuild
--- NEW FILE: unpack ---
#!/bin/bash
. /etc/lunar/config
export VERBOSE=off
optimize
resurrect ()
{
CACHE=$1-$(module_version $1)-$BUILD.tar.bz2
if [ ! -f cache/$CACHE ]; then
echo "# $CACHE"
cp /var/cache/lunar/$CACHE cache/
fi
if [ ! -f cache/$CACHE ] ; then
echo -e "\n! $1: $CACHE missing"
else
echo -n "+"
tar xjf cache/$CACHE -C $ISO_TARGET > /dev/null 2>&1
echo "$1:$ISO_DATE:installed:$(module_version $1):" >> $ISO_TARGET/var/state/lunar/packages
echo "$1:$ISO_DATE:installed:$(module_version $1):" >> $ISO_TARGET/var/state/lunar/packages.backup
fi
}
# unpack all the ISO required var/cache/lunar tarballs
# in case of file conflict preserve glibc and gcc files first!
for mods in ${ISO_LUNAR_MODULE} $(cat conf/base.list conf/extended.list) ; do
resurrect $mods
done
# fill var/spool/lunar dir
for mod in $(cat conf/sources.list conf/base.list conf/extended.list) ; do
for file in $(lvu sources $mod) ; do
echo -n "."
if [ -f ${ISO_SOURCE}/spool/$file ] ; then
cp -p ${ISO_SOURCE}/spool/$file $ISO_TARGET/var/spool/lunar/
elif [ -f /var/spool/lunar/$file ] ; then
echo -e "\n# /var/spool/lunar/$file"
cp -p /var/spool/lunar/$file ${ISO_SOURCE}/spool/
cp -p /var/spool/lunar/$file $ISO_TARGET/var/spool/lunar/
else
echo -ne "\n! $mod: $file\n"
fi
done
done
echo
touch $ISO_TARGET/.unpack
More information about the Lunar-commits
mailing list