When we upgrade firmware(without saving config files), system will reboot and executes switchjffs2() function(see fstools package). During the process of switchjffs2(), the devices(such as /dev/sdaxx, /dev/blockmmcxx) mounted under /mnt dir will lost.
This is for patch https://patchwork.ozlabs.org/patch/892633/ Since it will lost mount point, samba service also generate the options for devices. Signed-off-by: Rosy Song <rosys...@rosinson.com> --- package/network/services/samba36/Makefile | 2 - .../network/services/samba36/files/samba.defaults | 60 ++++++++++++++++++++++ 2 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 package/network/services/samba36/files/samba.defaults diff --git a/package/network/services/samba36/Makefile b/package/network/services/samba36/Makefile index 39bfcc6c4f..53843a7269 100644 --- a/package/network/services/samba36/Makefile +++ b/package/network/services/samba36/Makefile @@ -149,8 +149,6 @@ define Package/samba36-server/conffiles endef define Package/samba36-server/install - $(INSTALL_DIR) $(1)/etc/config - $(INSTALL_CONF) ./files/samba.config $(1)/etc/config/samba $(INSTALL_DIR) $(1)/etc/samba $(INSTALL_DATA) ./files/smb.conf.template $(1)/etc/samba $(INSTALL_DATA) $(PKG_BUILD_DIR)/codepages/lowcase.dat $(1)/etc/samba diff --git a/package/network/services/samba36/files/samba.defaults b/package/network/services/samba36/files/samba.defaults new file mode 100644 index 0000000000..ae8dad98a9 --- /dev/null +++ b/package/network/services/samba36/files/samba.defaults @@ -0,0 +1,60 @@ +#!/bin/sh +# +# Copyright (C) 2018 OpenWrt.org +# Copyright (C) 2018 rosys...@rosinson.com +# + +. /lib/functions.sh +. /lib/samba/samba.sh + +samba_conf_file=/etc/config/samba + +samba_append_header() { +cat > $samba_conf_file <<EOF +config samba + option 'name' 'OpenWrt' + option 'workgroup' 'WORKGROUP' + option 'description' 'OpenWrt' + option 'homes' '1' + +EOF +} + +samba_append_sambashare() { # <device name> <mount point> +cat >> $samba_conf_file <<EOF +config sambashare + option browseable 'yes' + option name '$1' + option path '$2' + option users 'root' + option read_only 'no' + option guest_ok 'yes' + option create_mask '0755' + option dir_mask '0755' + +EOF +} + +_samba_init_config() { + local dn + local mp + + config_get dn $1 device + config_get mp $1 target + + [ -z "$dn" -o -z "$mp" ] && return + + samba_append_sambashare $(basename $dn) $mp +} + +samba_init_config() { + local dn + local mp + + samba_append_header + + config_load fstab + config_foreach _samba_init_config mount +} + +[ ! -e $samba_conf_file ] && samba_init_config -- 2.13.3 _______________________________________________ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev