]> git.donarmstrong.com Git - cran2deb.git/blobdiff - trunk/exec/cran2deb
start allowing for local user cache configuration
[cran2deb.git] / trunk / exec / cran2deb
index 7efedc751a484296ff30eb77cc3ed568cebc6635..5e5e2406d3e5cf68077652346543ed3fa72a8aaa 100755 (executable)
@@ -2,9 +2,34 @@
 umask 002
 root=$(r -e 'suppressMessages(library(cran2deb));cat(system.file(package="cran2deb"),file=stdout())')
 cmd=$1
-shift
+
+if [ -e /etc/cran2deb/config ]; then
+    . /etc/cran2deb/config;
+elif [ -r ~/.cran2deb_config ]; then
+    . ~/.cran2deb_config;
+fi;
+
+
+if [ "x" = "x$cmd" ]; then
+    cmd="help"
+fi
+
 if [ ! -x "$root/exec/$cmd" ]; then
     echo unknown command $cmd
     exit 1
 fi
-"$root/exec/$cmd" "$root" $*
+
+shift
+
+# there's no reason not to run cran2deb as a local user
+# precmd=""
+# if [ "$(id -un)" != c2d ]; then
+#      precmd="sudo -u c2d -E"
+# fi
+
+if [ "web" = "$cmd" ]; then 
+       # web uses getopt and would be irritated by the "$root" argument
+       $precmd "$root/exec/$cmd" $*
+else
+       $precmd "$root/exec/$cmd" "$root" $*
+fi