MT#6485 detect container environment

In order to be able to run NGCP inside a container adding the use
of our ngcp-system-tools helper to check the environment.

Merged changes from templates
pull/11/head
Victor Seva 12 years ago
parent b0c0e396d6
commit 02832db063

2
debian/control vendored

@ -17,6 +17,7 @@ Homepage: http://sipwise.com/
Package: ngcp-rtpengine-daemon
Architecture: any
Pre-Depends: ngcp-system-tools
Depends: ${misc:Depends},
${shlibs:Depends}
Conflicts: ngcp-mediaproxy-ng-daemon
@ -61,6 +62,7 @@ Description: IPtables kernel module for the NGCP media proxy - source.
Package: ngcp-rtpengine-kernel-dkms
Architecture: all
Pre-Depends: ngcp-system-tools
Depends: dkms (>= 1.95),
${misc:Depends}
Conflicts: ngcp-mediaproxy-ng-kernel-dkms

@ -3,9 +3,10 @@
# Provides: ngcp-rtpengine-daemon
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Should-Start: sshd
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Ngcp Mediaproxy-ng
# Short-Description: Ngcp Rtpengine
# Description: Proxy for RTP and other media streams
### END INIT INFO
@ -68,12 +69,27 @@ fi
case "$1" in
start)
set +e
if [ -x "/usr/sbin/ngcp-check_active" ]; then
/usr/sbin/ngcp-check_active -q
status=$?
case "${status}" in
0|3)
echo "Active node or transition."
;;
*)
echo "Ignored start action in inactive node ($status)"
exit 0
;;
esac
fi
echo -n "Starting $DESC: $NAME"
if [ $TABLE -ge 0 ]; then \
if [ $TABLE -ge 0 ] && ! /usr/sbin/ngcp-virt-identify --type container; then
set +e
modprobe xt_MEDIAPROXY
if [ -e /proc/mediaproxy/control ]; then
echo "del $TABLE" > /proc/mediaproxy/control 2>/dev/null
fi
iptables -N mediaproxy 2> /dev/null
iptables -D INPUT -j mediaproxy 2> /dev/null
iptables -I INPUT -j mediaproxy
@ -97,9 +113,11 @@ case "$1" in
if [ "$?" -ne 0 ]; then
return $?
fi
if [ $TABLE -ge 0 ]; then \
if [ $TABLE -ge 0 ] && ! /usr/sbin/ngcp-virt-identify --type container; then
set +e
if [ -e /proc/mediaproxy/control ]; then
echo "del $TABLE" > /proc/mediaproxy/control 2>/dev/null
fi
iptables -D INPUT -j mediaproxy 2> /dev/null
iptables -D mediaproxy -p udp -j MEDIAPROXY --id $TABLE 2>/dev/null
ip6tables -D INPUT -j mediaproxy 2> /dev/null
@ -119,7 +137,20 @@ case "$1" in
return $?
fi
rm -f $PIDFILE
if [ $TABLE -ge 0 ]; then \
if [ -x "/usr/sbin/ngcp-check_active" ]; then
/usr/sbin/ngcp-check_active -q
status=$?
case "${status}" in
0|3)
echo "Active node or transition."
;;
*)
echo "Ignored start action in inactive node ($status)"
exit 0
;;
esac
fi
if [ $TABLE -ge 0 ] && ! /usr/sbin/ngcp-virt-identify --type container; then
sleep 1
set +e
if [ -e /proc/mediaproxy/control ]; then

@ -8,8 +8,10 @@ name=ngcp-rtpengine
version=`dpkg-query -W -f='${Version}' "$package" \
|rev|cut -d- -f2-|rev|cut -d':' -f2|tr -d "\n"`
if /usr/sbin/ngcp-virt-identify --type container; then
echo "Container environment detected. Skip dkms"
else
isadded=`dkms status -m "$name" -v "$version"`
if [ "x${isadded}" = "x" ] ; then
dkms add -m "$name" -v "$version"
fi
@ -22,6 +24,7 @@ if [ "$1" = 'configure' ] ; then
invoke-rc.d ngcp-rtpengine-daemon restart || true
fi
fi
fi
#DEBHELPER#

@ -13,7 +13,11 @@ if [ -x /etc/init.d/ngcp-rtpengine-daemon ] ; then
invoke-rc.d ngcp-rtpengine-daemon stop || true
fi
if /usr/sbin/ngcp-virt-identify --type container; then
echo "Container environment detected. Skip dkms"
else
dkms remove -m "$name" -v "$version" --all || true
fi
#DEBHELPER#

Loading…
Cancel
Save