evolution-mklive/createiso.sh

44 lines
2.1 KiB
Bash
Executable File

#!/bin/sh
# Cleanup
if [[ "$1" = "x86_64" ]]; then
arch="x86_64"
grubarch="i386"
elif [[ "$1" = "i686" ]]; then
arch="i686"
grubarch="i386"
else
echo "The first argument should be the arch: x86_64 or i686"
exit 1
fi
rm "squash/LiveOS/ext3fs.img"
rm "base-iso/LiveOS/squashfs.img"
rm -r "./rootfs-${arch}"
# Build
XBPS_ARCH="${arch}" xbps-install -Sy -r ./rootfs-${arch} -R https://evolutionos.hectabit.org/pkg -R https://repo-default.voidlinux.org/current -S base-system grub-${grubarch}-efi
XBPS_ARCH="${arch}" xbps-install -Sy -r ./rootfs-${arch} dialog e2fsprogs btrfs-progs dosfstools ncurses parted xtools-minimal
cp "./scripts/"* "./rootfs-${arch}/usr/bin/"
cp "./rcboot-real.sh" "./rootfs-${arch}/etc/dinit.d/rcboot-real.sh"
cp "rcboot-installer.sh" "./rootfs-${arch}/etc/dinit.d/rcboot.sh"
umount -l "./rootfs-${arch}"/*
xbps-reconfigure -r "./rootfs-${arch}" -a -f
cp -r "./vfat-modules" "./rootfs-${arch}/root/vfat-modules"
ROOTFS="./rootfs-${arch}"
ROOTFS_SIZE=$(du --apparent-size -sm "$ROOTFS"|awk '{print $1}')
truncate -s "$((ROOTFS_SIZE+ROOTFS_SIZE))M" "./squash/LiveOS/ext3fs.img"
mkfs.ext3 -F -m1 "./squash/LiveOS/ext3fs.img"
mount -o loop "./squash/LiveOS/ext3fs.img" "./tmp-rootfs"
printf "evolution\nevolution" | xchroot "./rootfs-${arch}" passwd
echo "Password Changed"
umount -l "./rootfs-${arch}"/*
rm -rf "./tmp-rootfs/var/cache/xbps/*"
cp -a "$ROOTFS"/* "./tmp-rootfs/"
printf "evolution\nevolution" | xchroot "./tmp-rootfs" passwd
echo "Password Changed... again"
umount -f "./tmp-rootfs"
mksquashfs "./squash" "base-iso/LiveOS/squashfs.img" -comp xz
chmod 444 "base-iso/LiveOS/squashfs.img"
cd base-iso
xorriso -as mkisofs -iso-level 3 -rock -joliet -max-iso9660-filenames -omit-period -omit-version-number -relaxed-filenames -allow-lowercase -volid "EVOLUTION_LIVE" -eltorito-boot boot/isolinux/isolinux.bin -eltorito-catalog boot/isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -e boot/grub/efiboot.img -isohybrid-gpt-basdat -no-emul-boot -isohybrid-mbr /usr/lib/syslinux/isohdpfx.bin --output ../evolutionos.iso ./
cd ..
echo "Done"