]> git.donarmstrong.com Git - cran2deb.git/blob - trunk/exec/cran2deb
start allowing for local user cache configuration
[cran2deb.git] / trunk / exec / cran2deb
1 #!/bin/sh
2 umask 002
3 root=$(r -e 'suppressMessages(library(cran2deb));cat(system.file(package="cran2deb"),file=stdout())')
4 cmd=$1
5
6 if [ -e /etc/cran2deb/config ]; then
7     . /etc/cran2deb/config;
8 elif [ -r ~/.cran2deb_config ]; then
9     . ~/.cran2deb_config;
10 fi;
11
12
13 if [ "x" = "x$cmd" ]; then
14     cmd="help"
15 fi
16
17 if [ ! -x "$root/exec/$cmd" ]; then
18     echo unknown command $cmd
19     exit 1
20 fi
21
22 shift
23
24 # there's no reason not to run cran2deb as a local user
25 # precmd=""
26 # if [ "$(id -un)" != c2d ]; then
27 #       precmd="sudo -u c2d -E"
28 # fi
29
30 if [ "web" = "$cmd" ]; then 
31         # web uses getopt and would be irritated by the "$root" argument
32         $precmd "$root/exec/$cmd" $*
33 else
34         $precmd "$root/exec/$cmd" "$root" $*
35 fi