[OpenWrt-Devel] [PATCH] samba36: append config from /var/run/config/ for runtime shares

Rafał Miłecki zajec5 at gmail.com
Tue Dec 25 14:30:12 EST 2018


From: Rafał Miłecki <rafal at milecki.pl>

This will allow automation/hotplug.d scripts to store runtime shares in
the /var/run/config/samba. It's useful e.g. for USB drives that user
wants to be automatically shared.

Using /var/run/config/ provides:
1) Automated cleaning on reboots
   It's important for consistency (to avoid sharing non-existing drives)
2) Safety for user non-commited changes
   Automated scripts should never call "uci [foo] commit" as that could
   flush incomplete config.

Another minor gain is avoiding flash wearing for runtime setup.

Cc: Rosy Song <rosysong at rosinson.com>
Cc: Jo-Philipp Wich <jo at mein.io>
Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
---
 package/network/services/samba36/files/samba.init | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/package/network/services/samba36/files/samba.init b/package/network/services/samba36/files/samba.init
index 1c5bb3b3c4..abe8e8f5c7 100755
--- a/package/network/services/samba36/files/samba.init
+++ b/package/network/services/samba36/files/samba.init
@@ -84,6 +84,8 @@ smb_add_share() {
 
 init_config() {
 	config_load samba
+	CONFIG_APPEND=1 UCI_CONFIG_DIR=/var/run/config config_load samba
+
 	config_foreach smb_header samba
 	config_foreach smb_add_share sambashare
 }
-- 
2.13.7


_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list