Skip to contentSkip to conversation

Fix nfs server for a read only rootfs

PATCH New Steve Calfee 1 participant 1 message Sep 30, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix nfs server for a read only rootfs

I like to run from ro root filesystem. This patch puts the nfs temp stuff in a subdirectory of tmp. The standard buildroot /var is read only, so the build must agree with the runtime startup to use a /tmp/nfs writeable dir.

Also create the desired subsys subdirectory in /var/lock for nfs.

---
 package/nfs-utils/S60nfs       | 3 +++
 package/nfs-utils/nfs-utils.mk | 4 ++++
 2 files changed, 7 insertions(+)
package/nfs-utils/S60nfs +3 -0
index 49dab70..0497396 100755
@@ -14,6 +14,8 @@
     { echo "/etc/exports does not exist" ; exit 0 ; }
     
 # The /var/lib/nfs directory is actually on a tmpfs filesystem.
+# to reduce clutter put it in a subdir of /tmp
+mkdir -p /tmp/nfs
 mkdir -p /var/lib/nfs/sm
 mkdir -p /var/lib/nfs/sm.bak
 touch /var/lib/nfs/etab
@@ -25,6 +27,7 @@ start() {
 	# Start daemons.
 	echo -n "Starting NFS statd: "
 	rpc.statd
+	mkdir -p /var/lock/subsys
 	touch /var/lock/subsys/nfslock
 	echo "done"
 
package/nfs-utils/nfs-utils.mk +4 -0
index 68772ef..3b54051 100644
@@ -37,6 +37,10 @@ endif
 define NFS_UTILS_INSTALL_FIXUP
 	$(INSTALL) -m 0755 package/nfs-utils/S60nfs \
 		$(TARGET_DIR)/etc/init.d/S60nfs
+	rm -rf $(TARGET_DIR)/var/lib/nfs
+	mkdir -p $(TARGET_DIR)/tmp/nfs
+	$(INSTALL) -d -m 0755 $(TARGET_DIR)/var/lib
+	ln -s ../../tmp/nfs $(TARGET_DIR)/var/lib/nfs
 	rm -f $(NFS_UTILS_TARGETS_)
 endef
 
Signature · 1 line
1.8.3.2