-
Notifications
You must be signed in to change notification settings - Fork 0
/
img
executable file
·80 lines (55 loc) · 1.41 KB
/
img
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
#!/bin/sh
# Copyright (c) 2024, Firas Khalil Khana
# Distributed under the terms of the ISC License
if [ $(id -u) -ne 0 ]; then
echo "permission denied"
exit 1
fi
img="../glaucus-s6-x86-64-v3-$(date +"%Y%m%d").img"
len=10240
ver=6.10.6-3-cachyos
IMGD=../img
dd bs=1M count=$len if=/dev/zero of=$img
parted -s $img mklabel gpt
parted -s $img mkpart ESP fat32 1 65
parted -s $img set 1 esp on
parted -s $img mkpart ext4 65 $len
modprobe loop
losetup -D
device=$(losetup -f)
partitionOne=${device}p1
partitionTwo=${device}p2
losetup $device $img
partx -a $device
mkfs.fat -F 32 $partitionOne
mke2fs -qt ext4 $partitionTwo
rm -fr "$IMGD"
mkdir -p "$IMGD"
mount $partitionTwo "$IMGD"
cp -afT ../cross "$IMGD"
cp -af ../src "$IMGD"/var/cache/rad
mount $partitionOne "$IMGD"/boot
depmod -b "$IMGD" $ver
booster \
build \
--force \
--compression=zstd \
--kernel-version=$ver \
--modules-dir="$IMGD"/usr/lib/modules/$ver \
--config=../cerata/booster/booster.yaml \
--universal \
--strip \
"$IMGD"/boot/initramfs
cp -af ../cerata/limine/limine.conf.img "$IMGD"/boot/limine.conf
cp -af ../cross/boot/vmlinuz "$IMGD"/boot
mkdir -p "$IMGD"/boot/EFI/BOOT
cp -af /usr/share/limine/BOOTX64.EFI "$IMGD"/boot/EFI/BOOT
chown -R 0:0 "$IMGD"
chown -R 20:20 "$IMGD"/var/log/wtmpd
umount -fR "$IMGD"/boot
umount -fR "$IMGD"
partx -d $partitionOne
partx -d $partitionTwo
losetup -d $device
rm -fr "$IMGD"
echo "img complete"