]> git.donarmstrong.com Git - cran2deb.git/blobdiff - trunk/exec/repopulate
support postgresql in addition to sqlite
[cran2deb.git] / trunk / exec / repopulate
index ab3ea6039fcaf5720569a8f962d808dc48dac14a..7e627ac7aa879c1dfae930f0e06397a61aa46b5f 100755 (executable)
@@ -1,17 +1,32 @@
 #!/bin/sh
+
 ## DOC: cran2deb repopulate
 ## DOC:     repopulate the cran2deb database and configurations from a new cran2deb release
 ## DOC:
 
+set -e
+
+dir=${CRAN2DEB_CONFDIR:-/etc/cran2deb}
+
+if [ ! -d "$dir" ]; then
+       echo "Dir $dir does not exist."
+       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
-    y=$(echo $x | sed -e 's,.in$,,')
-    sed -e "s:@ROOT@:$root:g" <"$x" >"$y"
+OLDIFS="$IFS"
+IFS="$(echo -ne '\0')"
+for x in $(find "${dir}" -type f -name '*.in' -print0); do
+    #echo "x=$x"
+    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"
 "$root/exec/update" "$root"
 
 (for fn in populate_licenses quit; do