freebsd / crochet

Build FreeBSD images for RaspberryPi, BeagleBone, PandaBoard, and others.
BSD 2-Clause "Simplified" License
612 stars 189 forks source link

NanoBSD fails to set directory permissions in conf/base/var for two directories #184

Open tickerguy opened 7 years ago

tickerguy commented 7 years ago

Synopsis: /var/db/entropy requires operator:operator ownership and /var/client/mqueue requires smmsp:smmsp ownership. Neither is established by NanoBSD (all in that structure are owned by root) and as a result periodic entropy save fails, and so does submit-only sendmail (and queue run.)

The following patch fixes both, along with the previous issue I reported with usr/local symlink problems along with "firstboot" being set.

--- /pics/Crochet-base/option/NanoBSD/setup.sh  2017-02-14 14:10:51.765528000 -0600
+++ setup.sh    2017-02-22 12:39:11.541075000 -0600
@@ -82,14 +82,21 @@
         find . -print | cpio -dumpl -R root:wheel ../../../etc/local
         cd ..
         rm -fr ./etc
-        ln -s ../../etc/local ./etc
         )
     fi
+    (
+    cd usr/local
+    ln -s ../../etc/local etc
+    )

     # force diskless mode
     touch etc/diskless
     chown root:wheel etc/diskless

+    # Remove /firstboot flag because the root filesystem is R/O on boot
+    # and thus it will always be a "first" boot otherwise!
+    rm -f firstboot
+
     # mount root filesystem readonly
     echo "root_rw_mount=NO" >> etc/defaults/rc.conf
     chown root:wheel etc/defaults/rc.conf
@@ -126,6 +133,10 @@
     chown root:wheel conf/base/etc/md_size
     chown root:wheel conf/base/var/md_size

+# Fixup entropy and mqueue directories under /var
+    chown smmsp:smmsp conf/base/var/spool/clientmqueue
+    chown operator:operator conf/base/var/db/entropy
+
     echo "mount -o ro ${NANO_DEV}s2d" > conf/default/etc/remount
     chown root:wheel conf/default/etc/remount