Browse Source

strongswan: convert init script to procd

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
lilik-openwrt-22.03
Stijn Tintel 7 years ago
parent
commit
6f00048eca
1 changed files with 26 additions and 15 deletions
  1. +26
    -15
      net/strongswan/files/ipsec.init

+ 26
- 15
net/strongswan/files/ipsec.init View File

@ -3,6 +3,9 @@
START=90 START=90
STOP=10 STOP=10
USE_PROCD=1
PROG=/usr/lib/ipsec/starter
. $IPKG_INSTROOT/lib/functions.sh . $IPKG_INSTROOT/lib/functions.sh
IPSEC_SECRETS_FILE=/etc/ipsec.secrets IPSEC_SECRETS_FILE=/etc/ipsec.secrets
@ -315,21 +318,7 @@ prepare_env() {
config_foreach config_remote remote config_foreach config_remote remote
} }
start() {
prepare_env
ipsec start
}
stop() {
ipsec stop
}
restart() {
prepare_env
ipsec restart
}
reload() {
reload_service() {
prepare_env prepare_env
if ipsec status > /dev/null 2>&1; then if ipsec status > /dev/null 2>&1; then
ipsec rereadall ipsec rereadall
@ -338,3 +327,25 @@ reload() {
ipsec start ipsec start
fi fi
} }
service_triggers() {
procd_add_reload_trigger "ipsec"
}
start_service() {
prepare_env
procd_open_instance
procd_set_param command $PROG --daemon charon --nofork
procd_set_param file $IPSEC_CONN_FILE
procd_append_param file $IPSEC_SECRETS_FILE
procd_append_param file $STRONGSWAN_CONF_FILE
procd_append_param file /etc/strongswan.d/*.conf
procd_append_param file /etc/strongswan.d/charon/*.conf
procd_set_param respawn
procd_close_instance
}

Loading…
Cancel
Save