]> git.donarmstrong.com Git - cran2deb.git/blob - branch/multisys/exec/update
make update use mini-dinstall config from system-depenent config (oops!)
[cran2deb.git] / branch / multisys / exec / update
1 #!/usr/bin/rc
2 ## DOC: cran2deb update
3 ## DOC:     update the cran2deb cache and database
4 ## DOC: cran2deb update full
5 ## DOC:     force a full update of the cran2deb cache and database
6 ## DOC:
7
8 umask 002
9 root=$1
10 shift
11 sys=`{cran2deb which_sys}
12 mkdir -p /var/cache/cran2deb/results/$sys || exit 1
13 mini-dinstall --batch -c /etc/cran2deb/sys/$sys/mini-dinstall.conf || exit 1
14 update_period=10800
15 if (~ $1 full || ![ -e /var/cache/cran2deb/cache.rda ] ) {
16     delta=`{awk 'END{print '^$update_period^'+1}' </dev/null}
17     echo Forcing cache update
18 } else {
19     delta=`{awk 'END{print '^`{date +%s}^-^`{stat -c '%Y' /var/cache/cran2deb/cache.rda}^'}' </dev/null}
20     echo Cache is $delta seconds out of date.
21 }
22 if (![ -e /var/cache/cran2deb/cache.rda ] || [ $delta -gt $update_period ]) {
23     mode=create
24     if ([ -e /var/cache/pbuilder/base-cran2deb-$sys.tgz ]) {
25         mode=update
26     }
27     sudo pbuilder $mode --override-config --configfile /etc/cran2deb/pbuilderrc
28     $root/exec/update_cache $root
29 }
30