Skip to content

Commit 488dd3a

Browse files
authored
Bring union logic into init.sh
1 parent 551c6d2 commit 488dd3a

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

overlays/ramdisk/init.sh

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,42 @@ if [ "$(kenv use_unionfs)" = "YES" ] ; then
5959
## zfs snapshot furybsd@now
6060
## results in:
6161
## cannot create shapshots : pool is read-only
62+
63+
echo "==> XXXXXXXXXXXXXXXXXXX UNION XXXXXXXXXXXXXXXXXXXXXXXXX"
6264

63-
exit 0 # /etc/rc gets executed next which should now come from zfs
65+
mount -uw /
66+
67+
kldload /tmp/ro/usr/local/furybsd/uzip/boot/kernel/nullfs.ko
68+
kldload /tmp/ro/usr/local/furybsd/uzip/boot/kernel/unionfs.ko
69+
70+
# TODO: Use DIRS=$(find /* \! -name . -prune -type d) but clean it
71+
DIRS="/Applications /bin /lib /libexec /sbin /System /root /etc" # /var
72+
# FIXME: Having added /etc to the above results in 30 extra seconds related to the default route...
73+
# var will make initgfx crash X once; but maybe that's just initgx at work?
74+
for DIR in $DIRS; do
75+
mkdir -p /tmp/union/rw$DIR $DIR
76+
mount -t nullfs /tmp/ro/usr/local/furybsd/uzip$DIR $DIR
77+
mount -t unionfs /tmp/union/rw$DIR $DIR
78+
done
79+
80+
mkdir -p /var
81+
mdmfs -s 256m md98 /var # Without this, rc.d/var leads to reboot
82+
chmod a+rwx /var # Will this help???
83+
84+
DIRS="local bin sbin include lib lib32 libdata libexec obj ports share src tests"
85+
for DIR in $DIRS; do
86+
mkdir -p /tmp/union/rwusr/$DIR /usr/$DIR
87+
mount -t nullfs /tmp/ro/usr/local/furybsd/uzip/usr/$DIR /usr/$DIR
88+
mount -t unionfs /tmp/union/rwusr/$DIR /usr/$DIR
89+
done
90+
91+
# unionfs-nullfs for /usr/home leads to crashes when trying to use Chromium
92+
mkdir -p /usr/home
93+
mdmfs -s 256m md99 /usr/home
94+
cp -r -p /tmp/ro/usr/local/furybsd/uzip/usr/home/* /usr/home/
95+
96+
chmod a+rwx /tmp # So that Chrome can start
97+
exit 0 # Hopefully boot continues from our newly-mounted /etc
6498
fi
6599

66100
echo "==> Importing zfs pool"

0 commit comments

Comments
 (0)