mirror of
https://github.com/Telecominfraproject/OpenNetworkLinux.git
synced 2026-01-27 10:22:15 +00:00
The postinst script now checks /usr/sbin/policy-rc.d
Some complicated service dependencies will fail to configure under normal circumstances because invoke-rc.d will kill service start based on policy-rc.d but this is not taken into account when configuring services that are dependent on that service. The dependency check fails prior to the policy-rc.d check and as a result some packages will remain unconfigured after we have finished constructing the root filesystem. This is ok for most cases but precludes dynamic modification of that filesystem post-creation and will even cause those unconfigured services to be restarted the first time a new package is installed. Checking policy-rc.d first in the postinst script allows the configuration step to complete for all services and their dependents to fix these problems.
This commit is contained in:
@@ -69,10 +69,17 @@ class OnlPackageServiceScript(object):
|
||||
|
||||
class OnlPackageAfterInstallScript(OnlPackageServiceScript):
|
||||
SCRIPT = """#!/bin/sh
|
||||
set -e
|
||||
if [ -x "/etc/init.d/%(service)s" ]; then
|
||||
update-rc.d %(service)s defaults >/dev/null
|
||||
invoke-rc.d %(service)s start || exit $?
|
||||
if [ -x "/usr/sbin/policy-rc.d" ]; then
|
||||
/usr/sbin/policy-rc.d
|
||||
if [ $? -eq 101 ]; then
|
||||
echo "warning: service %(service)s: postinst: ignored due to policy-rc.d"
|
||||
exit 0;
|
||||
fi
|
||||
fi
|
||||
set -e
|
||||
update-rc.d %(service)s defaults >/dev/null
|
||||
invoke-rc.d %(service)s start || exit $?
|
||||
fi
|
||||
"""
|
||||
|
||||
@@ -80,7 +87,7 @@ class OnlPackageBeforeRemoveScript(OnlPackageServiceScript):
|
||||
SCRIPT = """#!/bin/sh
|
||||
set -e
|
||||
if [ -x "/etc/init.d/%(service)s" ]; then
|
||||
invoke-rc.d %(service)s stop || exit $?
|
||||
invoke-rc.d %(service)s stop || exit $?
|
||||
fi
|
||||
"""
|
||||
|
||||
@@ -88,7 +95,7 @@ class OnlPackageAfterRemoveScript(OnlPackageServiceScript):
|
||||
SCRIPT = """#!/bin/sh
|
||||
set -e
|
||||
if [ "$1" = "purge" ] ; then
|
||||
update-rc.d %(service)s remove >/dev/null
|
||||
update-rc.d %(service)s remove >/dev/null
|
||||
fi
|
||||
"""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user