mirror of
https://github.com/monitoring-plugins/monitoring-plugins.git
synced 2026-06-13 18:50:01 -04:00
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
This commit is contained in:
parent
55fb4097cd
commit
ce7d5f1a3a
1 changed files with 35 additions and 0 deletions
35
pkg/solaris/preinstall
Executable file
35
pkg/solaris/preinstall
Executable file
|
|
@ -0,0 +1,35 @@
|
|||
#!/usr/bin/sh
|
||||
|
||||
user="nagios"
|
||||
uid=-1
|
||||
group="nagios"
|
||||
gid=-1
|
||||
|
||||
/usr/bin/getent group $group > /dev/null 2> /dev/null
|
||||
result=$?
|
||||
if [ $result -eq 2 ] ; then
|
||||
echo "Group $group does not exist. Creating..."
|
||||
if [ $gid -ne -1 ] ; then
|
||||
/usr/sbin/groupadd -g $gid $group
|
||||
else
|
||||
/usr/sbin/groupadd $group
|
||||
fi
|
||||
elif [ $result -ne 0 ] ; then
|
||||
echo "An error occurred determining the existence of the groug $group. Terminating."
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
/usr/bin/getent passwd $user > /dev/null 2> /dev/null
|
||||
result=$?
|
||||
if [ $result -eq 2 ] ; then
|
||||
echo "User $user does not exist. Creating..."
|
||||
if [ $uid -ne -1 ] ; then
|
||||
/usr/sbin/useradd -u $uid -g $group $user
|
||||
else
|
||||
/usr/sbin/useradd -g $group $user
|
||||
fi
|
||||
elif [ $result -ne 0 ] ; then
|
||||
echo "An error occurred determining the existence of the user $user. Terminating."
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
Loading…
Reference in a new issue