summaryrefslogtreecommitdiff
path: root/iso/mkiso.sh
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2023-01-15 21:24:17 +0000
committerdavidovski <david@davidovski.xyz>2023-01-15 21:24:17 +0000
commitc42abbd0f192a5d4a6a58fd901f45d2c06b018b5 (patch)
tree97d66bc36097e64e71c4b34ec28af39776f04427 /iso/mkiso.sh
parentc74352c21a8ece4fc5c4e33afb13947b1ff82e44 (diff)
Add installer to isov1.7.6
Diffstat (limited to 'iso/mkiso.sh')
-rwxr-xr-xiso/mkiso.sh93
1 files changed, 93 insertions, 0 deletions
diff --git a/iso/mkiso.sh b/iso/mkiso.sh
new file mode 100755
index 0000000..925c52a
--- /dev/null
+++ b/iso/mkiso.sh
@@ -0,0 +1,93 @@
+#!/bin/sh
+
+ISO_NAME="xilinux-$(date -u +%Y%m%d)"
+ISO_LABEL="xilinux"
+PUBLISHER="davidovski"
+SYSLINUX_VER=6.04-pre1
+
+XI_ARGS=""
+
+chroot=/tmp/chroot
+isoroot=/tmp/iso
+iso_pkgs="linux linux-firmware base dracut grub bash xipkg squashfs-tools lvm2 cryptsetup networkmanager stty xitui"
+
+create_basesystem () {
+ xi $XI_ARGS sync
+ xi $XI_ARGS -r "$chroot" bootstrap
+ xi $XI_ARGS -r "$chroot" install "$iso_pkgs"
+
+ cat > $chroot/etc/resolv.conf << EOF
+nameserver 80.80.80.80
+EOF
+
+ hostname=xilinux
+ echo xilinux > $chroot/etc/hostname
+
+ cat > $chroot/etc/hosts << EOF
+127.0.0.1 localhost
+::1 localhost
+127.0.1.1 $hostname.local $hostname
+EOF
+
+ cp -r ./root $chroot/
+
+ cat > $chroot/etc/conf.d/agetty << EOF
+agetty_options="--autologin root --noclear"
+EOF
+
+}
+
+build_initramfs () {
+ kernel_version=$(ls $chroot/usr/lib/modules | tail -1)
+ mkdir -p "$chroot"/var/tmp
+ xichroot "$chroot" dracut --nomdadmconf --nolvmconf --xz --add dmsquash-live --add bash --add convertfs --add pollcdrom --force --kver $kernel_version
+}
+
+create_isoroot() {
+ mkdir -p $isoroot/
+ cp $chroot/boot/vmlinuz-** $isoroot/vmlinuz
+ cp $chroot/boot/initramfs-** $isoroot/initrd.img
+
+ mkdir -p $isoroot/isolinux
+}
+
+install_syslinux () {
+ curl https://mirrors.edge.kernel.org/pub/linux/utils/boot/syslinux/Testing/$(echo $SYSLINUX_VER | cut -d'-' -f1)/syslinux-$SYSLINUX_VER.tar.xz > syslinux-$SYSLINUX_VER.tar.xz
+
+ tar -C /tmp -xf syslinux-$SYSLINUX_VER.tar.xz
+ #cp syslinux-$SYSLINUX_VER
+ cp /tmp/syslinux-$SYSLINUX_VER/bios/core/isolinux.bin $isoroot/isolinux/isolinux.bin
+ cp /tmp/syslinux-$SYSLINUX_VER/bios/com32/elflink/ldlinux/ldlinux.c32 $isoroot/isolinux/ldlinux.c32
+}
+
+build_iso () {
+ cat > $isoroot/isolinux/isolinux.cfg << EOF
+default 1
+
+label 1
+ kernel /vmlinuz
+ append initrd=/initrd.img splash console=tty0 console=ttyS0,9600 root=live:CDLABEL=xilinux rd.live.dir=/ rd.live.squashimg=filesystem.squashfs rd.live.debug=1 quiet
+
+EOF
+
+ mksquashfs $chroot $isoroot/filesystem.squashfs -noappend -no-progress -e "/proc/*" -e "/dev/*" -e "/sys/*"
+ genisoimage -r -V "$ISO_LABEL" -cache-inodes -J -l \
+ -allow-limited-size -udf \
+ -b isolinux/isolinux.bin -c isolinux/boot.cat \
+ -no-emul-boot -boot-load-size 4 -boot-info-table \
+ -p "$PUBLISHER <xi@davidovski.xyz>" \
+ -A "$ISO_LABEL" -o "$ISO_NAME.iso" $isoroot
+}
+
+
+[ "$#" = 0 ] && {
+ create_basesystem
+ build_initramfs
+ create_isoroot
+ install_syslinux
+ build_iso
+} || {
+ for task in $*; do
+ $task
+ done
+}