summaryrefslogtreecommitdiff
path: root/autoscripts
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2013-07-18 20:04:48 +0400
committerIgor Pashev <pashev.igor@gmail.com>2013-07-18 20:04:48 +0400
commit34e97b1d41b4dd82e16dd2e8917d1f2c5ea038a4 (patch)
tree2ff9d444cde27c43f2d0ba7b72c465d3d85cf340 /autoscripts
parent33464750454b650d1bf53e8ddf66928df453a61b (diff)
downloaddh-smf-34e97b1d41b4dd82e16dd2e8917d1f2c5ea038a4.tar.gz
Can handle services on install/upgrade/remove
Diffstat (limited to 'autoscripts')
-rw-r--r--autoscripts/postinst-smf-refresh10
-rw-r--r--autoscripts/postinst-smf-start12
-rw-r--r--autoscripts/postrm-smf-delete5
-rw-r--r--autoscripts/prerm-smf-stop12
-rw-r--r--autoscripts/prerm-smf-stop-before-remove10
5 files changed, 49 insertions, 0 deletions
diff --git a/autoscripts/postinst-smf-refresh b/autoscripts/postinst-smf-refresh
new file mode 100644
index 0000000..f025687
--- /dev/null
+++ b/autoscripts/postinst-smf-refresh
@@ -0,0 +1,10 @@
+if [ -n "$2" ]; then # only on upgrade
+if [ -x /usr/bin/smf_present ] && /usr/bin/smf_present; then
+ for s in #SERVICES#; do
+ case `svcstatus $s` in
+ disabled|temporary-disabled);;
+ *) /usr/sbin/svcadm -v refresh $s || true;;
+ esac
+ done
+fi
+fi
diff --git a/autoscripts/postinst-smf-start b/autoscripts/postinst-smf-start
new file mode 100644
index 0000000..2383c76
--- /dev/null
+++ b/autoscripts/postinst-smf-start
@@ -0,0 +1,12 @@
+if [ -n "$2" ]; then # only on upgrade
+if [ -x /usr/bin/smf_present ] && /usr/bin/smf_present; then
+ for s in #SERVICES#; do
+ case `svcstatus $s` in
+ maintenance) /usr/sbin/svcadm -v clear $s || true;;
+ offline) /usr/sbin/svcadm -v refresh $s || true;;
+ online) /usr/sbin/svcadm -v restart $s || true;;
+ temporary-disabled) /usr/sbin/svcadm -v enable $s || true;;
+ esac
+ done
+fi
+fi
diff --git a/autoscripts/postrm-smf-delete b/autoscripts/postrm-smf-delete
new file mode 100644
index 0000000..4d33798
--- /dev/null
+++ b/autoscripts/postrm-smf-delete
@@ -0,0 +1,5 @@
+if [ "$1" = remove ]; then
+if [ -x /usr/bin/smf_present ] && /usr/bin/smf_present; then
+ /usr/sbin/svccfg delete -f #SERVICES# || true;
+fi
+fi
diff --git a/autoscripts/prerm-smf-stop b/autoscripts/prerm-smf-stop
new file mode 100644
index 0000000..bdbeb0c
--- /dev/null
+++ b/autoscripts/prerm-smf-stop
@@ -0,0 +1,12 @@
+if [ -x /usr/bin/smf_present ] && /usr/bin/smf_present; then
+ if [ "$1" = "remove" ]; then
+ temp=""
+ else
+ temp="-t"
+ fi
+ for s in #SERVICES#; do
+ case `svcstatus $s` in
+ online|offline) /usr/sbin/svcadm -v disable $temp -s $s;;
+ esac
+ done
+fi
diff --git a/autoscripts/prerm-smf-stop-before-remove b/autoscripts/prerm-smf-stop-before-remove
new file mode 100644
index 0000000..5b4324a
--- /dev/null
+++ b/autoscripts/prerm-smf-stop-before-remove
@@ -0,0 +1,10 @@
+if [ "$1" = remove ]; then
+if [ -x /usr/bin/smf_present ] && /usr/bin/smf_present; then
+ for s in #SERVICES#; do
+ case `svcstatus $s` in
+ disabled);;
+ *) /usr/sbin/svcadm -v disable -s $s;;
+ esac
+ done
+fi
+fi