]> git.donarmstrong.com Git - cran2deb.git/blob - pkg/trunk/exec/update
misc fixes: update database fully rather than just licenses, initialise a variable...
[cran2deb.git] / pkg / trunk / exec / update
1 #!/usr/bin/rc
2 umask 022
3 root=$1
4 shift
5 for (x in `{find $root/etc -type f -name '*.in'}) {
6     y=`{echo $x | sed -e 's,.in$,,'}
7     sed -e 's:@ROOT@:'^$root^':g' <$x >$y
8 }
9 mkdir -p /var/cache/cran2deb/results || exit 1
10 if ([ ! -e $root/var/archive ]) {
11     # I symbolically link this into /var/www/
12     mkdir $root/var/archive || exit 1
13 }
14 mini-dinstall --batch -c $root/etc/mini-dinstall.conf || exit 1
15 delta=`{hoc -e `{date +%s}^-^`{stat -c '%Y' /var/cache/cran2deb/cache.rda}}
16 update_period=10800
17 echo Cache is $delta seconds out of date.
18 if (~ $1 full) {
19     delta=`{hoc -e $update_period^'+1'}
20 }
21 if (![ -e /var/cache/cran2deb/cache.rda ] || [ $delta -gt $update_period ]) {
22     mode=create
23     if ([ -e /var/cache/pbuilder/base-cran2deb.tgz ]) {
24         mode=update
25     }
26     sudo pbuilder $mode --override-config --configfile $root/etc/pbuilderrc
27     $root/exec/update_cache $root
28 }
29 if (![ -e /var/cache/cran2deb/cran2deb.db ] || [ $delta -gt $update_period ]) {
30     cat $root/data/^(populate_licenses quit) | $root/exec/license $root
31     cat $root/data/^(populate_depend_aliases populate_sysreq populate_forcedep quit) | $root/exec/depend $root
32 }
33