summaryrefslogtreecommitdiffstats
path: root/pkg
diff options
context:
space:
mode:
authorEric Stanley <estanley@nagios.com>2011-12-16 16:25:44 (GMT)
committerEric Stanley <estanley@nagios.com>2011-12-16 16:25:44 (GMT)
commitce7d5f1a3afe34c78d15f28930e94688d4eafa0f (patch)
tree5c7b6c38304947195f21231b1e9303b11ee5c74b /pkg
parent55fb4097cd416aecd778ccb82e731d25f3ee6fce (diff)
downloadmonitoring-plugins-ce7d5f1a3afe34c78d15f28930e94688d4eafa0f.tar.gz
Updated Solaris package creation to newer standards
The Solaris package creation has been updated to newer standards to match those of the NRPE package. The following changes have been made: - the plugins now install under /opt/nagios - the name of package is now NGOSplugin - the files installed are now owned by the nagios user - the package includes a pre-installation script that creates a nagios user and a nagios group if one did not previously exist
Diffstat (limited to 'pkg')
-rwxr-xr-xpkg/solaris/preinstall35
1 files changed, 35 insertions, 0 deletions
diff --git a/pkg/solaris/preinstall b/pkg/solaris/preinstall
new file mode 100755
index 0000000..c4cc269
--- /dev/null
+++ b/pkg/solaris/preinstall
@@ -0,0 +1,35 @@
1#!/usr/bin/sh
2
3user="nagios"
4uid=-1
5group="nagios"
6gid=-1
7
8/usr/bin/getent group $group > /dev/null 2> /dev/null
9result=$?
10if [ $result -eq 2 ] ; then
11 echo "Group $group does not exist. Creating..."
12 if [ $gid -ne -1 ] ; then
13 /usr/sbin/groupadd -g $gid $group
14 else
15 /usr/sbin/groupadd $group
16 fi
17elif [ $result -ne 0 ] ; then
18 echo "An error occurred determining the existence of the groug $group. Terminating."
19 exit 1;
20fi
21
22/usr/bin/getent passwd $user > /dev/null 2> /dev/null
23result=$?
24if [ $result -eq 2 ] ; then
25 echo "User $user does not exist. Creating..."
26 if [ $uid -ne -1 ] ; then
27 /usr/sbin/useradd -u $uid -g $group $user
28 else
29 /usr/sbin/useradd -g $group $user
30 fi
31elif [ $result -ne 0 ] ; then
32 echo "An error occurred determining the existence of the user $user. Terminating."
33 exit 1;
34fi
35