-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgeniso
More file actions
executable file
·44 lines (36 loc) · 1.06 KB
/
geniso
File metadata and controls
executable file
·44 lines (36 loc) · 1.06 KB
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
#!/bin/sh
set -eu
# Required packages:
for x in \
dev-libs/libisoburn \
sys-boot/grub \
sys-fs/mtools \
sys-fs/squashfs-tools \
sys-kernel/dracut
do
qlist -Ie "$x" > /dev/null || emerge --ask=y -1 "$x"
done
ROOT="${1:-$PWD/root}"
ISO="${2:-$PWD/iso}"
OUT="${3:-$PWD/image.iso}"
mkdir -p "$ISO/LiveOS"
test -f "$ISO/LiveOS/squashfs.img" || mksquashfs "$ROOT" "$ISO/LiveOS/squashfs.img" -comp xz
kver="$(readlink "$ROOT/usr/src/linux")"
kver="${kver#linux-}"
# -r/--sysroot option currently *heavily* broken (dracut 059)
test -f "$ISO/LiveOS/initramfs.img" || dracut "$ISO/LiveOS/initramfs.img" "$kver" \
--xz \
--omit plymouth \
--add dmsquash-live
test -f "$ISO/LiveOS/bzImage" || cp "$ROOT/usr/src/linux/arch/x86/boot/bzImage" "$ISO/LiveOS/bzImage"
mkdir -p "$ISO/boot/grub"
cat > "$ISO/boot/grub/grub.cfg" << 'EOF'
set timeout=1
set gfxpayload=keep
insmod all_video
menuentry 'boot' {
linux /LiveOS/bzImage root=live:CDLABEL=ISOIMAGE loglevel=0
initrd /LiveOS/initramfs.img
}
EOF
grub-mkrescue -joliet -iso-level 3 -o "$OUT" "$ISO"