diff --git a/macros.nagios b/macros.nagios index 0b6262a..fd5346f 100644 --- a/macros.nagios +++ b/macros.nagios @@ -51,4 +51,18 @@ # Group, that can execute commands via %{nagios_command_file} %nagios_command_group nagcmd +# Add Nagios user and groups +%nagios_user_group_add() \ + /usr/sbin/groupadd -r %{nagios_group} 2>/dev/null || :\ + /usr/sbin/useradd -r -g %{nagios_group} -d %{nagios_localstatedir} -s /bin/false -c "User for Nagios" %{nagios_user} 2>/dev/null || :\ + %{nil} + +%nagios_command_user_group_add() \ + /usr/sbin/groupadd -r %{nagios_command_group} 2>/dev/null || :\ + %if 0%{?suse_version} > 01220 \ + /usr/sbin/usermod -a -G %{nagios_command_group} %{nagios_user} || :\ + %else \ + /usr/sbin/groupmod -A %{nagios_user} %{nagios_command_group} 2>/dev/null || :\ + %endif \ + %{nil} diff --git a/nagios-rpm-macros.changes b/nagios-rpm-macros.changes index f949333..fce4177 100644 --- a/nagios-rpm-macros.changes +++ b/nagios-rpm-macros.changes @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Tue Jan 1 14:40:45 UTC 2013 - lars@linux-schulserver.de + +Update to 0.06: +- added new macros: + + %nagios_user_group_add + + %nagios_command_user_group_add + to make it easier to have the same useradd/groupadd invocations + in all packages + ------------------------------------------------------------------- Fri Aug 17 15:02:35 UTC 2012 - thardeck@suse.com diff --git a/nagios-rpm-macros.spec b/nagios-rpm-macros.spec index af6cdb0..c8b7179 100644 --- a/nagios-rpm-macros.spec +++ b/nagios-rpm-macros.spec @@ -1,7 +1,7 @@ # # spec file for package nagios-rpm-macros # -# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -20,7 +20,7 @@ Name: nagios-rpm-macros Summary: RPM Macros for Nagios based packages License: BSD-3-Clause Group: System/Monitoring -Version: 0.05 +Version: 0.06 Release: 0 Url: http://en.opensuse.org/Nagios Source0: macros.nagios