]> git.donarmstrong.com Git - cran2deb.git/commitdiff
use CRAN2DEB_CACHE and CRAN2DEB_CONFDIR env variables
authorDon Armstrong <don@donarmstrong.com>
Tue, 24 Jan 2012 00:09:43 +0000 (16:09 -0800)
committerDon Armstrong <don@donarmstrong.com>
Tue, 24 Jan 2012 00:09:43 +0000 (16:09 -0800)
trunk/R/zzz.R
trunk/exec/cran2deb
trunk/exec/repopulate

index 050ed0481372028bf7fee2f4977d96460ac8ac24..81aa0bf1cdabe3d6ddca45e18fa5fee60593ab79 100644 (file)
@@ -7,16 +7,17 @@
     global("host_arch", gsub('^[a-z]+-','',which_system))
     global("maintainer", 'cran2deb autobuild <cran2deb@gmail.com>')
     global("root", system.file(package='cran2deb'))
-    global("cache_root", '/var/cache/cran2deb')
-    global("pbuilder_results",  file.path('/var/cache/cran2deb/results',which_system))
-    global("pbuilder_config",   file.path('/etc/cran2deb/sys',which_system,'pbuilderrc'))
-    global("dput_config",       file.path('/etc/cran2deb/sys',which_system,'dput.cf'))
-    global("dinstall_config",   file.path('/etc/cran2deb/sys',which_system,'mini-dinstall.conf'))
-    global("dinstall_archive",  file.path('/etc/cran2deb/archive',which_system))
+    global("cache_root", Sys.getenv('CRAN2DEB_CACHE','/var/cache/cran2deb'))
+    global("config_dir", Sys.getenv('CRAN2DEB_CONFDIR','/etc/cran2deb'))
+    global("pbuilder_results",  file.path(cache_root,which_system))
+    global("pbuilder_config",   file.path(config_dir,'sys',which_system,'pbuilderrc'))
+    global("dput_config",       file.path(config_dir,'sys',which_system,'dput.cf'))
+    global("dinstall_config",   file.path(config_dir,'sys',which_system,'mini-dinstall.conf'))
+    global("dinstall_archive",  file.path(config_dir,'archive',which_system))
     global("r_depend_fields", c('Depends','Imports')) # Suggests, Enhances
     global("scm_revision", paste("svn:", svnversion()))
-    global("patch_dir", '/etc/cran2deb/patches')
-    global("lintian_dir", '/etc/cran2deb/lintian')
+    global("patch_dir", file.path(config_dir,'patches'))
+    global("lintian_dir", file.path(config_dir,'lintian'))
     global("changesfile", function(srcname,version='*') {
         return(file.path(pbuilder_results
                         ,paste(srcname,'_',version,'_'
index 5e5e2406d3e5cf68077652346543ed3fa72a8aaa..4c01d4cb3073628091002d218a643e7d01eda22f 100755 (executable)
@@ -3,11 +3,16 @@ umask 002
 root=$(r -e 'suppressMessages(library(cran2deb));cat(system.file(package="cran2deb"),file=stdout())')
 cmd=$1
 
-if [ -e /etc/cran2deb/config ]; then
+CRAN2DEB_CACHE=/var/cache/cran2deb
+CRAN2DEB_CONFDIR=/etc/cran2deb
+if [ -r /etc/cran2deb/config ]; then
     . /etc/cran2deb/config;
-elif [ -r ~/.cran2deb_config ]; then
-    . ~/.cran2deb_config;
 fi;
+if [ -r ~/.cran2deb/config ]; then
+    CRAN2DEB_CONFDIR=~/.cran2deb
+    . ~/.cran2deb/config;
+fi;
+export CRAN2DEB_CACHE CRAN2DEB_CONFDIR
 
 
 if [ "x" = "x$cmd" ]; then
index 72e23ccbd13135997e277fb945554a701884bd4b..a376fd92c7f78968269b16e34216691812ab529d 100755 (executable)
@@ -6,16 +6,10 @@
 
 set -e
 
-dir=/etc/cran2deb
-if [ -e /etc/cran2deb/config ]; then
-    . /etc/cran2deb/config;
-elif [ -r ~/.cran2deb/config ]; then
-    dir=~/.cran2deb/
-    . ~/.cran2deb/config;
-fi;
+dir=${CRAN2DEB_CONFIDR:-/etc/cran2deb}
 
 if [ ! -d "$dir" ]; then
-       echo "Dir $dir not existing."
+       echo "Dir $dir does not exist."
        exit -1
 fi
 
@@ -23,11 +17,13 @@ umask 002
 echo "Setting 'root' var to '$1'."
 root=$1
 shift
-for x in $(find "${dir}" -type f -name '*.in'); do
+OLDIFS="$IFS"
+IFS="$(echo -ne '\0')"
+for x in $(find "${dir}" -type f -name '*.in' -print0); do
     #echo "x=$x"
-    y=$(echo $x | sed -e 's,.in$,,')
-    sed -e "s:@ROOT@:$root:g" <"$x" >"$y"
+    sed -e "s:@ROOT@:$root:g" <"$x" > "${x%%.in}"
 done
+IFS="$OLDIFS"
 
 # now do an update to reflect any config changes
 echo "Starting '$root/exec/update"