From 8489f047aebac5802e7708349d1094226b549800 Mon Sep 17 00:00:00 2001 From: Mark Huang Date: Tue, 18 Jul 2006 19:10:36 +0000 Subject: [PATCH] - myplc-devel: Make sure /cvs is never upgraded once installed by giving it a unique name (/data/cvs.%{version}-%{release}). If installing, make a hard-linked copy of /data/cvs.%{version}-%{release} to /data/cvs. --- myplc.spec | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/myplc.spec b/myplc.spec index 7a94a72..f8ffe98 100644 --- a/myplc.spec +++ b/myplc.spec @@ -82,6 +82,10 @@ install -D -m 644 devel/root.img $RPM_BUILD_ROOT/plc/devel/root.img # Install data directory find devel/data | cpio -p -d -u $RPM_BUILD_ROOT/plc/ +# Make sure /cvs is never upgraded once installed by giving it a +# unique name. A hard-linked copy is made in %post. +mv $RPM_BUILD_ROOT/plc/devel/data/{cvs,cvs.%{version}-%{release}} + popd %clean @@ -112,6 +116,9 @@ fi # upgrading from one of these old versions of myplc, we must back up # the database and /etc/planetlab and restore them after the old # version has been uninstalled in %triggerpostun. +# +# This code can be removed once all myplc-0.4-1 installations have +# been upgraded to at least myplc-0.4-2. # 0 = install, 1 = upgrade if [ $1 -gt 0 ] ; then @@ -167,30 +174,17 @@ if [ -x %{_sysconfdir}/init.d/plc-devel ] ; then %{_sysconfdir}/init.d/plc-devel stop fi -# 0 = install, 1 = upgrade -if [ $1 -gt 0 ] ; then - # Never overwrite /cvs - if [ -d /plc/devel/data/cvs ] ; then - echo "Preserving /plc/devel/data/cvs" - mv /plc/devel/data/cvs /plc/devel/data/cvs.rpmsave - fi -fi - %post devel if [ -x /sbin/chkconfig ] ; then /sbin/chkconfig --add plc-devel /sbin/chkconfig plc-devel on fi -%triggerpostun -- %{name} -# 0 = erase, 1 = upgrade -if [ $1 -gt 0 ] ; then - if [ -d /plc/devel/data/cvs.rpmsave ] ; then - echo "Restoring /plc/devel/data/cvs" - mv /plc/devel/data/cvs /plc/devel/data/cvs.%{version}-%{release} - mv /plc/devel/data/cvs.rpmsave /plc/devel/data/cvs - fi -fi +# If /cvs does not already exist, make a hard-linked copy of this +# version's /cvs repository. +if [ ! -d /plc/devel/data/cvs ] ; then + cp -rl /plc/devel/data/{cvs.%{version}-%{release},cvs} +fi %preun devel # 0 = erase, 1 = upgrade -- 2.43.0