Use devtmpfs, and improve finalize_fhs.sh

With this, finalize_fhs.sh can be rerun as needed, e.g. when rebooting.
Also, the preferred nameserver will persist after DHCP.

Thanks to devtmpfs, we no longer need to manage /dev once Linux is up.
This commit is contained in:
Gábor Stefanik 2024-01-02 00:05:58 +01:00
parent 133c05426c
commit 8341c4e089
4 changed files with 20 additions and 9 deletions

View file

@ -6,13 +6,22 @@
#
# Add the rest of the FHS that we will use and is not created pre-boot
rm -rf /sbin /usr/sbin
ln -s /usr/bin /usr/sbin
for d in bin lib sbin; do
ln -s "usr/${d}" "/${d}"
ln -s "/usr/${d}" "/${d}" || true # these might exist if rerunning
done
mkdir -p /etc /run /var
test -d /proc || (mkdir /proc && mount -t proc proc /proc)
test -d /sys || (mkdir /sys && mount -t sysfs sysfs /sys)
mkdir -p /etc /run /var/log /var/lock /var/spool /var/tmp /var/cache
# can't use /dev/null before mounting /dev
mount | grep '/dev' &> /junk || (mkdir -p /dev; mount -t devtmpfs none /dev)
rm /junk &> /dev/null || true
mount | grep '/proc' &> /dev/null || (mkdir -p /proc; mount -t proc proc /proc)
mount | grep '/sys' &> /dev/null || (mkdir -p /sys; mount -t sysfs sysfs /sys)
# Make /tmp a ramdisk (speeds up configure etc significantly)
test -d /tmp || (mkdir /tmp && mount -t tmpfs tmpfs /tmp)
mount | grep '/tmp' &> /dev/null || (mkdir -p /tmp; mount -t tmpfs tmpfs /tmp)
# Add /etc/resolv.conf
echo 'nameserver 1.1.1.1' > /etc/resolv.conf
echo 'nameserver 1.1.1.1' > /etc/resolv.conf.head