#12 Use standard systemd macros for unit handling
Closed 9 months ago by zbyszek. Opened 2 years ago by zbyszek.

file modified
+10 -36
@@ -256,50 +256,24 @@ 

  fi

  

  %post

- if [ $1 -eq 1 ] ; then

- 	# Initial installation

- 	/bin/systemctl enable nfs-client.target >/dev/null 2>&1 || :

- 	/bin/systemctl start nfs-client.target  >/dev/null 2>&1 || :

- fi

- 

- # Enable nfs-convert so if an old configuration

- # exists a conversion will occur

- /bin/systemctl enable nfs-convert  >/dev/null 2>&1 || :

- 

- %systemd_post nfs-server

- 

- %post -n nfsv4-client-utils

- if [ $1 -eq 1 ] ; then

- 	# Initial installation

- 	/bin/systemctl enable nfs-client.target >/dev/null 2>&1 || :

- 	/bin/systemctl start nfs-client.target  >/dev/null 2>&1 || :

- fi

+ %systemd_post nfs-client.target nfs-convert.service nfs-server.service

  

  %preun

- if [ $1 -eq 0 ]; then

- 	%systemd_preun nfs-client.target

- 	%systemd_preun nfs-server.service

+ %systemd_preun nfs-client.target nfs-convert.service nfs-server.service

  

-     rm -rf /var/lib/nfs/statd

-     rm -rf /var/lib/nfs/v4recovery

- fi

- 

- %preun -n nfsv4-client-utils

  if [ $1 -eq 0 ]; then

- 	%systemd_preun nfs-client.target

+     : >%{_localstatedir}/lib/rpm-state/nfs-server.cleanup

+ fi

  

- 	rm -rf /etc/nfsmount.conf.d

-     rm -rf /var/lib/nfs/v4recovery

+ %posttrans

+ if [ -f %{_localstatedir}/lib/rpm-state/nfs-server.cleanup ]; then

+     rm %{_localstatedir}/lib/rpm-state/nfs-server.cleanup || :

+     rm -rf /var/lib/nfs/statd || :

+     rm -rf /var/lib/nfs/v4recovery || :

  fi

  

  %postun

- %systemd_postun_with_restart  nfs-client.target

- %systemd_postun_with_restart  nfs-server

- 

- %postun -n nfsv4-client-utils

- %systemd_postun_with_restart  nfs-client.target

- 

- /bin/systemctl --system daemon-reload >/dev/null 2>&1 || :

+ %systemd_postun_with_restart nfs-client.target nfs-server.service

  

  %triggerin -- nfs-utils > 1:2.1.1-3

  /bin/systemctl try-restart gssproxy || :

Since all the units are in nfs-utils subpackage, the scriptlets in
nfsv4-client-utils are removed. Since systemd now restart units after
the main rpm transaction is done, the removal of diretories is moved
to %posttrans too.

For #2070726.

Note: please push to both rawhide and f37.

I'll close this one then.

Pull-Request has been closed by zbyszek

9 months ago
Metadata