Pre(un) and post(un) script changed
This commit is contained in:
@@ -49,34 +49,40 @@ Simply WEB gui for orchestration infrastructure by ansible playbooks.
|
|||||||
# Blocks
|
# Blocks
|
||||||
%files
|
%files
|
||||||
%defattr(-,%{user},%{user},-)
|
%defattr(-,%{user},%{user},-)
|
||||||
/opt/polemarch
|
%dir /opt/polemarch
|
||||||
/etc/%{namebase}
|
%{_sysconfdir}/%{namebase}
|
||||||
/var/log/%{namebase}
|
%{_var}/log/%{namebase}
|
||||||
/var/run/%{namebase}
|
%{_rundir}/%{namebase}
|
||||||
/var/lock/%{namebase}
|
%{_var}/lock/%{namebase}
|
||||||
%attr(755,root,root) /etc/systemd/system/%{shortname}.service
|
%attr(755,root,root) %{_sysconfdir}/systemd/system/%{shortname}.service
|
||||||
%attr(755,root,root) /etc/tmpfiles.d/%{namebase}.conf
|
%attr(755,root,root) %{_sysconfdir}/tmpfiles.d/%{namebase}.conf
|
||||||
%config(noreplace) %{_sysconfdir}/%{namebase}/settings.ini
|
%config(noreplace) %{_sysconfdir}/%{namebase}/settings.ini
|
||||||
|
|
||||||
%pre
|
|
||||||
id -u %{user} || useradd %{user}
|
|
||||||
id -g %{user} || groupadd %{user}
|
|
||||||
|
|
||||||
%install
|
%install
|
||||||
make BUILD_DIR=%{buildroot}
|
make BUILD_DIR=%{buildroot}
|
||||||
install %{S:1} %{buildroot}%{_sysconfdir}/%{namebase}/settings.ini
|
install %{S:1} %{buildroot}%{_sysconfdir}/%{namebase}/settings.ini
|
||||||
bash %{S:2}
|
bash %{S:2}
|
||||||
|
|
||||||
|
%pre
|
||||||
|
getent group %{user} >/dev/null || \
|
||||||
|
groupadd -r %{user}
|
||||||
|
getent passwd %{user} >/dev/null || \
|
||||||
|
useradd -r -g %{user} -d %{user} \
|
||||||
|
-s /sbin/nologin -c "%{user} user" %{user}
|
||||||
|
exit 0
|
||||||
|
|
||||||
%post
|
%post
|
||||||
|
%systemd_post %{name}.service
|
||||||
|
# only migrate, if it is an update
|
||||||
|
if [ $2 -eq 1 ]; then
|
||||||
su - %{user} -c "/opt/%{name}/bin/%{shortname}ctl migrate"
|
su - %{user} -c "/opt/%{name}/bin/%{shortname}ctl migrate"
|
||||||
/usr/bin/systemctl daemon-reload
|
fi
|
||||||
/usr/bin/systemctl enable %{shortname}.service
|
|
||||||
|
|
||||||
%preun
|
%preun
|
||||||
/usr/bin/systemctl disable %{shortname}.service > /dev/null 2>&1
|
%systemd_preun %{name}.service
|
||||||
if [ "$1" = "0" ]; then
|
|
||||||
service %{shortname} stop >/dev/null 2>&1
|
%postun
|
||||||
fi
|
%systemd_postun_with_restart %{name}.service
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n %name-%version
|
%setup -q -n %name-%version
|
||||||
|
|||||||
Reference in New Issue
Block a user