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="${CRAN2DEB_CACHE:-/var/cache/cran2deb}/results/"
11 pbuildercache="${CRAN2DEB_PBUILDER_CACHE:-/var/cache/pbuilder/}"
15 if [ -z "$root" ]; then
16 echo "You need to specify the root of your installation, i.e. the folder in which to find the exec subdirectory."
21 sys=$(cran2deb which_system)
22 mkdir -p "${cachedir}"/"$sys"
26 cache_rda="${cachedir}/cache.rda"
27 if [ ! $1 = full ] || [ ! -e "${cache_rda}" ]; then
28 delta=$(($update_period+1))
29 echo Forcing cache update
31 seconds_time=$(date +%s)
32 seconds_file=$(stat -c '%Y' "${cache_rda}")
33 delta=$(($seconds_time-$seconds_file))
34 echo Cache is $delta seconds out of date, auto-update after $update_period seconds.
37 if [ ! -e "${cache_rda}" ] || [ $delta -gt $update_period ]; then
38 if [ "${CRAN2DEB_BUILD}" == "yes" ]; then
40 if [ -e "${pbuilder_cache}"/base-cran2deb-$sys.tgz ]; then
43 echo C: sudo pbuilder $mode --override-config --configfile "${CRAN2DEB_CONFDIR:-/etc/cran2deb}"/sys/"$sys"/pbuilderrc
44 echo "Executing sudo pbuilder $mode --override-config --configfile ${CRAN2DEB_CONFDIR:-/etc/cran2deb}/sys/$sys/pbuilderrc"
45 sudo pbuilder $mode --override-config --configfile "${CRAN2DEB_CONFDIR:-/etc/cran2deb}"/sys/"$sys"/pbuilderrc
47 echo "Executing $root/exec/update_cache $root"
48 $root/exec/update_cache $root