Debian Codegraph @

builds/install/arch-specific/aix/misc/aixLibrary.sh.in

raw
1 #!/bin/sh
2
3 RunUser=firebird
4 export RunUser
5 RunGroup=firebird
6 export RunGroup
7 PidDir=/var/run/firebird
8 export PidDir
9
10 #------------------------------------------------------------------------
11 # Get correct options & misc.
12
13 tarExt=tar
14 export tarExt
15
16 #------------------------------------------------------------------------
17 # Add new user and group
18
19 #
20 # On AIX the "mkgroup" command creates a new group.
21 # Options include:
22 # "-a", create an administrative group
23 # "-A", set group administrator to the person who invoked the mkgroup command
24 #
25 TryAddGroup() {
26
27 AdditionalParameter=$1
28 testStr=`grep firebird /etc/group`
29
30 if [ -z "$testStr" ]
31 then
32 mkgroup -a firebird
33 fi
34
35 }
36
37 #
38 # On AIX the "useradd" command adds a new user.
39 # Options include:
40 # "-c "comment""
41 # "-d dir" identifies the user's home directory
42 # "-g group", identifies the user's primary group
43 # "-r role1,role2,...", lists the administrative roles for this user
44 # "-s shell" defines the program run for the user at session initiation
45 TryAddUser() {
46
47 AdditionalParameter=$1
48 testStr=`grep firebird /etc/passwd`
49
50 if [ -z "$testStr" ]
51 then
52 useradd -d @FB_CONFDIR@ -s /bin/false \
53 -c "Firebird Database Owner" -g firebird firebird
54 fi
55
56 }
57
58
59 addFirebirdUser() {
60
61 TryAddGroup
62 TryAddUser
63
64 }
65
66
67 #------------------------------------------------------------------------
68 # print location of init script
69
70 getInitScriptLocation() {
71 if [ -f /etc/rc.d/init.d/firebird ]
72 then
73 echo -n /etc/rc.d/init.d/firebird
74 elif [ -f /etc/rc.d/rc.firebird ]
75 then
76 echo -n /etc/rc.d/rc.firebird
77 elif [ -f /etc/init.d/firebird ]
78 then
79 echo -n /etc/init.d/firebird
80 fi
81 }
82
83
84 #------------------------------------------------------------------------
85 # stop super server if it is running
86
87 stopSuperServerIfRunning() {
88 checkString=`ps -eaf | egrep "\b(fbserver|fbguard)\b" |grep -v grep`
89
90 if [ ! -z "$checkString" ]
91 then
92 init_d=`getInitScriptLocation`
93
94 if [ -x "$init_d" ]
95 then
96 $init_d stop
97 fi
98 fi
99 }
100
101 #------------------------------------------------------------------------
102 # Generate new sysdba password - this routine is used only in the
103 # rpm file not in the install script.
104
105 generateNewDBAPassword() {
106 # openssl generates random data.
107 openssl </dev/null >/dev/null 2>/dev/null
108 if [ $? -eq 0 ]
109 then
110 # We generate 20 random chars, strip any '/''s and get the first 8
111 NewPasswd=`openssl rand -base64 20 | tr -d '/' | cut -c1-8`
112 fi
113
114 # there is no mkpasswd on AIX
115
116 if [ -z "$NewPasswd" ]
117 then
118 NewPasswd="masterkey"
119 fi
120
121 writeNewPassword $NewPasswd
122 }
123