|
|
@ -21,13 +21,12 @@ set -eu
|
|
|
|
# Boston, MA 02110-1301 USA. #
|
|
|
|
# Boston, MA 02110-1301 USA. #
|
|
|
|
##########################################################################
|
|
|
|
##########################################################################
|
|
|
|
|
|
|
|
|
|
|
|
# Depends: debootstrap, rsync, python-minimal|python, procps, squashfs-tools, ltsp-server [i386]
|
|
|
|
# Depends: debootstrap, rsync, python-minimal|python, procps, squashfs-tools, ltsp-server [i386], genext2fs
|
|
|
|
|
|
|
|
|
|
|
|
cleanup() {
|
|
|
|
cleanup() {
|
|
|
|
for mnt in ${ROOT}dev/pts ${ROOT}dev/shm ${ROOT}.dev ${ROOT}dev \
|
|
|
|
for mnt in ${ROOT}dev/pts ${ROOT}dev/shm ${ROOT}.dev ${ROOT}dev \
|
|
|
|
${ROOT}proc/sys/fs/binfmt_misc ${ROOT}proc ${ROOT}sys \
|
|
|
|
${ROOT}proc/sys/fs/binfmt_misc ${ROOT}proc ${ROOT}sys \
|
|
|
|
${ROOT}lib/modules/*/volatile ${ROOT}var/{lock,run} \
|
|
|
|
${ROOT}lib/modules/*/volatile ${ROOT}var/{lock,run}; do
|
|
|
|
`pwd`/mount-livefs; do
|
|
|
|
|
|
|
|
umount $mnt || true
|
|
|
|
umount $mnt || true
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
|
@ -75,33 +74,16 @@ livefs_squash()
|
|
|
|
chmod 644 livecd.${FSS}.squashfs
|
|
|
|
chmod 644 livecd.${FSS}.squashfs
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# This function could be extended for other non-ext filesystems, but
|
|
|
|
livefs_ext2()
|
|
|
|
# they aren't consistant on how you format a non-block device
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
livefs_ext()
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
# Add 10MiB extra free space for first boot + ext3 journal
|
|
|
|
# Add 10MiB extra free space for first boot + ext3 journal
|
|
|
|
size=$((($(du -sx --block-size=1024 ${ROOT} | cut -f1) + (10240)) * 1024))
|
|
|
|
size=$(($(du -ks ${ROOT} | cut -f1) + (10240)))
|
|
|
|
mountpoint=`pwd`/mount-livefs/
|
|
|
|
echo "Building ext2 filesystem."
|
|
|
|
echo "Building $IMAGEFORMAT filesystem."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# remove any stale filesystem images
|
|
|
|
# remove any stale filesystem images
|
|
|
|
rm -f livecd.${FSS}.$IMAGEFORMAT
|
|
|
|
rm -f livecd.${FSS}.squashfs
|
|
|
|
|
|
|
|
|
|
|
|
# Make blank filesystem, and loopmount it
|
|
|
|
genext2fs -b $size -d ${ROOT} livecd.${FSS}.ext2
|
|
|
|
dd if=/dev/zero of=livecd.$FSS.$IMAGEFORMAT bs=$size count=1
|
|
|
|
|
|
|
|
mkfs -t $IMAGEFORMAT -F livecd.$FSS.$IMAGEFORMAT
|
|
|
|
|
|
|
|
rm -fr $mountpoint
|
|
|
|
|
|
|
|
mkdir $mountpoint
|
|
|
|
|
|
|
|
mount -o loop ./livecd.$FSS.$IMAGEFORMAT $mountpoint
|
|
|
|
|
|
|
|
rm -fr $mountpoint/lost+found
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Copy everything from the rootfs into the ext2 image
|
|
|
|
|
|
|
|
cp -ar $ROOT/* $mountpoint
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Call cleanup again to unmount everything and make sure loop0 is cleared
|
|
|
|
|
|
|
|
cleanup
|
|
|
|
|
|
|
|
rm -rf mount-livefs
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if [ $(id -u) != 0 ];then
|
|
|
|
if [ $(id -u) != 0 ];then
|
|
|
@ -686,13 +668,18 @@ Pin-Priority: 550
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Build our images
|
|
|
|
# Build our images
|
|
|
|
if [ "$IMAGEFORMAT" = "ext2" ] || [ "$IMAGEFORMAT" = "ext3" ] \
|
|
|
|
if [ "$IMAGEFORMAT" = "ext2" ] || [ "$IMAGEFORMAT" = "ext3" ]; then
|
|
|
|
|| [ "$IMAGEFORMAT" = "ext4" ]; then
|
|
|
|
livefs_ext2
|
|
|
|
livefs_ext
|
|
|
|
|
|
|
|
else
|
|
|
|
else
|
|
|
|
livefs_squash
|
|
|
|
livefs_squash
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Upgrade ext2->ext3 if that's what is requested
|
|
|
|
|
|
|
|
if [ "$IMAGEFORMAT" = "ext3" ]; then
|
|
|
|
|
|
|
|
tune2fs -j livecd.${FSS}.ext2
|
|
|
|
|
|
|
|
mv livecd.${FSS}.ext2 livecd.${FSS}.ext3
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# LTSP chroot building (only in 32bit and for Edubuntu (DVD))
|
|
|
|
# LTSP chroot building (only in 32bit and for Edubuntu (DVD))
|
|
|
|
case $FS in
|
|
|
|
case $FS in
|
|
|
|
edubuntu-dvd)
|
|
|
|
edubuntu-dvd)
|
|
|
|