3 ## DOC: cran2deb update
4 ## DOC: update the cran2deb cache and database
5 ## DOC: cran2deb update full
6 ## DOC: force a full update of the cran2deb cache and database
10 cachedir="/var/cache/cran2deb/results/"
11 pbuildercache="/var/cache/pbuilder/"
13 if [ -e /etc/cran2deb/config ]; then
14 . /etc/cran2deb/config;
15 elif [ -r ~/.cran2deb_config ]; then
21 if [ -z "$root" ]; then
22 echo "You need to specify the root of your installation, i.e. the folder in which to find the exec subdirectory."
27 sys=$(cran2deb which_system)
28 mkdir -p $(cachedir)/$sys
32 cache_rda="${cachedir}/cache.rda"
33 if [ ! $1 = full ] || [ ! -e "${cache_rda}" ]; then
34 delta=$(($update_period+1))
35 echo Forcing cache update
37 seconds_time=$(date +%s)
38 seconds_file=$(stat -c '%Y' "${cache_rda}")
39 delta=$(($seconds_time-$seconds_file))
40 echo Cache is $delta seconds out of date, auto-update after $update_period seconds.
43 if [ ! -e "${cache_rda}" ] || [ $delta -gt $update_period ]; then
45 if [ -e "${pbuilder_cache}"/base-cran2deb-$sys.tgz ]; then
48 echo C: sudo pbuilder $mode --override-config --configfile /etc/cran2deb/sys/$sys/pbuilderrc
49 echo "Executing sudo pbuilder $mode --override-config --configfile /etc/cran2deb/sys/$sys/pbuilderrc"
50 sudo pbuilder $mode --override-config --configfile /etc/cran2deb/sys/$sys/pbuilderrc
51 echo "Executing $root/exec/update_cache $root"
52 $root/exec/update_cache $root