~drizzle-trunk/drizzle/development

1025.1.1 by Trond Norbye
Add configuration files to integrate to Solaris SMF
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
17
prefix=@prefix@
18
exec_prefix=@exec_prefix@
19
20
grep solaris.smf.value.drizzle /etc/security/auth_attr > /dev/null
21
if [ $? -ne 0 ]
22
then
1025.1.2 by Trond Norbye
Remove output from ed during smf install
23
  ed /etc/security/auth_attr > /dev/null <<EOF
1025.1.1 by Trond Norbye
Add configuration files to integrate to Solaris SMF
24
a
25
solaris.smf.value.drizzle:::Change Drizzle value properties::
26
solaris.smf.manage.drizzle:::Manage Drizzle service states::
27
.
28
w
29
q
30
EOF
31
  if [ $? -ne 0 ]
32
  then
33
    echo "Failed to add authorization definitions"
34
    exit 1
35
  fi
36
fi
37
38
grep solaris.smf.manage.drizzle /etc/security/prof_attr > /dev/null
39
if [ $? -ne 0 ]
40
then
1025.1.2 by Trond Norbye
Remove output from ed during smf install
41
  ed /etc/security/prof_attr > /dev/null <<EOF
1025.1.1 by Trond Norbye
Add configuration files to integrate to Solaris SMF
42
a
43
Drizzle Administration::::auths=solaris.smf.manage.drizzle,solaris.smf.value.drizzle
44
.
45
w
46
q
47
EOF
48
49
  if [ $? -ne 0 ]
50
  then
51
    echo "Failed to add profile definitions"
52
    exit 1
53
  fi
54
fi
55
56
getent group drizzled > /dev/null
57
if [ $? -ne 0 ]
58
then
59
  groupadd drizzled
60
  if [ $? -ne 0 ]
61
  then
62
    echo "Failed to create group drizzled"
63
    exit 1
64
  fi
65
fi
66
67
getent passwd drizzled > /dev/null
68
if [ $? -ne 0 ]
69
then
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@
81
fi
82
83
/usr/sbin/install -f /lib/svc/method drizzle
84
if [ $? -ne 0 ]
85
then
86
  echo "Failed to install smf startup script"
87
  exit 1
88
fi
89
90
/usr/sbin/install -f /var/svc/manifest/application -m 0444 drizzle.xml
91
if [ $? -ne 0 ]
92
then
93
  echo "Failed to install smf definition"
94
  exit 1
95
fi
96
97
svccfg import /var/svc/manifest/application/drizzle.xml
98
if [ $? -ne 0 ]
99
then
100
  echo "Failed to import smf definition"
101
  exit 1
102
fi
103