Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=fwlive.git;a=commitdiff;h=779d9a00196f83c225acebfc8acea2bf3e52fc33
commit 779d9a00196f83c225acebfc8acea2bf3e52fc33 Author: Miklos Vajna <vmik...@frugalware.org> Date: Sun Oct 30 12:58:07 2011 +0100 Initial import of a dracut-based approach (without aufs) diff --git a/dracut/01create-rootfs.sh b/dracut/01create-rootfs.sh new file mode 100755 index 0000000..134b1c3 --- /dev/null +++ b/dracut/01create-rootfs.sh @@ -0,0 +1,56 @@ +#!/bin/bash + +. /etc/makepkg.conf + +chroot_umount() { + echo "Attempting to umount chroot directories..." + umount $CHROOTDIR/proc >/dev/null + umount $CHROOTDIR/sys >/dev/null + umount $CHROOTDIR/var/cache/pacman-g2 >/dev/null + if [ "$?" != "0" ]; then + echo "An error occurred while attempting to umount chroot directories." + exit 1 + fi + echo "Successfully umounted chroot directories." +} + +chroot_mount() { + echo "Attempting to mount chroot directories..." + mount -t proc none $CHROOTDIR/proc >/dev/null + mount -t sysfs none $CHROOTDIR/sys >/dev/null + mount -o bind /var/cache/pacman-g2 $CHROOTDIR/var/cache/pacman-g2 >/dev/null + if [ "$?" != "0" ]; then + echo "An error occurred while attempting to mount chroot directories." + exit 1 + fi + echo "Successfully mounted chroot directories." +} + + +CHROOTDIR="$PWD/rootfs" + +# Create the chroot environment. +if [ "`id -u`" != 0 ]; then + echo "Building the chroot as an unprivileged user is not possible." + exit 1 +fi + +rm -rf $CHROOTDIR +mkdir -p $CHROOTDIR/{etc,proc,sys,var/cache/pacman-g2,var/tmp/fst,tmp,var/log} + +chroot_mount + +echo "Building chroot environment" + +cat >pacman-g2.conf <<EOF +[options] +Include = /etc/pacman-g2/repos/frugalware-current +EOF +pacman -Sy base -r "$CHROOTDIR" --noconfirm --config pacman-g2.conf + +if [ "$?" != "0" ]; then + echo "Failed to build chroot environment." + chroot_umount + exit 1 +fi +chroot_umount diff --git a/dracut/02create-squash.sh b/dracut/02create-squash.sh new file mode 100755 index 0000000..4329b3a --- /dev/null +++ b/dracut/02create-squash.sh @@ -0,0 +1,29 @@ +#!/bin/bash -xe + +CHROOTDIR="$PWD/rootfs" + +if [ "`id -u`" != 0 ]; then + echo "Not root" + exit 1 +fi + +chroot $CHROOTDIR sh -c 'echo "root:fwlive" | chpasswd' +rm -f rootfs.img +dd if=/dev/zero of=rootfs.img bs=1M count=1024 +mkfs.ext4 -F rootfs.img +loop=$(mktemp -d) +mount -o loop rootfs.img $loop +cp -a $CHROOTDIR/* $loop +df -h $loop +umount $loop +rmdir $loop + +# TODO see later if this reduces size +#e2fsck -f rootfs.img +#resize2fs rootfs.img -M + +mkdir -p squashfs-root/LiveOS +mv rootfs.img squashfs-root/LiveOS +# TODO can be xz +rm -f squashfs.img +mksquashfs squashfs-root squashfs.img -comp gzip diff --git a/dracut/03create-iso.sh b/dracut/03create-iso.sh new file mode 100755 index 0000000..c076363 --- /dev/null +++ b/dracut/03create-iso.sh @@ -0,0 +1,6 @@ +#!/bin/bash -xe + +rm -rf iso +mkdir -p iso/LiveOS +cp -v squashfs.img iso/LiveOS +mkisofs -R -J -V frugal-minim-x86_64-201110300111 -o live.iso iso diff --git a/dracut/04boot-qemu.sh b/dracut/04boot-qemu.sh new file mode 100755 index 0000000..e27cd6a --- /dev/null +++ b/dracut/04boot-qemu.sh @@ -0,0 +1 @@ +qemu-system-x86_64 -enable-kvm -m 512 -kernel rootfs/boot/vmlinuz -initrd rootfs/boot/initrd.img.xz -append "root=live:CDLABEL=frugal-minim-x86_64-201110300111 rootfstype=auto ro liveimg rd.luks=0 rd.md=0 rd.dm=0 rd.driver.pre=loop" -cdrom live.iso _______________________________________________ Frugalware-git mailing list Frugalware-git@frugalware.org http://frugalware.org/mailman/listinfo/frugalware-git