From: Travis Kemen Date: Wed, 24 Sep 2008 15:01:43 +0000 (+0000) Subject: Add uci init script and config file. X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=a7cf4ac9248ee0d1d67635ead4b5ba0f240b868f;p=openwrt%2Fsvn-archive%2Fpackages.git Add uci init script and config file. SVN-Revision: 12687 --- diff --git a/ipv6/aiccu/files/aiccu.conf b/ipv6/aiccu/files/aiccu.conf index ecd5bbf0d..bbde1221f 100755 --- a/ipv6/aiccu/files/aiccu.conf +++ b/ipv6/aiccu/files/aiccu.conf @@ -1,78 +1,11 @@ -# AICCU Configuration - -# Login information (defaults: none) -#username -#password - -# Protocol and server to use for setting up the tunnel (defaults: none) -#protocol -#server - -# Interface names to use (default: aiccu) -# ipv6_interface is the name of the interface that will be used as a tunnel interface. -# On *BSD the ipv6_interface should be set to gifX (eg gif0) for proto-41 tunnels -# or tunX (eg tun0) for AYIYA tunnels. -ipv6_interface sixxs - -# The tunnel_id to use (default: none) -# (only required when there are multiple tunnels in the list) -#tunnel_id Txxxx - -# Be verbose? (default: false) -verbose false - -# Daemonize? (default: true) -# Set to false if you want to see any output -# When true output goes to syslog -# -# WARNING: never run AICCU from DaemonTools or a similar automated -# 'restart' tool/script. When AICCU does not start, it has a reason -# not to start which it gives on either the stdout or in the (sys)log -# file. The TIC server *will* automatically disable accounts which -# are detected to run in this mode. -# -daemonize true - -# Automatic Login and Tunnel activation? -automatic true - -# Require TLS? -# When set to true, if TLS is not supported on the server -# the TIC transaction will fail. -# When set to false, it will try a starttls, when that is -# not supported it will continue. -# In any case if AICCU is build with TLS support it will -# try to do a 'starttls' to the TIC server to see if that -# is supported. -requiretls false - -# PID File -pidfile /var/run/aiccu.pid - -# Add a default route (default: true) -defaultroute true - -# Script to run after setting up the interfaces (default: none) -#setupscript /usr/local/etc/aiccu-subnets.sh - -# Make heartbeats (default true) -# In general you don't want to turn this off -# Of course only applies to AYIYA and heartbeat tunnels not to static ones -#makebeats true - -# Don't configure anything (default: false) -#noconfigure true - -# Behind NAT (default: false) -# Notify the user that a NAT-kind network is detected -#behindnat true - -# Local IPv4 Override (default: none) -# Overrides the IPv4 parameter received from TIC -# This allows one to configure a NAT into "DMZ" mode and then -# forwarding the proto-41 packets to an internal host. -# -# This is only needed for static proto-41 tunnels! -# AYIYA and heartbeat tunnels don't require this. -#local_ipv4_override - +config aiccu + option username '' + option password '' + option protocol '' + option server '' + option interface '' + option tunnel_id '' + option requiretls '' + option defaultroute '1' + option nat '1' + option heartbeat '1' \ No newline at end of file diff --git a/ipv6/aiccu/files/aiccu.init b/ipv6/aiccu/files/aiccu.init index a82bc376d..a18e7963e 100644 --- a/ipv6/aiccu/files/aiccu.init +++ b/ipv6/aiccu/files/aiccu.init @@ -2,8 +2,45 @@ # Copyright (C) 2006 OpenWrt.org START=50 +config_cb() { + local cfg_type="$1" + local cfg_name="$2" + + case "$cfg_type" in + aiccu) + append cfgs_sections "$cfg_name" "$N" + ;; + esac +} + start() { - aiccu start + config_load aiccu + for cfgs_section $cfgs_sections; do + config_get username $cfgs_section username + config_get password $cfgs_section password + config_get server $cfgs_section server + config_get protocol $cfgs_section protocol + config_get interface $cfgs_section interface + config_get tunnel_id $cfgs_section tunnel_id + config_get_bool requiretls $cfgs_section requiretls 0 + config_get_bool defaultroute $cfgs_section defaultroute 1 + config_get_bool nat $cfgs_section nat 1 + config_get_bool heartbeat $cfgs_section heatbeat 1 + mkdir -p /tmp/run + echo "username $username" > /tmp/run/aiccu-${cfgs_section}.conf + echo "password $password" >> /tmp/run/aiccu-${cfgs_section}.conf + [ -n "$server" ] && echo "server $server" >> /tmp/run/aiccu-${cfgs_section}.conf + [ -n "$protocol" ] && echo "protocol $protocol" >> /tmp/run/aiccu-${cfgs_section}.conf + [ -n "$interface" ] && echo "interface $interface" >> /tmp/run/aiccu-${cfgs_section}.conf + [ -n "$tunnel_id" ] && echo "tunnel_id $tunnel_id" >> /tmp/run/aiccu-${cfgs_section}.conf || echo "tunnel_id aiccu" >> /tmp/run/aiccu-${cfgs_section}.conf + [ "$requiretls" = "1" ] && echo "requiretls true" >> /tmp/run/aiccu-${cfgs_section}.conf + [ "$defaultroute" != "1" ] && echo "defaultroute false >> /tmp/run/aiccu-${cfgs_section}.conf + [ "$nat" = "1" ] && echo "behindnat true >> /tmp/run/aiccu-${cfgs_section}.conf + [ "$heartbeat" != "1" ] && echo "makebeats false" >> /tmp/run/aiccu-${cfgs_section}.conf + echo "pidfile /var/run/aiccu-${cfgs_section}.pid" >> /tmp/run/aiccu-${cfgs_section}.conf + + aiccu start /tmp/run/aiccu-$cfgs_section.conf + done } stop() {