diff options
author | Matthias Eble <psychotrahe@users.sourceforge.net> | 2012-04-10 22:49:24 +0200 |
---|---|---|
committer | Matthias Eble <psychotrahe@users.sourceforge.net> | 2012-04-10 22:49:24 +0200 |
commit | 4c30935850997f513b3eee21d169f6d523d43c5d (patch) | |
tree | 09a14dfecd959e1b566b9df7b7fdb99f6bb4c5d8 /pkg/solaris/preinstall | |
parent | 9978b3ca744b076d8ea24441819826938211dd17 (diff) | |
parent | 8c7e2b636c601dd05a6881c84cc95136ecf9323e (diff) | |
download | monitoring-plugins-4c30935850997f513b3eee21d169f6d523d43c5d.tar.gz |
Merge branch 'master' of ssh://nagiosplug.git.sourceforge.net/gitroot/nagiosplug/nagiosplug
Diffstat (limited to 'pkg/solaris/preinstall')
-rwxr-xr-x | pkg/solaris/preinstall | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/pkg/solaris/preinstall b/pkg/solaris/preinstall new file mode 100755 index 00000000..c4cc2690 --- /dev/null +++ b/pkg/solaris/preinstall | |||
@@ -0,0 +1,35 @@ | |||
1 | #!/usr/bin/sh | ||
2 | |||
3 | user="nagios" | ||
4 | uid=-1 | ||
5 | group="nagios" | ||
6 | gid=-1 | ||
7 | |||
8 | /usr/bin/getent group $group > /dev/null 2> /dev/null | ||
9 | result=$? | ||
10 | if [ $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 | ||
17 | elif [ $result -ne 0 ] ; then | ||
18 | echo "An error occurred determining the existence of the groug $group. Terminating." | ||
19 | exit 1; | ||
20 | fi | ||
21 | |||
22 | /usr/bin/getent passwd $user > /dev/null 2> /dev/null | ||
23 | result=$? | ||
24 | if [ $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 | ||
31 | elif [ $result -ne 0 ] ; then | ||
32 | echo "An error occurred determining the existence of the user $user. Terminating." | ||
33 | exit 1; | ||
34 | fi | ||
35 | |||