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
1=== modified file '.bzrignore'
2--- .bzrignore 2009-05-07 21:25:23 +0000
3+++ .bzrignore 2009-05-18 17:46:43 +0000
4@@ -36,6 +36,10 @@
5 strings/Makefile.in
6 strings/tests/Makefile.in
7 support-files/Makefile.in
8+support-files/smf/Makefile.in
9+support-files/smf/install.sh
10+support-files/smf/drizzle
11+support-files/smf/drizzle.xml
12 tests/Makefile.in
13 unittest/Makefile.in
14 unittest/examples/Makefile.in
15
16=== modified file 'configure.ac'
17--- configure.ac 2009-05-14 06:01:02 +0000
18+++ configure.ac 2009-05-18 17:46:43 +0000
19@@ -1453,7 +1453,11 @@
20 support-files/Makefile dnl
21 tests/Makefile tests/install_test_db dnl
22 drizzled/drizzled_safe dnl
23- support-files/drizzle.server support-files/drizzle-log-rotate)
24+ support-files/drizzle.server support-files/drizzle-log-rotate
25+ support-files/smf/Makefile dnl
26+ support-files/smf/install.sh dnl
27+ support-files/smf/drizzle.xml dnl
28+ support-files/smf/drizzle)
29
30 scheduling_plugins_available="
31 pool_of_threads
32
33=== modified file 'support-files/Makefile.am'
34--- support-files/Makefile.am 2009-04-07 08:32:11 +0000
35+++ support-files/Makefile.am 2009-05-18 17:46:43 +0000
36@@ -15,6 +15,8 @@
37 # Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
38 # MA 02111-1307, USA
39
40+SUBDIRS = smf
41+
42 pkgconfigdir = $(libdir)/pkgconfig
43
44 # Default same as 'pkgdatadir', but we can override it
45
46=== added directory 'support-files/smf'
47=== added file 'support-files/smf/Makefile.am'
48--- support-files/smf/Makefile.am 1970-01-01 00:00:00 +0000
49+++ support-files/smf/Makefile.am 2009-05-18 17:46:43 +0000
50@@ -0,0 +1,16 @@
51+# Copyright (C) 2009 Sun Microsystems
52+#
53+# This program is free software; you can redistribute it and/or modify
54+# it under the terms of the GNU General Public License as published by
55+# the Free Software Foundation; version 2 of the License.
56+#
57+# This program is distributed in the hope that it will be useful,
58+# but WITHOUT ANY WARRANTY; without even the implied warranty of
59+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
60+# GNU General Public License for more details.
61+#
62+# You should have received a copy of the GNU General Public License
63+# along with this program; if not, write to the Free Software
64+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
65+
66+EXTRA_DIST= install.sh drizzle.xml drizzle
67
68=== added file 'support-files/smf/drizzle.in'
69--- support-files/smf/drizzle.in 1970-01-01 00:00:00 +0000
70+++ support-files/smf/drizzle.in 2009-05-18 17:46:43 +0000
71@@ -0,0 +1,41 @@
72+#!/sbin/sh
73+# Copyright (C) 2009 Sun Microsystems
74+#
75+# This program is free software; you can redistribute it and/or modify
76+# it under the terms of the GNU General Public License as published by
77+# the Free Software Foundation; version 2 of the License.
78+#
79+# This program is distributed in the hope that it will be useful,
80+# but WITHOUT ANY WARRANTY; without even the implied warranty of
81+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
82+# GNU General Public License for more details.
83+#
84+# You should have received a copy of the GNU General Public License
85+# along with this program; if not, write to the Free Software
86+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
87+
88+. /lib/svc/share/smf_include.sh
89+
90+prefix=@prefix@
91+exec_prefix=@exec_prefix@
92+datadir=`svcprop -p drizzle/datadir $SMF_FMRI`
93+
94+case "$1" in
95+ 'start')
96+ /bin/coreadm -p "`svcprop -p drizzle/corepattern $SMF_FMRI`" $$
97+ @sbindir@/drizzled --datadir=`eval echo ${datadir}` \
98+ --port=`svcprop -p drizzle/port $SMF_FMRI` \
99+ --skip-stack-trace &
100+ ;;
101+
102+ 'stop')
103+ smf_kill_contract $2 TERM 1
104+ ;;
105+
106+ *)
107+ echo "Usage: $0 {start|stop}"
108+ exit 1
109+;;
110+esac
111+
112+exit $SMF_EXIT_OK
113
114=== added file 'support-files/smf/drizzle.xml.in'
115--- support-files/smf/drizzle.xml.in 1970-01-01 00:00:00 +0000
116+++ support-files/smf/drizzle.xml.in 2009-05-18 17:46:43 +0000
117@@ -0,0 +1,71 @@
118+<?xml version="1.0"?>
119+<!--
120+ Copyright (C) 2009 Sun Microsystems
121+
122+ This program is free software; you can redistribute it and/or modify
123+ it under the terms of the GNU General Public License as published by
124+ the Free Software Foundation; version 2 of the License.
125+
126+ This program is distributed in the hope that it will be useful,
127+ but WITHOUT ANY WARRANTY; without even the implied warranty of
128+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
129+ GNU General Public License for more details.
130+
131+ You should have received a copy of the GNU General Public License
132+ along with this program; if not, write to the Free Software
133+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
134+-->
135+<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
136+<service_bundle type="manifest" name="drizzle">
137+ <service name="application/database/drizzle" type="service" version="1">
138+ <single_instance/>
139+
140+ <dependency name="multi-user-server" grouping="require_all" restart_on="none" type="service">
141+ <service_fmri value="svc:/milestone/multi-user-server" />
142+ </dependency>
143+
144+
145+ <!-- We need to map the name of the authorizations we defined to this service -->
146+ <property_group name="general" type="framework">
147+ <propval name="action_authorization" type="astring"
148+ value="solaris.smf.manage.drizzle" />
149+ <propval name="value_authorization" type="astring"
150+ value="solaris.smf.value.drizzle" />
151+ </property_group>
152+
153+
154+ <property_group name="drizzle" type="application">
155+ <propval name="datadir" type="astring"
156+ value="@localstatedir@/data" />
157+ <propval name="corepattern" type="astring"
158+ value="@localstatedir@/crash/core.%f.%p" />
159+ <propval name="port" type="astring"
160+ value="4427" />
161+ </property_group>
162+
163+ <!-- Define the instance and how to start / stop it -->
164+ <instance name="drizzle" enabled="false">
165+ <exec_method type="method" name="start" exec="/lib/svc/method/drizzle start" timeout_seconds="30" >
166+ <method_context>
167+ <method_credential user="drizzled" group="drizzled" />
168+ </method_context>
169+ </exec_method>
170+ <exec_method type="method" name="stop" exec="/lib/svc/method/drizzle stop %{restarter/contract}" timeout_seconds="60" >
171+ <method_context>
172+ <method_credential user="drizzled" group="drizzled" />
173+ </method_context>
174+ </exec_method>
175+ </instance>
176+
177+
178+ <stability value="Unstable" />
179+ <template>
180+ <common_name>
181+ <loctext xml:lang="C">Drizzle database server</loctext>
182+ </common_name>
183+ <documentation>
184+ <manpage title="drizzle" section="1" manpath="@prefix@/share/man" />
185+ </documentation>
186+ </template>
187+ </service>
188+</service_bundle>
189
190=== added file 'support-files/smf/install.sh.in'
191--- support-files/smf/install.sh.in 1970-01-01 00:00:00 +0000
192+++ support-files/smf/install.sh.in 2009-05-18 17:46:43 +0000
193@@ -0,0 +1,103 @@
194+#! /bin/pfsh
195+# Copyright (C) 2009 Sun Microsystems
196+#
197+# This program is free software; you can redistribute it and/or modify
198+# it under the terms of the GNU General Public License as published by
199+# the Free Software Foundation; version 2 of the License.
200+#
201+# This program is distributed in the hope that it will be useful,
202+# but WITHOUT ANY WARRANTY; without even the implied warranty of
203+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
204+# GNU General Public License for more details.
205+#
206+# You should have received a copy of the GNU General Public License
207+# along with this program; if not, write to the Free Software
208+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
209+
210+prefix=@prefix@
211+exec_prefix=@exec_prefix@
212+
213+grep solaris.smf.value.drizzle /etc/security/auth_attr > /dev/null
214+if [ $? -ne 0 ]
215+then
216+ ed /etc/security/auth_attr <<EOF
217+a
218+solaris.smf.value.drizzle:::Change Drizzle value properties::
219+solaris.smf.manage.drizzle:::Manage Drizzle service states::
220+.
221+w
222+q
223+EOF
224+ if [ $? -ne 0 ]
225+ then
226+ echo "Failed to add authorization definitions"
227+ exit 1
228+ fi
229+fi
230+
231+grep solaris.smf.manage.drizzle /etc/security/prof_attr > /dev/null
232+if [ $? -ne 0 ]
233+then
234+ ed /etc/security/prof_attr <<EOF
235+a
236+Drizzle Administration::::auths=solaris.smf.manage.drizzle,solaris.smf.value.drizzle
237+.
238+w
239+q
240+EOF
241+
242+ if [ $? -ne 0 ]
243+ then
244+ echo "Failed to add profile definitions"
245+ exit 1
246+ fi
247+fi
248+
249+getent group drizzled > /dev/null
250+if [ $? -ne 0 ]
251+then
252+ groupadd drizzled
253+ if [ $? -ne 0 ]
254+ then
255+ echo "Failed to create group drizzled"
256+ exit 1
257+ fi
258+fi
259+
260+getent passwd drizzled > /dev/null
261+if [ $? -ne 0 ]
262+then
263+ roleadd -c "Drizzle daemon" -d @localstatedir@ -g drizzled \
264+ -A solaris.smf.value.drizzle,solaris.smf.manage.drizzle drizzled
265+ if [ $? -ne 0 ]
266+ then
267+ echo "Failed to create role drizzled"
268+ exit 1
269+ fi
270+
271+ mkdir -p @localstatedir@/data
272+ mkdir -p @localstatedir@/crash
273+ chown -R drizzled:drizzled @localstatedir@
274+fi
275+
276+/usr/sbin/install -f /lib/svc/method drizzle
277+if [ $? -ne 0 ]
278+then
279+ echo "Failed to install smf startup script"
280+ exit 1
281+fi
282+
283+/usr/sbin/install -f /var/svc/manifest/application -m 0444 drizzle.xml
284+if [ $? -ne 0 ]
285+then
286+ echo "Failed to install smf definition"
287+ exit 1
288+fi
289+
290+svccfg import /var/svc/manifest/application/drizzle.xml
291+if [ $? -ne 0 ]
292+then
293+ echo "Failed to import smf definition"
294+ exit 1
295+fi
296+