-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgen
More file actions
executable file
·126 lines (101 loc) · 2.2 KB
/
gen
File metadata and controls
executable file
·126 lines (101 loc) · 2.2 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
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#!/bin/sh
# SPDX-License-Identifier: MPL-2.0
# Copyright © 2026 Firas Khana
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
set -eu
ver="$(uname -r)"
core='/var/lib/rad/repo/core'
gen='../gen'
mod="/usr/lib/modules/$ver/kernel"
rm -fR \
"$gen" \
../initramfs
mkdir -p "$gen"
cd "$gen"
mkdir -p \
dev \
etc \
media/fs-ro \
media/fs-rw \
media/iso \
mnt/root \
run \
usr/bin \
usr/lib/modules/$ver/kernel/drivers/usb
mkdir -m 555 -p \
proc \
sys
ln -fs usr/bin bin
ln -fs usr/lib lib
ln -fs usr/bin sbin
ln -fs bin usr/sbin
cp -fPp ../live/init .
cp -fPp \
"$core"/fs/files/group \
"$core"/fs/files/passwd \
"$core"/mdevd/files/mdev.conf \
etc
cp -fPp \
/usr/bin/blkid \
/usr/bin/dash \
/usr/bin/kill \
/usr/bin/kmod \
/usr/bin/mdevd \
/usr/bin/mdevd-coldplug \
/usr/bin/mount \
/usr/bin/switch_root \
/usr/bin/toybox \
usr/bin
ln -fs dash usr/bin/sh
ln -fs kmod usr/bin/modprobe
for i in "$(toybox)"; do
ln -fs toybox usr/bin/$i
done
cp -fPp \
/usr/lib/ld-musl-x86_64.so.1 \
/usr/lib/libblkid.so* \
/usr/lib/libc.so \
/usr/lib/libcrypto.so* \
/usr/lib/libedit.so* \
/usr/lib/liblzma.so* \
/usr/lib/libmount.so* \
/usr/lib/libskarnet.so* \
/usr/lib/libterminfo.so \
/usr/lib/libutmps.so* \
/usr/lib/libz.so* \
/usr/lib/libzstd.so* \
usr/lib
cp -fPpR \
"$mod"/arch \
"$mod"/crypto \
"$mod"/fs \
"$mod"/lib \
usr/lib/modules/"$ver"/kernel
cp -fPpR \
"$mod"/drivers/ata \
"$mod"/drivers/block \
"$mod"/drivers/cdrom \
"$mod"/drivers/gpu \
"$mod"/drivers/hid \
"$mod"/drivers/hwmon \
"$mod"/drivers/input \
"$mod"/drivers/md \
"$mod"/drivers/message \
"$mod"/drivers/nvme \
"$mod"/drivers/scsi \
"$mod"/drivers/usb/host \
"$mod"/drivers/usb/storage \
"$mod"/drivers/virtio \
usr/lib/modules/"$ver"/kernel/drivers
cp -fPp \
"$mod"/../modules.builtin \
"$mod"/../modules.builtin.modinfo \
"$mod"/../modules.order \
usr/lib/modules/"$ver"
depmod -b . "$ver"
find . | cpio -o | zstd -3 -T0 > ../initramfs
cd ../live
rm -fR "$gen"
echo "gen complete"