samba36: log error if getting device info failed
authorRafał Miłecki <rafal@milecki.pl>
Mon, 30 Dec 2019 06:54:53 +0000 (07:54 +0100)
committerRafał Miłecki <rafal@milecki.pl>
Sat, 21 Mar 2020 21:35:45 +0000 (22:35 +0100)
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
package/network/services/samba36/Makefile
package/network/services/samba36/files/samba.hotplug

index a4392f62c5a613860c25204258cc3748ffb81f3e..161f6b45aa930d0ba69c530549c5b9eab0a7f1a4 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=samba
 PKG_VERSION:=3.6.25
-PKG_RELEASE:=14
+PKG_RELEASE:=15
 
 PKG_SOURCE_URL:=https://download.samba.org/pub/samba \
                https://download.samba.org/pub/samba/stable
index e1ae64e655c6a0a7b4b772aca19af518f290f582..abb4346af00af377a04682d94539b322718b7359 100644 (file)
@@ -6,7 +6,7 @@ device_get_vars() {
        json_init
        json_load "$(ubus call block info)"
 
-       json_select devices
+       json_select devices || return 1
 
        json_get_keys keys
        for key in $keys
@@ -18,13 +18,16 @@ device_get_vars() {
                        shift
                        json_get_vars $@
                        json_select ..
-                       break
+                       json_select ..
+                       return 0
                }
 
                json_select ..
        done
 
        json_select ..
+
+       return 2
 }
 
 [ -f /var/run/config/samba ] || {
@@ -32,7 +35,10 @@ device_get_vars() {
 }
 
 [ "$ACTION" = "add" ] && {
-       device_get_vars $DEVICE label mount
+       device_get_vars $DEVICE label mount || {
+               logger -t samba-hotplug "Failed to get $DEVICE info"
+               exit 1
+       }
        [ -n "$mount" ] && {
                uci -c /var/run/config batch <<-EOF
                        set samba.$DEVICE="sambashare"