+%post lib -p /sbin/ldconfig
+%postun lib -p /sbin/ldconfig
+
+
+%post sysv
+#%chkconfig --add vservers-default
+#%chkconfig --add vprocunhide
+# PlanetLab Node Manager takes care of starting and stopping VServers
+%chkconfig --del vservers-default
+%chkconfig --del util-vserver
+# PlanetLab does not require /proc security
+%chkconfig --del vprocunhide
+# vip6-autod handles IPv6 auto-assignments
+%chkconfig --add vip6-autod
+
+
+%preun sysv
+#test "$1" != 0 || %_initrddir/vprocunhide stop &>/dev/null || :
+
+#test "$1" != 0 || %chkconfig --del vprocunhide
+#test "$1" != 0 || %chkconfig --del vservers-default
+#test "$1" != 0 || %chkconfig --del util-vserver
+test "$1" != 0 || %chkconfig --del vip6-autod
+
+
+%postun sysv
+#test "$1" = 0 || %_initrddir/vprocunhide condrestart >/dev/null || :
+
+
+%triggerin build -- fedora-release, centos-release
+function copy()
+{
+ base=$1
+ shift
+
+ for i; do
+ test -r "$i" || continue
+
+ target=%confdir/.distributions/.common/pubkeys/$base-$(basename "$i")
+ cp -a "$i" "$target"
+ done
+}
+copy fedora /usr/share/doc/fedora-release-*/RPM-GPG-*
+copy fedora /etc/pki/rpm-gpg/RPM-GPG-*
+copy centos /usr/share/doc/centos-*/RPM-GPG-KEY-*
+
+
+%post build
+test -d /vservers/.hash || mkdir -m0700 /vservers/.hash
+
+f="%confdefaultdir/apps/vunify/hash"; test -e "$f"/method -o -e "$f"/00 || \
+ ln -s /vservers/.hash "$f"/00
+
+%_sbindir/setattr --barrier /vservers/.hash || :
+
+
+%preun build
+test "$1" != 0 || rm -f %confdir/.distributions/.common/pubkeys/fedora-*
+
+
+## Temporary workaround to remove old v_* files; it will conflict
+## somehow with the -legacy package but can be fixed by reinstalling
+## this package.
+## TODO: remove me in the final .spec file
+%define v_services httpd named portmap sendmail smb sshd xinetd gated
+%triggerun sysv -- util-vserver-sysv < 0.30.198
+for i in %v_services; do
+ %chkconfig --del v_$i || :
+done
+
+
+%post legacy
+# PlanetLab Node Manager takes care of starting and stopping VServers
+#%chkconfig --add rebootmgr
+#%chkconfig --add vservers-legacy
+
+# PlanetLab does not require these legacy services
+#for i in %v_services; do
+# %chkconfig --add v_$i
+#done
+
+
+%preun legacy
+#test "$1" != 0 || %_initrddir/rebootmgr stop &>/dev/null || :
+
+#test "$1" != 0 || for i in %v_services; do
+# %chkconfig --del v_$i
+#done
+
+#test "$1" != 0 || %chkconfig --del rebootmgr
+#test "$1" != 0 || %chkconfig --del vservers-legacy
+
+%postun legacy
+#test "$1" = 0 || %_initrddir/rebootmgr condrestart >/dev/null || :
+
+
+%files -f %name-base.list
+%defattr(-,root,root,-)