diff options
author | Felix Fietkau <nbd@openwrt.org> | 2015-11-16 11:02:14 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2015-11-16 11:02:14 +0000 |
commit | 6c98ba46ac8e9243884c1963e63cb8fd89e2d0bc (patch) | |
tree | db5be5b54d2a5fc5a41fb63fa04c5b74d647bf2e | |
parent | 9167c635a2c6457c01a8dc54960b792f72983e7a (diff) | |
download | master-187ad058-6c98ba46ac8e9243884c1963e63cb8fd89e2d0bc.tar.gz master-187ad058-6c98ba46ac8e9243884c1963e63cb8fd89e2d0bc.tar.bz2 master-187ad058-6c98ba46ac8e9243884c1963e63cb8fd89e2d0bc.zip |
ltq-app-vdsl: convert init script to procd, add support for switching between atm and ptm
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@47485 3c298f89-4303-0410-b956-a3cf2f4a3e73
3 files changed, 27 insertions, 12 deletions
diff --git a/package/network/config/ltq-vdsl-app/Makefile b/package/network/config/ltq-vdsl-app/Makefile index 061a966bf7..250d6f7664 100644 --- a/package/network/config/ltq-vdsl-app/Makefile +++ b/package/network/config/ltq-vdsl-app/Makefile @@ -68,10 +68,10 @@ CONFIGURE_ARGS += --enable-model=full #CONFIGURE_ARGS += --enable-model=debug define Package/ltq-vdsl-app/install - $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_DIR) $(1)/etc/init.d $(1)/sbin $(INSTALL_BIN) ./files/dsl_control $(1)/etc/init.d/ + $(INSTALL_BIN) ./files/vdsl_cpe_control_wrapper $(1)/sbin/ - $(INSTALL_DIR) $(1)/sbin $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/dsl_cpe_control $(1)/sbin/vdsl_cpe_control endef diff --git a/package/network/config/ltq-vdsl-app/files/dsl_control b/package/network/config/ltq-vdsl-app/files/dsl_control index 394e1c0859..d7eb4cd0d9 100644 --- a/package/network/config/ltq-vdsl-app/files/dsl_control +++ b/package/network/config/ltq-vdsl-app/files/dsl_control @@ -3,14 +3,12 @@ # needs to start before the atm layer which starts at 50 START=48 +USE_PROCD=1 EXTRA_COMMANDS="status lucistat" EXTRA_HELP=" status Get DSL status information lucistat Get status information if lua friendly format" -SERVICE_DAEMONIZE=1 -SERVICE_WRITE_PID=1 - [ -f /lib/functions/lantiq_dsl.sh ] && . /lib/functions/lantiq_dsl.sh # G.992.1 Annex A @@ -37,7 +35,11 @@ xtse_adsl_j="10 00 10 40 00 04 01 00" xtse_vdsl="00 00 00 00 00 00 00 07" -start() { +service_triggers() { + procd_add_reload_trigger network +} + +start_service() { local annex local firmware local xtse @@ -53,11 +55,13 @@ start() { case "${xfer_mode}" in atm) - insmod ltq_atm_vr9 + LOAD=ltq_atm_vr9 + UNLOAD=ltq_ptm_vr9 mode=1 ;; *) - insmod ltq_ptm_vr9 + LOAD=ltq_ptm_vr9 + UNLOAD=ltq_atm_vr9 mode=2 ;; esac @@ -75,17 +79,18 @@ start() { return 1 } - service_start /sbin/vdsl_cpe_control \ + procd_open_instance + procd_set_param command /sbin/vdsl_cpe_control_wrapper \ -i `echo $xtse | sed "s/ /_/g"` \ -n /sbin/dsl_notify.sh \ -f ${firmware} \ -M ${mode} + procd_append_param env "LOAD=$LOAD" "UNLOAD=$UNLOAD" + procd_close_instance } -stop() { +stop_service() { DSL_NOTIFICATION_TYPE="DSL_INTERFACE_STATUS" \ DSL_INTERFACE_STATUS="DOWN" \ /sbin/dsl_notify.sh - - service_stop /sbin/vdsl_cpe_control } diff --git a/package/network/config/ltq-vdsl-app/files/vdsl_cpe_control_wrapper b/package/network/config/ltq-vdsl-app/files/vdsl_cpe_control_wrapper new file mode 100644 index 0000000000..8e7c1cb4b8 --- /dev/null +++ b/package/network/config/ltq-vdsl-app/files/vdsl_cpe_control_wrapper @@ -0,0 +1,10 @@ +#!/bin/sh + +for mod in $UNLOAD; do + grep -q "$mod " /proc/modules && rmmod "$mod" +done +for mod in $LOAD; do + grep -q "$mod " /proc/modules || insmod "$mod" +done + +exec /sbin/vdsl_cpe_control "$@" |