[package] ez-ipudate: fix config generator to permit default server
[openwrt/svn-archive/archive.git] / net / ez-ipupdate / files / ez-ipupdate.hotplug
index 8f924f154fce49fe093c8288c6ba0f9ba02fe539..f07542f4f10b639e5f64300dd1d6cc8de93dc73f 100644 (file)
@@ -25,7 +25,7 @@ case "$ACTION" in
 
                    config_get pidfile $cfg pidfile
                    pidfile=${pidfile:-/var/run/$NAME-$service-$dev.pid}
 
                    config_get pidfile $cfg pidfile
                    pidfile=${pidfile:-/var/run/$NAME-$service-$dev.pid}
-                           
+
                    case "$ACTION" in
                        ifdown)
                            cleanup $pidfile
                    case "$ACTION" in
                        ifdown)
                            cleanup $pidfile
@@ -36,7 +36,7 @@ case "$ACTION" in
                                    [ ! -e $pidfile ] && {
                                        config_get cache $cfg cache
                                        [ -z "$cache" ] && cache=/tmp/$NAME-$service-$dev.cache
                                    [ ! -e $pidfile ] && {
                                        config_get cache $cfg cache
                                        [ -z "$cache" ] && cache=/tmp/$NAME-$service-$dev.cache
-                                       
+
                                        config_get config $cfg config
                                        [ -z "$config" ] && {
                                            config=/var/run/$NAME-$service-$dev.conf
                                        config_get config $cfg config
                                        [ -z "$config" ] && {
                                            config=/var/run/$NAME-$service-$dev.conf
@@ -45,9 +45,13 @@ case "$ACTION" in
                                            config_get hostname $cfg hostname
                                            service=${service:-"dyndns"}
                                            config_get server   $cfg server
                                            config_get hostname $cfg hostname
                                            service=${service:-"dyndns"}
                                            config_get server   $cfg server
+                                           server_line=""
+                                           [ -n "$server" ] && {
+                                               server_line="server=$server"
+                                           }
                                            cat > $config <<EOF
 service-type=$service
                                            cat > $config <<EOF
 service-type=$service
-${server:+server=$server}
+$server_line
 user=$username:$password
 host=$hostname
 cache-file=$cache
 user=$username:$password
 host=$hostname
 cache-file=$cache
@@ -56,7 +60,7 @@ interface=$dev
 quiet
 EOF
                                        }
 quiet
 EOF
                                        }
-                                       
+
                                        $COMMAND -c $config 2>&1 | logger -t $NAME &
                                    }
                                    ;;
                                        $COMMAND -c $config 2>&1 | logger -t $NAME &
                                    }
                                    ;;
@@ -68,12 +72,12 @@ EOF
                }
            }
        }
                }
            }
        }
-       
-       
+
+
        include /lib/network
        scan_interfaces
        config_load ddns
        include /lib/network
        scan_interfaces
        config_load ddns
-       
+
        config_foreach ddns ddns
        ;;
 esac
        config_foreach ddns ddns
        ;;
 esac