summaryrefslogtreecommitdiff
path: root/iso
blob: 462c67b8d40f50ffc31c682297730c2f007629f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/usr/bin/env bash

# Vasile needs root privileges and a proper kernel to run

kernelconfig
checkroot

prepareisox64 () {
	# we really need this folder as quick as possible
	mkdir -p "$isosyncdirx64"
	# create an empty 20GB ext4 fs were our rootfs will stay
	dd if=/dev/zero of=""$isosyncdirx64".img" bs=50M count=400
	mkfs.ext4 ""$isosyncdirx64".img"
	# create live iso layout
	mkdir -p "$isostagingdirx64"
	mkdir -p "$isobootdirx64"
	mkdir -p "$isoefibootdirx64"
	mkdir -p "$isoliveosdirx64"
	mkdir -p "$isosupersquashdirx64"
	mkdir -p "$isolivesqfsdirx64"
	# mount && copy core stage 4 image
	mount -t squashfs "$chrootx64" "$isostagingdirx64"
	mount -t ext4 ""$isosyncdirx64".img" "$isosyncdirx64"
	rsync -aHAXr --progress "$isostagingdirx64/" "$isosyncdirx64/"
	# copy kernel into cdroot
	cp -avx ""$isosyncdirx64"/boot/"$isokernelnamex64"" ""$isorootdirx64"/boot/vmlinuz"
	# generate live initramfs
	isostartx64
	isoramfsx64
	isostopx64
	# generate system initramfs
	isostartx64
	systemramfsx64
	isostopx64
	# copy live initramfs into cdroot
	mv ""$isosyncdirx64"/boot/"$isodracutrd"" ""$isorootdirx64"/boot/initrd"
	# generate live efi image
	isostartx64
	isoefiimgx64
	isostopx64
	# copy efi image into cdroot
	mv ""$isosyncdirx64"/root/bootx64.efi" "$isoefibootdirx64"
	chmod 755 ""$isoefibootdirx64"/bootx64.efi"
	# configure portage && give up control for package / desktop environment installation
	isostartx64
	isooverlaysx64
	isobuildsystemx64
	isochrootx64
	isostopx64
	# unmount rootfs before compression
	umount -l "$isosyncdirx64" > /dev/null 2>&1
	# move rootfs in place
	mv ""$isosyncdirx64".img"  "$isolivesqfsdirx64"
	# squash rootfs with best compression
	mksquashfs "$isosupersquashdirx64" ""$isorootdirx64"/squashfs.img" -b 1048576 -comp xz -Xdict-size 100%
	# move squashed rootfs in place
	mv ""$isorootdirx64/"squashfs.img" "$isoliveosdirx64"
}

bootcoreisox64 () {
	# configure live bootloader
	git clone https://gitlab.com/"$releasename"/boot-core.git "$bootcorepath"
	cp -avx "$bootcorefiles" "$isorootdirx64"
}

cleanupisox64 () {
	umount "$isostagingdirx64"
	rm -rf "$isosyncdirx64"
	rm -rf "$isostagingdirx64"
	rm -rf "$isosupersquashdirx64"
	rm -rf "$bootcorepath"
}

makeisox64 () {
	grub2-mkrescue -o ""$releasename"-"$releasetarget"-"$releaseversion"-"$isomainarchx64".iso" "$isorootdirx64"
}

main () {
	chrootchecksumx64
	prepareisox64
	bootcoreisox64
	cleanupisox64
	makeisox64
}

main