diff options
author | V3n3RiX <venerix@rogentos.ro> | 2016-04-17 16:45:16 +0100 |
---|---|---|
committer | V3n3RiX <venerix@rogentos.ro> | 2016-04-17 16:45:16 +0100 |
commit | e77f752fe98e8458797e413c4373d5dee3c3c93f (patch) | |
tree | 24b53247c83f9400e595ab7b0dced38014b8c603 /buildiso | |
parent | dd36cf0cef322ca6d0bd7b2028e92fcf6538effe (diff) |
rename helper scripts to something more clear
Diffstat (limited to 'buildiso')
-rwxr-xr-x | buildiso | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/buildiso b/buildiso new file mode 100755 index 0000000..86c20b3 --- /dev/null +++ b/buildiso @@ -0,0 +1,87 @@ +#!/usr/bin/env bash + +# Vasile needs root privileges and a proper kernel to run + +kernelconfig +checkroot + +prepareiso () { + # we really need this folder as quick as possible + mkdir -p "$isosyncdir" + # create an empty 20GB ext4 fs were our rootfs will stay + dd if=/dev/zero of=""$isosyncdir".img" bs=50M count=400 + mkfs.ext4 ""$isosyncdir".img" + # create live iso layout + mkdir -p "$isostagingdir" + mkdir -p "$isobootdir" + mkdir -p "$isoefibootdir" + mkdir -p "$isoliveosdir" + mkdir -p "$isosupersquashdir" + mkdir -p "$isolivesqfsdir" + # mount && copy core stage 4 image + mount -t squashfs "$chrootx64" "$isostagingdir" + mount -t ext4 ""$isosyncdir".img" "$isosyncdir" + rsync -aHAXr --progress "$isostagingdir/" "$isosyncdir/" + # copy kernel into cdroot + cp -avx ""$isosyncdir"/boot/"$isokernelname"" ""$isorootdir"/boot/vmlinuz" + # generate live initramfs + isostart + isoramfs + isostop + # generate system initramfs + isostart + systemramfs + isostop + # copy live initramfs into cdroot + mv ""$isosyncdir"/boot/"$isodracutrd"" ""$isorootdir"/boot/initrd" + # generate live efi image + isostart + isoefiimg + isostop + # copy efi image into cdroot + mv ""$isosyncdir"/root/bootx64.efi" "$isoefibootdir" + chmod 755 ""$isoefibootdir"/bootx64.efi" + # configure portage && give up control for package / desktop environment installation + isostart + isooverlays + isobuildsystem + isousertree + isochroot + isostop + # unmount rootfs before compression + umount -l "$isosyncdir" > /dev/null 2>&1 + # move rootfs in place + mv ""$isosyncdir".img" "$isolivesqfsdir" + # squash rootfs with best compression + mksquashfs "$isosupersquashdir" ""$isorootdir"/squashfs.img" -b 1048576 -comp xz -Xdict-size 100% + # move squashed rootfs in place + mv ""$isorootdir/"squashfs.img" "$isoliveosdir" +} + +bootcoreiso () { + # configure live bootloader + git clone https://gitlab.com/"$releasename"/boot-core.git "$bootcorepath" + cp -avx "$bootcorefiles" "$isorootdir" +} + +cleanupiso () { + umount "$isostagingdir" + rm -rf "$isosyncdir" + rm -rf "$isostagingdir" + rm -rf "$isosupersquashdir" + rm -rf "$bootcorepath" +} + +makeiso () { + grub2-mkrescue -o ""$releasename"-"$releasetarget"-"$releaseversion"-"$isomainarch".iso" "$isorootdir" +} + +main () { + chrootchecksum + prepareiso + bootcoreiso + cleanupiso + makeiso +} + +main |