diff --git a/kernel/cifsd/Makefile b/kernel/cifsd/Makefile index 1f28e9815..ac514b16b 100644 --- a/kernel/cifsd/Makefile +++ b/kernel/cifsd/Makefile @@ -5,9 +5,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://github.com/cifsd-team/cifsd.git -PKG_SOURCE_DATE:=2019-07-12 -PKG_SOURCE_VERSION:=f2cfe8cb40493a5f77144543bc486bfdb8aa61e2 -PKG_MIRROR_HASH:=fd6a3bec5953fa30b87a6e12e2c6666844ad66096afa7de421689f5769626a36 +PKG_SOURCE_DATE:=2019-07-17 +PKG_SOURCE_VERSION:=0c3049e84fc7737cedbcef3e1791a570871168cd +PKG_MIRROR_HASH:=2717cb1e3d28e7ff5ea69c3fa2a6ae182b70bcdf8680a41a0df2b190b072d04b PKG_MAINTAINER:=Andy Walsh PKG_LICENSE:=GPL-2.0-or-later diff --git a/net/cifsd-tools/Makefile b/net/cifsd-tools/Makefile index b04ab3c1f..1a8eeb4ea 100644 --- a/net/cifsd-tools/Makefile +++ b/net/cifsd-tools/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=cifsd-tools -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://github.com/cifsd-team/cifsd-tools.git @@ -13,9 +13,10 @@ PKG_MAINTAINER:=Andy Walsh PKG_LICENSE:=GPL-2.0-or-later PKG_LICENSE_FILES:=COPYING -PKG_INSTALL:=1 PKG_FIXUP:=autoreconf -PKG_REMOVE_FILES:=autogen.sh aclocal.m4 +PKG_INSTALL:=1 +PKG_BUILD_PARALLEL:=1 +PKG_REMOVE_FILES:=autogen.sh include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/nls.mk @@ -50,9 +51,9 @@ endef define Package/cifsd-tools/conffiles /etc/config/cifsd -/etc/cifs/smb.conf.template +/etc/cifs/smb.conf.template /etc/cifs/smb.conf /etc/cifs/cifsdpwd.db -endef +endef $(eval $(call BuildPackage,cifsd-tools)) diff --git a/net/cifsd-tools/files/cifsd.init b/net/cifsd-tools/files/cifsd.init index 44690850f..e2ea0c500 100644 --- a/net/cifsd-tools/files/cifsd.init +++ b/net/cifsd-tools/files/cifsd.init @@ -10,7 +10,8 @@ smb_header() config_get CIFSD_IFACE $1 interface "lan" # resolve interfaces - local interfaces=$( + local interfaces + interfaces=$( . /lib/functions/network.sh local net @@ -23,7 +24,8 @@ smb_header() ) local workgroup description - local hostname="$(cat /proc/sys/kernel/hostname)" + local hostname + hostname="$(cat /proc/sys/kernel/hostname)" config_get workgroup $1 workgroup "WORKGROUP" config_get description $1 description "Cifsd on OpenWrt" @@ -35,7 +37,7 @@ smb_header() /etc/cifs/smb.conf.template > /var/etc/cifs/smb.conf [ -e /etc/cifs/smb.conf ] || ln -nsf /var/etc/cifs/smb.conf /etc/cifs/smb.conf - + if [ ! -L /etc/cifs/smb.conf ]; then logger -t 'cifsd' "Local custom /etc/cifs/smb.conf file detected, all UCI/Luci config settings are ignored!" fi @@ -75,31 +77,33 @@ smb_add_share() config_get_bool hide_dot_files $1 hide_dot_files 0 config_get veto_files $1 veto_files - [ -z "$name" -o -z "$path" ] && return + [ -z "$name" ] || [ -z "$path" ] && return - echo -e "\n[$name]\n\tpath = $path" >> /var/etc/cifs/smb.conf - [ -n "$comment" ] && echo -e "\tcomment = $comment" >> /var/etc/cifs/smb.conf - - if [ "$force_root" -eq 1 ]; then - echo -e "\tforce user = root" >> /var/etc/cifs/smb.conf - echo -e "\tforce group = root" >> /var/etc/cifs/smb.conf - else - [ -n "$users" ] && echo -e "\tvalid users = $users" >> /var/etc/cifs/smb.conf - fi + { + printf "\n[%s]\n\tpath = %s\n" "$name" "$path" + [ -n "$comment" ] && printf "\tcomment = %s\n" "$comment" + + if [ "$force_root" -eq 1 ]; then + printf "\tforce user = %s\n" "root" + printf "\tforce group = %s\n" "root" + else + [ -n "$users" ] && printf "\tvalid users = %s\n" "$users" + fi - [ -n "$create_mask" ] && echo -e "\tcreate mask = $create_mask" >> /var/etc/cifs/smb.conf - [ -n "$dir_mask" ] && echo -e "\tdirectory mask = $dir_mask" >> /var/etc/cifs/smb.conf + [ -n "$create_mask" ] && printf "\tcreate mask = %s\n" "$create_mask" + [ -n "$dir_mask" ] && printf "\tdirectory mask = %s\n" "$dir_mask" - [ -n "$browseable" ] && echo -e "\tbrowseable = $browseable" >> /var/etc/cifs/smb.conf - [ -n "$read_only" ] && echo -e "\tread only = $read_only" >> /var/etc/cifs/smb.conf - [ -n "$writeable" ] && echo -e "\twriteable = $writeable" >> /var/etc/cifs/smb.conf - [ -n "$guest_ok" ] && echo -e "\tguest ok = $guest_ok" >> /var/etc/cifs/smb.conf + [ -n "$browseable" ] && printf "\tbrowseable = %s\n" "$browseable" + [ -n "$read_only" ] && printf "\tread only = %s\n" "$read_only" + [ -n "$writeable" ] && printf "\twriteable = %s\n" "$writeable" + [ -n "$guest_ok" ] && printf "\tguest ok = %s\n" "$guest_ok" - [ -n "$write_list" ] && echo -e "\twrite list = $write_list" >> /var/etc/cifs/smb.conf - [ -n "$read_list" ] && echo -e "\tread list = $read_list" >> /var/etc/cifs/smb.conf + [ -n "$write_list" ] && printf "\twrite list = %s\n" "$write_list" + [ -n "$read_list" ] && printf "\tread list = %s\n" "$read_list" - [ "$hide_dot_files" -eq 1 ] && echo -e "\thide dot files = yes" >> /var/etc/cifs/smb.conf - [ -n "$veto_files" ] && echo -e "\tveto files = $veto_files" >> /var/etc/cifs/smb.conf + [ "$hide_dot_files" -eq 1 ] && printf "\thide dot files = %s\n" "yes" + [ -n "$veto_files" ] && printf "\tveto files = %s\n" "$veto_files" + } >> /var/etc/cifs/smb.conf } init_config() @@ -117,9 +121,9 @@ init_config() service_triggers() { PROCD_RELOAD_DELAY=2000 - + procd_add_reload_trigger "dhcp" "system" "cifsd" - + local i for i in $CIFSD_IFACE; do procd_add_reload_interface_trigger $i @@ -129,21 +133,20 @@ service_triggers() start_service() { init_config - + if [ ! -e /etc/cifs/smb.conf ]; then logger -t 'cifsd' "missing config /etc/cifs/smb.conf, needs to-be created manually!" exit 1 fi [ -f /tmp/cifsd.lock ] && rm /tmp/cifsd.lock - + # try remove again before start - if (lsmod | grep cifsd &>/dev/null); then - rmmod cifsd &>/dev/null - fi - modprobe cifsd 2>/dev/null - if ! (lsmod | grep cifsd &>/dev/null); then - logger -t 'cifsd' "modprobe of cifsd module failed, cant start cifsd!" + [ -e /sys/module/cifsd ] && rmmod cifsd > /dev/null 2>&1 + + modprobe cifsd 2> /dev/null + if [ ! -e /sys/module/cifsd ]; then + logger -t 'cifsd' "modprobe of cifsd module failed, can\'t start cifsd!" exit 1 fi