packages: systemd/systemd.spec - add %post, %preun and %postun

shadzik shadzik at pld-linux.org
Thu Nov 25 15:24:49 CET 2010


Author: shadzik                      Date: Thu Nov 25 14:24:49 2010 GMT
Module: packages                      Tag: HEAD
---- Log message:
- add %post, %preun and %postun

---- Files affected:
packages/systemd:
   systemd.spec (1.13 -> 1.14) 

---- Diffs:

================================================================
Index: packages/systemd/systemd.spec
diff -u packages/systemd/systemd.spec:1.13 packages/systemd/systemd.spec:1.14
--- packages/systemd/systemd.spec:1.13	Thu Nov 25 14:58:43 2010
+++ packages/systemd/systemd.spec	Thu Nov 25 15:24:44 2010
@@ -91,6 +91,33 @@
 %clean
 rm -rf $RPM_BUILD_ROOT
 
+%post
+/bin/systemctl daemon-reexec > /dev/null 2>&1 || :
+if [ $1 -eq 1 ] ; then
+	# Try to read default runlevel from the old inittab if it exists
+	runlevel=$(/bin/awk -F ':' '$3 == "initdefault" && $1 !~ "^#" { print $2 }' /etc/inittab 2> /dev/null)
+	if [ -z "$runlevel" ] ; then
+		target="/lib/systemd/system/runlevel$runlevel.target"
+	else
+		target="/lib/systemd/system/runlevel3.target"
+	fi
+
+	# And symlink what we found to the new-style default.target
+	/bin/ln -sf "$target" /etc/systemd/system/default.target > /dev/null 2>&1 || :
+	#/bin/systemctl enable SERVICES > /dev/null 2>&1 || :
+fi
+
+%preun
+if [ $1 -eq 0 ] ; then
+	#/bin/systemctl disable SERVICES > /dev/null 2>&1 || :
+	/bin/rm -f /etc/systemd/system/default.target > /dev/null 2>&1 || :
+fi
+
+%postun
+if [ $1 -ge 1 ] ; then
+	/bin/systemctl daemon-reload > /dev/null 2>&1 || :
+fi
+
 %files
 %defattr(644,root,root,755)
 %doc DISTRO_PORTING README TODO
@@ -185,6 +212,9 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.14  2010/11/25 14:24:44  shadzik
+- add %post, %preun and %postun
+
 Revision 1.13  2010/11/25 13:58:43  shadzik
 - better file location
 - add symlinks for SysVinit commands
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/systemd/systemd.spec?r1=1.13&r2=1.14&f=u



More information about the pld-cvs-commit mailing list