]> git.donarmstrong.com Git - cran2deb.git/blobdiff - trunk/exec/repopulate
start allowing for local user cache configuration
[cran2deb.git] / trunk / exec / repopulate
index ab3ea6039fcaf5720569a8f962d808dc48dac14a..72e23ccbd13135997e277fb945554a701884bd4b 100755 (executable)
@@ -1,17 +1,36 @@
 #!/bin/sh
+
 ## DOC: cran2deb repopulate
 ## DOC:     repopulate the cran2deb database and configurations from a new cran2deb release
 ## DOC:
 
+set -e
+
+dir=/etc/cran2deb
+if [ -e /etc/cran2deb/config ]; then
+    . /etc/cran2deb/config;
+elif [ -r ~/.cran2deb/config ]; then
+    dir=~/.cran2deb/
+    . ~/.cran2deb/config;
+fi;
+
+if [ ! -d "$dir" ]; then
+       echo "Dir $dir not existing."
+       exit -1
+fi
+
 umask 002
+echo "Setting 'root' var to '$1'."
 root=$1
 shift
-for x in $(find /etc/cran2deb/ -type f -name '*.in'); do
+for x in $(find "${dir}" -type f -name '*.in'); do
+    #echo "x=$x"
     y=$(echo $x | sed -e 's,.in$,,')
     sed -e "s:@ROOT@:$root:g" <"$x" >"$y"
 done
 
 # now do an update to reflect any config changes
+echo "Starting '$root/exec/update"
 "$root/exec/update" "$root"
 
 (for fn in populate_licenses quit; do