mirror of
				https://github.com/ClusterCockpit/cc-metric-collector.git
				synced 2025-11-04 02:35:07 +01:00 
			
		
		
		
	Add user creation in RPM
This commit is contained in:
		@@ -7,6 +7,7 @@ License:        MIT
 | 
			
		||||
Source0:        %{name}-%{version}.tar.gz
 | 
			
		||||
 | 
			
		||||
BuildRequires:  go-toolset
 | 
			
		||||
BuildRequires:  systemd-rpm-macros
 | 
			
		||||
# for internal LIKWID installation
 | 
			
		||||
BuildRequires:  wget perl-Data-Dumper
 | 
			
		||||
 | 
			
		||||
@@ -34,17 +35,14 @@ install -Dpm 0600 receivers.json %{buildroot}%{_sysconfdir}/%{name}/receivers.js
 | 
			
		||||
install -Dpm 0600 router.json %{buildroot}%{_sysconfdir}/%{name}/router.json
 | 
			
		||||
install -Dpm 0644 scripts/%{name}.service %{buildroot}%{_unitdir}/%{name}.service
 | 
			
		||||
install -Dpm 0600 scripts/%{name}.config %{buildroot}%{_sysconfdir}/default/%{name}
 | 
			
		||||
install -Dpm 0644 scripts/%{name}.sysusers %{buildroot}%{_sysusersdir}/%{name}.conf
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
%check
 | 
			
		||||
# go test should be here... :)
 | 
			
		||||
 | 
			
		||||
%pre
 | 
			
		||||
getent group clustercockpit >/dev/null || groupadd -r clustercockpit
 | 
			
		||||
getent passwd clustercockpit >/dev/null || \
 | 
			
		||||
    useradd -r -g clustercockpit -d /nonexistent -s /sbin/nologin \
 | 
			
		||||
    -c "Create system user and group for CC metric collector" clustercockpit
 | 
			
		||||
exit 0
 | 
			
		||||
%sysusers_create_compat scripts/%{name}.sysusers
 | 
			
		||||
 | 
			
		||||
%post
 | 
			
		||||
%systemd_post %{name}.service
 | 
			
		||||
@@ -52,13 +50,6 @@ exit 0
 | 
			
		||||
%preun
 | 
			
		||||
%systemd_preun %{name}.service
 | 
			
		||||
 | 
			
		||||
%postun
 | 
			
		||||
if [ "$1" = "1" ]; then
 | 
			
		||||
getent passwd clustercockpit >/dev/null && userdel clustercockpit
 | 
			
		||||
getent group clustercockpit >/dev/null && groupdel clustercockpit
 | 
			
		||||
fi
 | 
			
		||||
exit 0
 | 
			
		||||
 | 
			
		||||
%files
 | 
			
		||||
%dir %{_sysconfdir}/%{name}
 | 
			
		||||
%{_sbindir}/%{name}
 | 
			
		||||
@@ -69,8 +60,11 @@ exit 0
 | 
			
		||||
%attr(0600,root,root) %config(noreplace) %{_sysconfdir}/%{name}/sinks.json
 | 
			
		||||
%attr(0600,root,root) %config(noreplace) %{_sysconfdir}/%{name}/receivers.json
 | 
			
		||||
%attr(0600,root,root) %config(noreplace) %{_sysconfdir}/%{name}/router.json
 | 
			
		||||
%{_sysusersdir}/%{name}.conf
 | 
			
		||||
 | 
			
		||||
%changelog
 | 
			
		||||
* Thu Mar 03 2022 Thomas Gruber - 0.3
 | 
			
		||||
- Add clustercockpit user installation
 | 
			
		||||
* Mon Feb 14 2022 Thomas Gruber - 0.2
 | 
			
		||||
- Add component specific configuration files
 | 
			
		||||
- Add %attr to config files
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user