kamailio-5.x: add hotplug script
Add hotplug script to base package. Hotplug will only occur if user enables it via uci config. Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
This commit is contained in:
parent
6568006dde
commit
0dd94c624e
3 changed files with 32 additions and 0 deletions
|
@ -271,6 +271,10 @@ $(foreach c,kamailio.cfg kamctlrc,$(call Package/kamailio5/install/conffile,$(1)
|
|||
$(INSTALL_BIN) \
|
||||
./files/kamailio.init \
|
||||
$(1)/etc/init.d/kamailio
|
||||
$(INSTALL_DIR) $(1)/etc/hotplug.d/iface
|
||||
$(INSTALL_BIN) \
|
||||
./files/kamailio.hotplug \
|
||||
$(1)/etc/hotplug.d/iface
|
||||
$(CP) \
|
||||
$(PKG_INSTALL_DIR)/usr/lib/kamailio/kamctl \
|
||||
$(1)/usr/lib/kamailio/
|
||||
|
|
|
@ -19,3 +19,7 @@ config kamailio 'general'
|
|||
# Any other option can be put between the quotes below:
|
||||
#option options ""
|
||||
|
||||
config kamailio 'hotplug'
|
||||
# Uncomment to enable hotplug:
|
||||
#option interface 'wan'
|
||||
|
||||
|
|
24
net/kamailio-5.x/files/kamailio.hotplug
Normal file
24
net/kamailio-5.x/files/kamailio.hotplug
Normal file
|
@ -0,0 +1,24 @@
|
|||
#!/bin/sh
|
||||
|
||||
[ "$ACTION" = ifup ] || exit 0
|
||||
|
||||
NAME=kamailio
|
||||
COMMAND=/etc/init.d/$NAME
|
||||
LOGGER="/usr/bin/logger -t hotplug"
|
||||
|
||||
$COMMAND enabled || exit 0
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
config_load $NAME
|
||||
|
||||
config_get_bool enabled general enabled 0
|
||||
[ $enabled -eq 0 ] && exit 0
|
||||
|
||||
config_get hotplug_iface hotplug interface
|
||||
|
||||
[ "$INTERFACE" = "$hotplug_iface" ] && {
|
||||
$LOGGER "Restarting $NAME due to \"$ACTION\" of \"$INTERFACE\""
|
||||
$COMMAND restart
|
||||
}
|
||||
|
Loading…
Reference in a new issue