]> git.donarmstrong.com Git - cran2deb.git/blobdiff - trunk/exec/repopulate
use CRAN2DEB_CACHE and CRAN2DEB_CONFDIR env variables
[cran2deb.git] / trunk / exec / repopulate
index 08862dba2da40a7767fccf2cfc76289082e90d08..a376fd92c7f78968269b16e34216691812ab529d 100755 (executable)
@@ -6,9 +6,10 @@
 
 set -e
 
-dir=/etc/cran2deb
+dir=${CRAN2DEB_CONFIDR:-/etc/cran2deb}
+
 if [ ! -d "$dir" ]; then
-       echo "Dir $dir not existing."
+       echo "Dir $dir does not exist."
        exit -1
 fi
 
@@ -16,11 +17,13 @@ umask 002
 echo "Setting 'root' var to '$1'."
 root=$1
 shift
-for x in $(find /etc/cran2deb/ -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"