openconnect: remove old network scripts
authornbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Tue, 29 May 2012 13:01:30 +0000 (13:01 +0000)
committernbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Tue, 29 May 2012 13:01:30 +0000 (13:01 +0000)
git-svn-id: svn://svn.openwrt.org/openwrt/packages@31986 3c298f89-4303-0410-b956-a3cf2f4a3e73

net/openconnect/Makefile
net/openconnect/files.old/openconnect.sh [deleted file]
net/openconnect/files.old/run-openconnect [deleted file]

index 1e1ba66..280775f 100644 (file)
@@ -20,7 +20,7 @@ include $(INCLUDE_DIR)/package.mk
 define Package/openconnect
   SECTION:=net
   CATEGORY:=Network
-  DEPENDS:=+libxml2 +libopenssl +kmod-tun +resolveip +!PACKAGE_netifd:vpnc-scripts
+  DEPENDS:=+libxml2 +libopenssl +kmod-tun +resolveip
   TITLE:=VPN client for Cisco's AnyConnect SSL VPN
   URL:=http://www.infradead.org/openconnect/
   SUBMENU:=VPN
@@ -34,27 +34,16 @@ define Package/openconnect/description
         3800, 7200 Series and Cisco 7301 Routers.  
 endef
 
-CONFIGURE_ARGS+=--disable-shared
-ifdef CONFIG_PACKAGE_netifd
-  CONFIGURE_ARGS += --with-vpnc-script=/lib/netifd/vpnc-script
+CONFIGURE_ARGS += \
+       --disable-shared \
+       --with-vpnc-script=/lib/netifd/vpnc-script
 
-  define Package/openconnect/install
+define Package/openconnect/install
        $(INSTALL_DIR) $(1)/lib/netifd/proto
        $(INSTALL_BIN) ./files/openconnect.sh $(1)/lib/netifd/proto/
        $(INSTALL_BIN) ./files/vpnc-script $(1)/lib/netifd/
        $(INSTALL_DIR) $(1)/usr/sbin
        $(INSTALL_BIN) $(PKG_BUILD_DIR)/openconnect $(1)/usr/sbin/
-  endef
-else
-  CONFIGURE_ARGS += --with-vpnc-script=/etc/vpnc/vpnc-script
-
-  define Package/openconnect/install
-       $(INSTALL_DIR) $(1)/lib/network
-       $(INSTALL_BIN) ./files.old/openconnect.sh $(1)/lib/network/
-       $(INSTALL_DIR) $(1)/usr/sbin
-       $(INSTALL_BIN) ./files.old/run-openconnect $(1)/usr/sbin/
-       $(INSTALL_BIN) $(PKG_BUILD_DIR)/openconnect $(1)/usr/sbin/
-  endef
-endif
+endef
 
 $(eval $(call BuildPackage,openconnect))
diff --git a/net/openconnect/files.old/openconnect.sh b/net/openconnect/files.old/openconnect.sh
deleted file mode 100755 (executable)
index 13221ab..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-find_gw() {
-       route -n | awk '$1 == "0.0.0.0" { print $2; exit }'
-}
-
-scan_openconnect() {
-       config_set "$1" device "vpn-$1"
-}
-
-stop_interface_openconnect() {
-       local config="$1"
-       local lock="/var/lock/openconnect-$config"
-
-        uci_set_state network "$config" up 0
-
-       lock "$lock"
-
-       SERVICE_PID_FILE="/var/run/openconnect-${config}.pid" \
-         SERVICE_SIG=HUP service_stop /bin/sh
-
-       remove_dns "$config"
-
-       lock -u "$lock"
-}
-
-setup_interface_openconnect() {
-       local config="$2"
-
-       /sbin/insmod tun 2>&- >&-
-
-       # creating the tunnel below will trigger a net subsystem event
-        # prevent it from touching or iface by disabling .auto here
-        uci_set_state network "$config" ifname "vpn-$config"
-        uci_set_state network "$config" auto 0
-        uci_set_state network "$config" up 1
-
-       SERVICE_PID_FILE="/var/run/openconnect-${config}.pid" \
-          SERVICE_WRITE_PID=1  SERVICE_DAEMONIZE=1 \
-        service_start /usr/sbin/run-openconnect $config
-}
diff --git a/net/openconnect/files.old/run-openconnect b/net/openconnect/files.old/run-openconnect
deleted file mode 100755 (executable)
index e835891..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-#!/bin/sh -x
-
-. /etc/functions.sh
-
-[ $# = 0 ] && { echo "  $0 <group>"; exit; }
-
-include /lib/network
-scan_interfaces
-
-config="$1"
-export OPENWRT_INTERFACE="$config"
-
-config_get proto "$config" proto
-
-if [ "$proto" != "openconnect" ]; then
-    echo "Interface $config is $proto not openconnect" >&2
-    exit 1
-fi
-
-config_get device "$config" device
-
-local server
-config_get server "$config" server
-
-local port
-config_get port "$config" port
-if [ -n "$port" ]; then
-    args="$server:$port"
-else
-    args="$server"
-fi
-
-local cookie
-config_get cookie "$config" cookie
-[ -n "$cookie" ] && args="$args -C $cookie"
-
-local username
-config_get username "$config" username
-[ -n "$username" ] && args="$args -u $username"
-
-local password
-config_get password "$password" password
-
-/sbin/insmod tun
-
-local lock="/var/lock/openconnect-$config"
-
-# creating the tunnel below will trigger a net subsystem event
-# prevent it from touching or iface by disabling .auto here
-uci_set_state network "$config" ifname $link
-uci_set_state network "$config" auto 0
-
-local gw="$(find_gw)"
-[ -n "$gw" ] && {
-    local serv_addrs=""
-    for ip in $(resolveip -4 -t 3 "$server"); do
-       append serv_addrs "$ip"
-       route delete -host "$ip" 2>/dev/null
-       route add -host "$ip" gw "$gw"
-    done
-    uci_toggle_state network "$config" serv_addrs "$serv_addrs"
-}
-
-RECON=$(date +%s)
-
-trap "[ -r /var/run/openconnect-$config-oc.pid ] && kill -HUP \$(cat /var/run/openconnect-$config-oc.pid)" SIGHUP
-while [ "$(uci_get_state network ${config} up)" = "1" ]; do
-    NOW=$(date +%s)
-    if [ $RECON -gt $NOW ]; then
-       DELAY=$(expr $RECON - $NOW)
-       logger -t openconnect "Waiting for $DELAY seconds before reconnecting"
-       sleep $(expr $DELAY)
-    fi
-
-    # The lock prevents a race condition where /lib/network/openconnect.sh could
-    # send us SIGHUP after we spawn openconnect, but before we store its pid.
-    # Thus leaving it running after we should have killed it.
-    lock $lock
-    echo "$passwd" | /usr/sbin/openconnect $args -i "vpn-$config" \
-       --no-cert-check --non-inter --passwd-on-stdin --syslog --script /etc/vpnc/vpnc-script &
-    echo $! > /var/run/openconnect-$config-oc.pid
-    lock -u $lock
-    wait $!
-    rm /var/run/openconnect-$config-oc.pid
-    RECON=$(expr $NOW + 60)
-done