[Pkg-ocaml-maint-commits] [SCM] dh-ocaml packaging branch, master, updated. debian/0.4.1-38-g26e468a

Sylvain Le Gall gildor at debian.org
Fri Jul 17 23:09:15 UTC 2009


The following commit has been merged in the master branch:
commit 26e468aa269e8a5ddf4607e93a7b142a3ff70afd
Author: Sylvain Le Gall <gildor at debian.org>
Date:   Sat Jul 18 01:03:43 2009 +0200

    Don't use sudo and rename all files to -old at once

diff --git a/tools-noinstall/dom-switch-opt b/tools-noinstall/dom-switch-opt
index a16d326..f064a34 100755
--- a/tools-noinstall/dom-switch-opt
+++ b/tools-noinstall/dom-switch-opt
@@ -24,26 +24,34 @@
 
 set -e
 
-for i in \
-  /usr/share/ocaml-findlib/ocaml-native-compilers.conf \
-  /usr/bin/ocamlopt \
-  /usr/bin/camlp4of.opt \
-  /usr/bin/camlp4oof.opt \
-  /usr/bin/camlp4o.opt \
-  /usr/bin/camlp4orf.opt \
-  /usr/bin/camlp4rf.opt \
-  /usr/bin/camlp4r.opt \
-  /usr/bin/ocamlc.opt \
-  /usr/bin/ocamldep.opt \
-  /usr/bin/ocamldoc.opt \
-  /usr/bin/ocamllex.opt \
-  /usr/bin/ocamlopt.opt; do 
-  if [ -f $i ] ; then
+FILES="/usr/share/ocaml-findlib/ocaml-native-compilers.conf \
+       /usr/bin/ocamlopt \
+       /usr/bin/camlp4of.opt \
+       /usr/bin/camlp4oof.opt \
+       /usr/bin/camlp4o.opt \
+       /usr/bin/camlp4orf.opt \
+       /usr/bin/camlp4rf.opt \
+       /usr/bin/camlp4r.opt \
+       /usr/bin/ocamlc.opt \
+       /usr/bin/ocamldep.opt \
+       /usr/bin/ocamldoc.opt \
+       /usr/bin/ocamllex.opt \
+       /usr/bin/ocamlopt.opt"
+
+TO_OLD=true
+for i in $FILES; do
+  if [ -f $i-old ] ; then
+    TO_OLD=false
+  fi
+done
+
+for i in $FILES; do 
+  if $TO_OLD && [ -f $i ] ; then
     echo Rename $i
-    sudo mv $i $i-old
-  elif [ -f $i-old ] ; then
+    mv $i $i-old
+  elif ! $TO_OLD && [ -f $i-old ] ; then
     echo Rename $i-old
-    sudo mv $i-old $i
+    mv $i-old $i
   fi
 done
 

-- 
dh-ocaml packaging



More information about the Pkg-ocaml-maint-commits mailing list