-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit
More file actions
executable file
·45 lines (30 loc) · 990 Bytes
/
init
File metadata and controls
executable file
·45 lines (30 loc) · 990 Bytes
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
#!/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
export PATH=/usr/bin
mount -t devtmpfs devtmpfs /dev
mount -t proc proc /proc
mount -t sysfs sys /sys
modprobe loop
mdevd -C > /dev/null 2>&1 & pid="$!"
until device="$(blkid -L GLAUCUS)" && mount -o ro "$device" /media/iso; do
sleep 1
done
mount -t erofs /media/iso/fs /media/fs-ro
mount -o size=1G -t tmpfs tmpfs /media/fs-rw
mkdir -p \
/media/fs-rw/upper \
/media/fs-rw/work
mount -o lowerdir=/media/fs-ro,upperdir=/media/fs-rw/upper,workdir=/media/fs-rw/work -t overlay overlay /mnt/root
for i in dev proc sys; do
mount -M "/$i" "/mnt/root/$i"
done
for i in fs-ro fs-rw iso; do
mount -M "/media/$i" "/mnt/root/mnt/$i"
done
kill "$pid"
exec switch_root /mnt/root /usr/bin/init