Merge lp:~trond-norbye/drizzle/smf-integration into lp:~drizzle-trunk/drizzle/development

Proposed by Trond Norbye
Status: Merged
Merged at revision: not available
Proposed branch: lp:~trond-norbye/drizzle/smf-integration
Merge into: lp:~drizzle-trunk/drizzle/development
Diff against target: None lines
To merge this branch: bzr merge lp:~trond-norbye/drizzle/smf-integration
Reviewer Review Type Date Requested Status
Drizzle Developers Pending
Review via email: mp+6682@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Trond Norbye (trond-norbye) wrote :

Added configuration files (and a script to install them) needed to run drizzle as a service in SMF.

1027. By Trond Norbye

Remove output from ed during smf install

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file '.bzrignore'
--- .bzrignore 2009-05-07 21:25:23 +0000
+++ .bzrignore 2009-05-18 17:46:43 +0000
@@ -36,6 +36,10 @@
36strings/Makefile.in36strings/Makefile.in
37strings/tests/Makefile.in37strings/tests/Makefile.in
38support-files/Makefile.in38support-files/Makefile.in
39support-files/smf/Makefile.in
40support-files/smf/install.sh
41support-files/smf/drizzle
42support-files/smf/drizzle.xml
39tests/Makefile.in43tests/Makefile.in
40unittest/Makefile.in44unittest/Makefile.in
41unittest/examples/Makefile.in45unittest/examples/Makefile.in
4246
=== modified file 'configure.ac'
--- configure.ac 2009-05-14 06:01:02 +0000
+++ configure.ac 2009-05-18 17:46:43 +0000
@@ -1453,7 +1453,11 @@
1453 support-files/Makefile dnl1453 support-files/Makefile dnl
1454 tests/Makefile tests/install_test_db dnl1454 tests/Makefile tests/install_test_db dnl
1455 drizzled/drizzled_safe dnl1455 drizzled/drizzled_safe dnl
1456 support-files/drizzle.server support-files/drizzle-log-rotate)1456 support-files/drizzle.server support-files/drizzle-log-rotate
1457 support-files/smf/Makefile dnl
1458 support-files/smf/install.sh dnl
1459 support-files/smf/drizzle.xml dnl
1460 support-files/smf/drizzle)
14571461
1458scheduling_plugins_available="1462scheduling_plugins_available="
1459 pool_of_threads 1463 pool_of_threads
14601464
=== modified file 'support-files/Makefile.am'
--- support-files/Makefile.am 2009-04-07 08:32:11 +0000
+++ support-files/Makefile.am 2009-05-18 17:46:43 +0000
@@ -15,6 +15,8 @@
15# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,15# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
16# MA 02111-1307, USA16# MA 02111-1307, USA
1717
18SUBDIRS = smf
19
18pkgconfigdir = $(libdir)/pkgconfig20pkgconfigdir = $(libdir)/pkgconfig
1921
20# Default same as 'pkgdatadir', but we can override it22# Default same as 'pkgdatadir', but we can override it
2123
=== added directory 'support-files/smf'
=== added file 'support-files/smf/Makefile.am'
--- support-files/smf/Makefile.am 1970-01-01 00:00:00 +0000
+++ support-files/smf/Makefile.am 2009-05-18 17:46:43 +0000
@@ -0,0 +1,16 @@
1# Copyright (C) 2009 Sun Microsystems
2#
3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by
5# the Free Software Foundation; version 2 of the License.
6#
7# This program is distributed in the hope that it will be useful,
8# but WITHOUT ANY WARRANTY; without even the implied warranty of
9# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10# GNU General Public License for more details.
11#
12# You should have received a copy of the GNU General Public License
13# along with this program; if not, write to the Free Software
14# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
15
16EXTRA_DIST= install.sh drizzle.xml drizzle
017
=== added file 'support-files/smf/drizzle.in'
--- support-files/smf/drizzle.in 1970-01-01 00:00:00 +0000
+++ support-files/smf/drizzle.in 2009-05-18 17:46:43 +0000
@@ -0,0 +1,41 @@
1#!/sbin/sh
2# Copyright (C) 2009 Sun Microsystems
3#
4# This program is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation; version 2 of the License.
7#
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
14# along with this program; if not, write to the Free Software
15# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16
17. /lib/svc/share/smf_include.sh
18
19prefix=@prefix@
20exec_prefix=@exec_prefix@
21datadir=`svcprop -p drizzle/datadir $SMF_FMRI`
22
23case "$1" in
24 'start')
25 /bin/coreadm -p "`svcprop -p drizzle/corepattern $SMF_FMRI`" $$
26 @sbindir@/drizzled --datadir=`eval echo ${datadir}` \
27 --port=`svcprop -p drizzle/port $SMF_FMRI` \
28 --skip-stack-trace &
29 ;;
30
31 'stop')
32 smf_kill_contract $2 TERM 1
33 ;;
34
35 *)
36 echo "Usage: $0 {start|stop}"
37 exit 1
38;;
39esac
40
41exit $SMF_EXIT_OK
042
=== added file 'support-files/smf/drizzle.xml.in'
--- support-files/smf/drizzle.xml.in 1970-01-01 00:00:00 +0000
+++ support-files/smf/drizzle.xml.in 2009-05-18 17:46:43 +0000
@@ -0,0 +1,71 @@
1<?xml version="1.0"?>
2<!--
3 Copyright (C) 2009 Sun Microsystems
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; version 2 of the License.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17-->
18<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
19<service_bundle type="manifest" name="drizzle">
20 <service name="application/database/drizzle" type="service" version="1">
21 <single_instance/>
22
23 <dependency name="multi-user-server" grouping="require_all" restart_on="none" type="service">
24 <service_fmri value="svc:/milestone/multi-user-server" />
25 </dependency>
26
27
28 <!-- We need to map the name of the authorizations we defined to this service -->
29 <property_group name="general" type="framework">
30 <propval name="action_authorization" type="astring"
31 value="solaris.smf.manage.drizzle" />
32 <propval name="value_authorization" type="astring"
33 value="solaris.smf.value.drizzle" />
34 </property_group>
35
36
37 <property_group name="drizzle" type="application">
38 <propval name="datadir" type="astring"
39 value="@localstatedir@/data" />
40 <propval name="corepattern" type="astring"
41 value="@localstatedir@/crash/core.%f.%p" />
42 <propval name="port" type="astring"
43 value="4427" />
44 </property_group>
45
46 <!-- Define the instance and how to start / stop it -->
47 <instance name="drizzle" enabled="false">
48 <exec_method type="method" name="start" exec="/lib/svc/method/drizzle start" timeout_seconds="30" >
49 <method_context>
50 <method_credential user="drizzled" group="drizzled" />
51 </method_context>
52 </exec_method>
53 <exec_method type="method" name="stop" exec="/lib/svc/method/drizzle stop %{restarter/contract}" timeout_seconds="60" >
54 <method_context>
55 <method_credential user="drizzled" group="drizzled" />
56 </method_context>
57 </exec_method>
58 </instance>
59
60
61 <stability value="Unstable" />
62 <template>
63 <common_name>
64 <loctext xml:lang="C">Drizzle database server</loctext>
65 </common_name>
66 <documentation>
67 <manpage title="drizzle" section="1" manpath="@prefix@/share/man" />
68 </documentation>
69 </template>
70 </service>
71</service_bundle>
072
=== added file 'support-files/smf/install.sh.in'
--- support-files/smf/install.sh.in 1970-01-01 00:00:00 +0000
+++ support-files/smf/install.sh.in 2009-05-18 17:46:43 +0000
@@ -0,0 +1,103 @@
1#! /bin/pfsh
2# Copyright (C) 2009 Sun Microsystems
3#
4# This program is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation; version 2 of the License.
7#
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
14# along with this program; if not, write to the Free Software
15# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16
17prefix=@prefix@
18exec_prefix=@exec_prefix@
19
20grep solaris.smf.value.drizzle /etc/security/auth_attr > /dev/null
21if [ $? -ne 0 ]
22then
23 ed /etc/security/auth_attr <<EOF
24a
25solaris.smf.value.drizzle:::Change Drizzle value properties::
26solaris.smf.manage.drizzle:::Manage Drizzle service states::
27.
28w
29q
30EOF
31 if [ $? -ne 0 ]
32 then
33 echo "Failed to add authorization definitions"
34 exit 1
35 fi
36fi
37
38grep solaris.smf.manage.drizzle /etc/security/prof_attr > /dev/null
39if [ $? -ne 0 ]
40then
41 ed /etc/security/prof_attr <<EOF
42a
43Drizzle Administration::::auths=solaris.smf.manage.drizzle,solaris.smf.value.drizzle
44.
45w
46q
47EOF
48
49 if [ $? -ne 0 ]
50 then
51 echo "Failed to add profile definitions"
52 exit 1
53 fi
54fi
55
56getent group drizzled > /dev/null
57if [ $? -ne 0 ]
58then
59 groupadd drizzled
60 if [ $? -ne 0 ]
61 then
62 echo "Failed to create group drizzled"
63 exit 1
64 fi
65fi
66
67getent passwd drizzled > /dev/null
68if [ $? -ne 0 ]
69then
70 roleadd -c "Drizzle daemon" -d @localstatedir@ -g drizzled \
71 -A solaris.smf.value.drizzle,solaris.smf.manage.drizzle drizzled
72 if [ $? -ne 0 ]
73 then
74 echo "Failed to create role drizzled"
75 exit 1
76 fi
77
78 mkdir -p @localstatedir@/data
79 mkdir -p @localstatedir@/crash
80 chown -R drizzled:drizzled @localstatedir@
81fi
82
83/usr/sbin/install -f /lib/svc/method drizzle
84if [ $? -ne 0 ]
85then
86 echo "Failed to install smf startup script"
87 exit 1
88fi
89
90/usr/sbin/install -f /var/svc/manifest/application -m 0444 drizzle.xml
91if [ $? -ne 0 ]
92then
93 echo "Failed to install smf definition"
94 exit 1
95fi
96
97svccfg import /var/svc/manifest/application/drizzle.xml
98if [ $? -ne 0 ]
99then
100 echo "Failed to import smf definition"
101 exit 1
102fi
103