Initial commit
This commit is contained in:
1196
initramfs/busybox.config
Normal file
1196
initramfs/busybox.config
Normal file
File diff suppressed because it is too large
Load Diff
40
initramfs/overlay/sbin/init
Executable file
40
initramfs/overlay/sbin/init
Executable file
@@ -0,0 +1,40 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
export PATH=/usr/sbin:/usr/bin:/sbin:/bin
|
||||
|
||||
mkdir -p /proc /run /sys
|
||||
mount -t sysfs sysfs /sys
|
||||
mount -t proc proc /proc
|
||||
mount -t tmpfs tmpfs /run
|
||||
|
||||
# shellcheck disable=SC2046
|
||||
set -- $(cat /proc/cmdline)
|
||||
while [ $# -ge 1 ]; do
|
||||
case "$1" in
|
||||
root=nbd:*)
|
||||
arg=${1#*:}
|
||||
name=${arg#*:}
|
||||
host=${arg%:*}
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
for path in /sys/class/net/*; do
|
||||
[ -e "${path}" ] || continue
|
||||
ip link set "${path##*/}" up
|
||||
done
|
||||
sleep 5
|
||||
udhcpc -q
|
||||
|
||||
@bd-client -N "${name}" -R -p "${host}" /dev/nbd0
|
||||
mkdir -p /sysroot
|
||||
mount -o ro -t squashfs /dev/nbd0 /sysroot || nbd-client -c /dev/nbd0
|
||||
|
||||
cd /sysroot
|
||||
mount --move /proc /sysroot/proc
|
||||
mount --move /sys /sysroot/sys
|
||||
mount --move /dev /sysroot/dev
|
||||
mount --move /run /sysroot/run
|
||||
|
||||
exec switch_root /sysroot /lib/systemd/systemd
|
||||
1
initramfs/overlay/usr/sbin/@bd-client
Symbolic link
1
initramfs/overlay/usr/sbin/@bd-client
Symbolic link
@@ -0,0 +1 @@
|
||||
nbd-client
|
||||
39
initramfs/overlay/usr/share/udhcpc/default.script
Executable file
39
initramfs/overlay/usr/share/udhcpc/default.script
Executable file
@@ -0,0 +1,39 @@
|
||||
#!/bin/sh
|
||||
|
||||
|
||||
case "$1" in
|
||||
deconfig|nak)
|
||||
;;
|
||||
renew|bound)
|
||||
if [ -n "${ip}" ]; then
|
||||
# shellcheck disable=SC2154 # interface is is an environment variable
|
||||
ip addr add "${ip}"/"${mask:-32}" dev "${interface}"
|
||||
fi
|
||||
if [ -n "${staticroutes}" ]; then
|
||||
# shellcheck disable=SC2086 # we WANT word splitting here!
|
||||
set -- ${staticroutes}
|
||||
ip route add "$1" via "$2" dev "${interface}"
|
||||
elif [ -n "${router}" ]; then
|
||||
for gw in ${router}; do
|
||||
ip route add default via "${gw}" dev "${interface}"
|
||||
done
|
||||
fi
|
||||
: > /etc/resolv.conf
|
||||
if [ -n "${search}" ]; then
|
||||
printf 'search %s\n' "${search}" >> /etc/resolv.conf
|
||||
elif [ -n "${domain}" ]; then
|
||||
printf 'search %s\n' "${domain}" >> /etc/resolv.conf
|
||||
fi
|
||||
if [ -n "${dns}" ]; then
|
||||
for ns in ${dns}; do
|
||||
printf 'nameserver %s\n' "${ns}" >> /etc/resolv.conf
|
||||
done
|
||||
fi
|
||||
if [ -n "${ntpsrv}" ] && [ -x /usr/sbin/ntpd ]; then
|
||||
for ts in ${ntpsrv}; do
|
||||
/usr/sbin/ntpd -n -q -p "${ts}" || continue
|
||||
break
|
||||
done
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
Reference in New Issue
Block a user