diff options
Diffstat (limited to 'debian/mysql-server-5.5.postinst')
-rw-r--r-- | debian/mysql-server-5.5.postinst | 38 |
1 files changed, 33 insertions, 5 deletions
diff --git a/debian/mysql-server-5.5.postinst b/debian/mysql-server-5.5.postinst index d13f9be..375e310 100644 --- a/debian/mysql-server-5.5.postinst +++ b/debian/mysql-server-5.5.postinst @@ -9,14 +9,25 @@ ${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 } export PATH=$PATH:/sbin:/usr/sbin:/bin:/usr/bin +HAVE_SMF=no +SMF_INCLUDE=/lib/svc/share/smf_include.sh +if [ -f $SMF_INCLUDE ]; then + source $SMF_INCLUDE + if smf_present; then + HAVE_SMF=yes + fi +fi + # This command can be used as pipe to syslog. With "-s" it also logs to stderr. ERR_LOGGER="logger -p daemon.err -t mysqld_safe -i" -invoke() { - if [ -x /usr/sbin/invoke-rc.d ]; then - invoke-rc.d mysql $1 +stop_server() { + if [ $HAVE_SMF = yes ]; then + svcadm disable -t mysql:default >/dev/null 2>&1 + elif [ -x /usr/sbin/invoke-rc.d ]; then + invoke-rc.d mysql stop else - /etc/init.d/mysql $1 + /etc/init.d/mysql stop fi } @@ -60,7 +71,7 @@ EOF # and because changed configuration options should take effect immediately. # In case the server wasn't running at all it should be ok if the stop # script fails. I can't tell at this point because of the cleaned /var/run. -set +e; invoke stop; set -e +set +e; stop_server; set -e case "$1" in configure) @@ -278,6 +289,23 @@ fi db_stop # in case invoke failes +if [ $HAVE_SMF = yes ]; then + service=mysql:default + case `svcs -Ho STATE $service 2>/dev/null` in + online) + svcadm -v restart $service || true + ;; + + maintenance) + svcadm -v clear $service || true + ;; + + disabled) + svcadm -v enable $service || true + ;; + esac +fi + #DEBHELPER# exit 0 |