can be run as non-root
authorthierry <thierry@41d37cc5-eb28-0410-a9bf-d37491348ade>
Mon, 12 Apr 2010 12:20:25 +0000 (12:20 +0000)
committerthierry <thierry@41d37cc5-eb28-0410-a9bf-d37491348ade>
Mon, 12 Apr 2010 12:20:25 +0000 (12:20 +0000)
scripts/all-modules.sh

index 22b643d..cc91e50 100755 (executable)
@@ -1,17 +1,24 @@
 #!/bin/bash
 # $Id$
 # this script is a wrapper around the module-tools (version and diff)
-# it is invoked every 30 minutes on onelab build box
+# it is invoked cyclically
 # prior to that, the following directories will have been svn updated :
-# /root/svn-build
-# /root/svn-build-4.2
+# ~/svn-build
+# ~/root/svn-build-4.2
 
 # avoid running several instances of this script
 # when the svn server has problems, this can very well last quite a while
 
 COMMAND=$(basename $0)
-OUTPUT=/build/modules
-LOCK=/var/run/all-modules.pid
+
+# make the command usable as non-root user at Princeton for more efficiency
+if [ "$(id -u)" == "0" ] ; then
+    OUTPUT=/build/modules
+    LOCK=/var/run/all-modules.pid
+else
+    OUTPUT=~/all-modules
+    LOCK=~/all-modules/run.pid
+fi
 
 function do_update() {
     build_dir=$1; shift
@@ -71,12 +78,12 @@ function main () {
     
     echo $$ > $LOCK
 
-    do_update  /root/svn-build-4.3
-    do_diff    /root/svn-build-4.3 4.3
-    do_version /root/svn-build-4.3 4.3 
-    do_update  /root/svn-build
-    do_diff    /root/svn-build     5.0
-    do_version /root/svn-build     5.0 
+    do_update  ~/svn-build-4.3
+    do_diff    ~/svn-build-4.3 4.3
+    do_version ~/svn-build-4.3 4.3 
+    do_update  ~/svn-build
+    do_diff    ~/svn-build     5.0
+    do_version ~/svn-build     5.0 
 
     rm $LOCK