diff --git a/debian/ngcp-rtpengine-daemon.init b/debian/ngcp-rtpengine-daemon.init index 48b4dc5aa..13f8b78ca 100755 --- a/debian/ngcp-rtpengine-daemon.init +++ b/debian/ngcp-rtpengine-daemon.init @@ -67,6 +67,12 @@ if test "$FORK" = "no" ; then OPTIONS="$OPTIONS --foreground" fi +if [ -x /usr/sbin/ngcp-virt-identify ]; then + if /usr/sbin/ngcp-virt-identify --type container; then + VIRT="yes" + fi +fi + case "$1" in start) set +e @@ -84,7 +90,7 @@ case "$1" in esac fi echo -n "Starting $DESC: $NAME" - if [ $TABLE -ge 0 ] && ! /usr/sbin/ngcp-virt-identify --type container; then + if [ $TABLE -ge 0 ] && [ "$VIRT" != "yes" ]; then set +e modprobe xt_MEDIAPROXY if [ -e /proc/mediaproxy/control ]; then @@ -113,7 +119,7 @@ case "$1" in if [ "$?" -ne 0 ]; then return $? fi - if [ $TABLE -ge 0 ] && ! /usr/sbin/ngcp-virt-identify --type container; then + if [ $TABLE -ge 0 ] && [ "$VIRT" != "yes" ]; then set +e if [ -e /proc/mediaproxy/control ]; then echo "del $TABLE" > /proc/mediaproxy/control 2>/dev/null @@ -150,7 +156,7 @@ case "$1" in ;; esac fi - if [ $TABLE -ge 0 ] && ! /usr/sbin/ngcp-virt-identify --type container; then + if [ $TABLE -ge 0 ] && [ "$VIRT" != "yes" ]; then sleep 1 set +e if [ -e /proc/mediaproxy/control ]; then diff --git a/debian/ngcp-rtpengine-kernel-dkms.postinst b/debian/ngcp-rtpengine-kernel-dkms.postinst index 021c589d0..7c2f80375 100644 --- a/debian/ngcp-rtpengine-kernel-dkms.postinst +++ b/debian/ngcp-rtpengine-kernel-dkms.postinst @@ -8,7 +8,14 @@ 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 + +if [ -x /usr/sbin/ngcp-virt-identify ]; then + if /usr/sbin/ngcp-virt-identify --type container; then + VIRT="yes" + fi +fi + +if [ "$VIRT" = "yes" ]; then echo "Container environment detected. Skip dkms" else isadded=`dkms status -m "$name" -v "$version"` diff --git a/debian/ngcp-rtpengine-kernel-dkms.prerm b/debian/ngcp-rtpengine-kernel-dkms.prerm index 130c1b223..c6df3c03c 100644 --- a/debian/ngcp-rtpengine-kernel-dkms.prerm +++ b/debian/ngcp-rtpengine-kernel-dkms.prerm @@ -8,12 +8,18 @@ name=ngcp-rtpengine version=`dpkg-query -W -f='${Version}' "$package" \ |rev|cut -d- -f2-|rev|cut -d':' -f2|tr -d "\n"` +if [ -x /usr/sbin/ngcp-virt-identify ]; then + if /usr/sbin/ngcp-virt-identify --type container; then + VIRT="yes" + fi +fi + # make sure it's not running 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 +if [ "$VIRT" = "yes" ]; then echo "Container environment detected. Skip dkms" else dkms remove -m "$name" -v "$version" --all || true