summaryrefslogtreecommitdiff
path: root/iso32
blob: 0873fc1f01685b63ce0e14cf0d6196c2d8a439f5 (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
#!/usr/bin/env bash

# Vasile needs root privileges and a proper kernel to run

kernelconfig
checkroot

prepareisox86 () {
	# we really need this folder as quick as possible
	mkdir -p "$isosyncdirx86"
	# create an empty 20GB ext4 fs were our rootfs will stay
	dd if=/dev/zero of=""$isosyncdirx86".img" bs=50M count=400
	mkfs.ext4 ""$isosyncdirx86".img"
	# create live iso layout
	mkdir -p "$isostagingdirx86"
	mkdir -p "$isobootdirx86"
	mkdir -p "$isoliveosdirx86"
	mkdir -p "$isosupersquashdirx86"
	mkdir -p "$isolivesqfsdirx86"
	# mount && copy core stage 4 image
	mount -t squashfs "$chrootx86" "$isostagingdirx86"
	mount -t ext4 ""$isosyncdirx86".img" "$isosyncdirx86"
	rsync -aHAXr --progress "$isostagingdirx86/" "$isosyncdirx86/"
	# copy kernel into cdroot
	cp -avx ""$isosyncdirx86"/boot/"$isokernelnamex86"" ""$isorootdirx86"/boot/vmlinuz"
	# generate live initramfs
	isostartx86
	isoramfsx86
	isostopx86
	# copy live initramfs
	mv ""$isosyncdirx86"/boot/"$isoramfsname"" ""$isorootdirx86"/boot/initrd"
	# configure portage && give up control for package / desktop environment installation
	isostartx86
	isooverlaysx86
	isobuildsystemx86
	isochrootx86
	isostopx86
	# umount rootfs before compression
	umount -l "$isosyncdirx86" > /dev/null 2>&1
	# move rootfs in place
	mv ""$isosyncdirx86".img"  "$isolivesqfsdirx86"
	# squash rootfs with best compression
	mksquashfs "$isosupersquashdirx86" ""$isorootdirx86"/squashfs.img" -b 1048576 -comp xz -Xdict-size 100%
	# move squashed rootfs in place
	mv ""$isorootdirx86"/squashfs.img" "$isoliveosdirx86"
}

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

cleanupisox86 () {
	umount "$isostagingdirx86"
	rm -rf "$isosyncdirx86"
	rm -rf "$isostagingdirx86"
	rm -rf "$bootcorepath"
	rm -rf "$isosupersquashdirx86"
}

makeisox86 () {
	grub2-mkrescue -o ""$releasename"-"$releasetarget"-"$releaseversion"-"$isomainarchx86".iso" "$isorootdirx86"
}

main () {
	chrootchecksumx86
	prepareisox86
	bootcoreisox86
	cleanupisox86
	makeisox86
}

main