Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=fvbe.git;a=commitdiff;h=66524c2e817f22d9801317a0ccd974e1e81e393c
commit 66524c2e817f22d9801317a0ccd974e1e81e393c Author: DeX77 <[email protected]> Date: Tue Aug 16 17:16:38 2016 +0200 * rewrite: don't need to be root for ISO creation diff --git a/bin/create-iso b/bin/create-iso index 756b3d7..6350680 100755 --- a/bin/create-iso +++ b/bin/create-iso @@ -49,12 +49,15 @@ rm -rf $FVBE_ROOT fvbe-$FVBE_ISO_RELEASE-$FVBE_ISO_TYPE-$FVBE_ARCH.iso tmp local # Create the skeleton directory. mkdir -p $FVBE_ROOT/{boot/grub/fonts,LiveOS} +# Copy created rootfs.img into LiveOS dir +cp squashfs.img $FVBE_ROOT/LiveOS + # Setup kernel and initrd. cp vmlinuz $FVBE_ROOT/boot/vmlinuz cp initrd $FVBE_ROOT/boot/initrd -# Setup squashfs image. -cp squashfs.img $FVBE_ROOT/LiveOS/squashfs.img +# Copy background.png into grub dir +cp background.png $FVBE_ROOT/boot/grub # Setup the pacman-g2 package cache. if [ -n "$FVBE_ISO_PACKAGES" ]; then @@ -94,6 +97,7 @@ set color_normal=white/black set color_highlight=black/white set menu_color_normal=white/black set menu_color_highlight=black/white + menuentry 'Frugalware Versatile Bootable Environment' { linux /boot/vmlinuz root=live:CDLABEL=FVBE quiet locale.LANG=\$locale vconsole.keymap=\$layout vconsole.font=$FVBE_FONT \$video initrd /boot/initrd diff --git a/bin/create-rootfs b/bin/create-rootfs index b4d9760..0fafc45 100755 --- a/bin/create-rootfs +++ b/bin/create-rootfs @@ -4,11 +4,6 @@ set -e . ./fvbe.conf -if [ "$(id -u)" -ne 0 ]; then - echo "You must be root to do this." - exit 1 -fi - if [ ! -e /usr/bin/re2c ]; then echo "re2c is missing" exit 1 @@ -24,6 +19,7 @@ if [ ! -e /usr/bin/xorriso ]; then exit 1 fi + if [ "$FVBE_ROOTFS_REPOSITORY" = "current" ]; then FDB=frugalware-current.fdb MIRROR="http://ftp.frugalware.org/pub/frugalware/frugalware-current/frugalware-$FVBE_ARCH" @@ -34,33 +30,10 @@ fi REPO=${FDB/.fdb/} # Cleanup from a previous run. -cp /proc/mounts mounts -while read line; do - path=$(echo $line | cut -f 2 -d ' ') - if [ "$path" = "$FVBE_ROOT" ]; then - continue - fi - if [ "$path" != "${path#$FVBE_ROOT}" ]; then - umount $path - fi -done < mounts -[ -d "$FVBE_ROOT" ] && umount $FVBE_ROOT -rm -rf $FVBE_ROOT vmlinuz initrd mounts rootfs.img squashfs.img pacman-g2.conf locales layouts unicode.pf2 $FDB - -# Create the virtual disk and mount it. -dd if=/dev/zero of=rootfs.img bs=$(( 128 * 1024 )) count=$(( ($FVBE_ROOTFS_SIZE * 1024 * 1024 * 1024) / (128 * 1024) )) -mkfs.ext4 -q -F rootfs.img -mkdir -p $FVBE_ROOT -mount -o loop rootfs.img $FVBE_ROOT +rm -rf $FVBE_ROOT vmlinuz initrd mounts rootfs.img pacman-g2.conf locales layouts unicode.pf2 $FDB LiveOS # Create root directory skeleton. mkdir -p $FVBE_ROOT/{dev,proc,sys,tmp,var/tmp,var/cache/pacman-g2,var/log,etc/sysconfig} -mount -t devtmpfs none $FVBE_ROOT/dev -mount -t sysfs none $FVBE_ROOT/sys -mount -t proc none $FVBE_ROOT/proc -mount -t tmpfs none $FVBE_ROOT/tmp -mount -t tmpfs none $FVBE_ROOT/var/tmp -mount -o bind /var/cache/pacman-g2 $FVBE_ROOT/var/cache/pacman-g2 # Setup pacman-g2.conf. cat > pacman-g2.conf << EOF @@ -71,15 +44,13 @@ Server = $MIRROR EOF # Setup root directory with pacman-g2. -pacman-g2 --root $FVBE_ROOT --noprogressbar --noconfirm --config pacman-g2.conf -Sy $FVBE_ROOTFS_PACKAGES +fakeroot -u pacman-g2 --root $FVBE_ROOT --noconfirm --noscriptlet --config pacman-g2.conf -Sy $FVBE_ROOTFS_PACKAGES # LiveCD customizations beyond here. # Install fwsetup. install -m 0755 bin/fwsetup $FVBE_ROOT/usr/sbin/fwsetup -install -m 0755 src/fwsetup-valgrind $FVBE_ROOT/usr/sbin/fwsetup-valgrind -install -m 0644 src/fwsetup.supp $FVBE_ROOT/usr/lib/valgrind/fwsetup.supp - + # Set the default systemd boot target. if [ -x "$FVBE_ROOT/usr/bin/X" ]; then ln -sf /lib/systemd/system/graphical.target $FVBE_ROOT/etc/systemd/system/default.target @@ -88,8 +59,8 @@ else fi # Install vi symlinks for installer. -ln -sf /usr/bin/vim $FVBE_ROOT/usr/bin/vi -ln -sf /usr/bin/vim $FVBE_ROOT/bin/vi +ln -sf $FVBE_ROOT/usr/bin/vim $FVBE_ROOT/usr/bin/vi +ln -sf $FVBE_ROOT/usr/bin/vim $FVBE_ROOT/bin/vi # Script for setting up the end-user customizations during boot-up. cat > $FVBE_ROOT/usr/libexec/fvbe-setup << EOF @@ -123,10 +94,8 @@ RemainAfterExit=yes [Install] WantedBy=multi-user.target EOF -chroot $FVBE_ROOT sh -c "systemctl enable fvbe.service" +ln -s $FVBE_ROOT/lib/systemd/system/fvbe.service $FVBE_ROOT/lib/systemd/system/multi-user.target.wants/fvbe.service -# Disable [email protected] and setup fwsetup.service. -chroot $FVBE_ROOT sh -c "systemctl disable [email protected]" cat > $FVBE_ROOT/lib/systemd/system/fwsetup.service << EOF [Unit] Description=FVBE Setup Launcher @@ -153,7 +122,7 @@ IgnoreSIGPIPE=no [Install] WantedBy=multi-user.target EOF -chroot $FVBE_ROOT sh -c "systemctl enable fwsetup.service" +ln -s $FVBE_ROOT/lib/systemd/system/fwsetup.service $FVBE_ROOT/lib/systemd/system/multi-user.target.wants/fwsetup.service # System fstab setup. cat > $FVBE_ROOT/etc/fstab << EOF @@ -166,10 +135,19 @@ none /dev/pts devpts gid=5,mode=620 0 0 EOF # Setup root user. -chroot $FVBE_ROOT sh -c "echo 'root:fvbe' | chpasswd" +sed -i '/root/d' $FVBE_ROOT/etc/shadow +echo "root:$(openssl passwd -1 fvbe):17014:0:::::" >> $FVBE_ROOT/etc/shadow # Setup guest user. -chroot $FVBE_ROOT sh -c "yes '' | adduser guest 'Guest User' fvbe /home/guest" +echo "guest:$(openssl passwd -1 fvbe):17014:0:99999:7:::" >> $FVBE_ROOT/etc/shadow +echo "guest:x:1006:100:Guest user:/home/guest:/bin/bash" >> $FVBE_ROOT/etc/passwd + +# Create needed users +systemd-sysusers --root $FVBE_ROOT + +# Create System ID +systemd-machine-id-setup --root $FVBE_ROOT --commit + # System hostname setup. cat > $FVBE_ROOT/etc/hostname << EOF @@ -194,41 +172,40 @@ done # Cache files or data from the ROOTFS that we'll use in the ISO. cp $FVBE_ROOT/boot/vmlinuz vmlinuz cp $FVBE_ROOT/boot/initrd initrd -cp $FVBE_ROOT/var/lib/pacman-g2/$FDB $FDB -chroot $FVBE_ROOT sh -c "locale --all-locales | grep '\\.utf8$' | sort --unique" > locales +cp $FVBE_ROOT/var/lib/pacman-g2/$FDB . + +localedef -f $FVBE_ROOT/usr/lib/locale/locale-archive --list-archive | grep '\\.utf8$' | sort --unique > locales + tail -n +3 $FVBE_ROOT/usr/share/systemd/kbd-model-map | cut -f 1 | sort --unique > layouts cp $FVBE_ROOT/usr/share/grub/unicode.pf2 unicode.pf2 # Prune unimportant paths. if [ "$FVBE_ROOTFS_CLEAN" = "yes" ]; then - rm -rf $FVBE_ROOT/boot/* rm -rf $FVBE_ROOT/usr/share/doc + rm -rf $FVBE_ROOT/boot/{initrd*,vmlinuz*} + rm -rf $FVBE_ROOT/usr/include + rm -rf $FVBE_ROOT/usr/share/gtk-doc + find $FVBE_ROOT -xdev -name '*.[ah]' -delete find $FVBE_ROOT -xdev -name '*.la' -delete fi -# Unmount all paths mounted earlier. -cp /proc/mounts mounts -while read line; do - path=$(echo $line | cut -f 2 -d ' ') - if [ "$path" = "$FVBE_ROOT" ]; then - continue - fi - if [ "$path" != "${path#$FVBE_ROOT}" ]; then - umount $path - fi -done < mounts -umount $FVBE_ROOT +# Move grub background out of rootfs +mv $FVBE_ROOT/boot/grub/background.png . + +# Remove downloaded packages +rm -rf $FVBE_ROOT/var/cache/pacman-g2/pkg/ + +# Now prepare the rootfs. +e2fsimage -f rootfs.img -d $FVBE_ROOT -t ext4 -S -s $(( $FVBE_ROOTFS_SIZE * 1024 * 1024 )) # Now shrink the rootfs.img to minimum size. -e2fsck -f -a rootfs.img -resize2fs -M rootfs.img -e2fsck -f -a rootfs.img +/sbin/resize2fs -M rootfs.img + +rm -rf $FVBE_ROOT/* +mkdir $FVBE_ROOT/LiveOS +mv rootfs.img $FVBE_ROOT/LiveOS/ + +mksquashfs $FVBE_ROOT squashfs.img -noappend -no-progress -all-root -comp $FVBE_ROOTFS_COMPRESS -Xbcj x86 -always-use-fragments -# Now prepare the squashfs. -mkdir -p $FVBE_ROOT/LiveOS -mv rootfs.img $FVBE_ROOT/LiveOS/rootfs.img -mksquashfs $FVBE_ROOT squashfs.img -noappend -no-progress -comp $FVBE_ROOTFS_COMPRESS -# Clean up leftovers. -rm -rf mounts $FVBE_ROOT _______________________________________________ Frugalware-git mailing list [email protected] http://frugalware.org/mailman/listinfo/frugalware-git
