]> git.donarmstrong.com Git - cran2deb.git/blob - trunk/exec/repopulate
start allowing for local user cache configuration
[cran2deb.git] / trunk / exec / repopulate
1 #!/bin/sh
2
3 ## DOC: cran2deb repopulate
4 ## DOC:     repopulate the cran2deb database and configurations from a new cran2deb release
5 ## DOC:
6
7 set -e
8
9 dir=/etc/cran2deb
10 if [ -e /etc/cran2deb/config ]; then
11     . /etc/cran2deb/config;
12 elif [ -r ~/.cran2deb/config ]; then
13     dir=~/.cran2deb/
14     . ~/.cran2deb/config;
15 fi;
16
17 if [ ! -d "$dir" ]; then
18        echo "Dir $dir not existing."
19        exit -1
20 fi
21
22 umask 002
23 echo "Setting 'root' var to '$1'."
24 root=$1
25 shift
26 for x in $(find "${dir}" -type f -name '*.in'); do
27     #echo "x=$x"
28     y=$(echo $x | sed -e 's,.in$,,')
29     sed -e "s:@ROOT@:$root:g" <"$x" >"$y"
30 done
31
32 # now do an update to reflect any config changes
33 echo "Starting '$root/exec/update"
34 "$root/exec/update" "$root"
35
36 (for fn in populate_licenses quit; do
37     cat "$root/data/$fn"
38 done) | "$root/exec/license" "$root"
39
40 (for fn in populate_depend_aliases populate_sysreq populate_forcedep quit; do
41     cat "$root/data/$fn"
42 done) | "$root/exec/depend" "$root"
43