EXTRA_DIST = create.in defaults
-do_subst = sed -e 's,[@]sysconfdir[@],$(sysconfdir),g'
+do_subst = sed \
+ -e 's,[@]sysconfdir[@],$(sysconfdir),g' \
+ -e 's,[@]localstatedir[@],$(localstatedir),g'
create: create.in Makefile
$(do_subst) < $< > $@
+Version 0.5 (unreleased)
+------------------------
+
+Most of the settings of the script have been moved to a configuration
+file. Depending on the ./configure options, the location of this file
+might be /etc/default/ganeti-instance-debootstrap or
+/usr/local/etc/default/ganeti-instance-debootstrap.
+
+The cache generation and cleaning variables can be modified as follows:
+
+- to enable generating the cache, modify the config file and set
+ GENERATE_CACHE to "yes"
+- to disable cleaning the cache, set CLEAN_CACHE to ""; or
+ alternatively, you can customize with this variable the number of days
+ after which to clear the cache
+
+Note that the cache file is no longer stored in the same directory as
+the OS definition files, but (again depending on ./configure options)
+usually under /var/cache/ganeti-instance-debootstrap.
+
Version 0.4
-----------
: ${SUITE:="lenny"}
: ${ARCH:=""}
: ${EXTRA_PKGS:=""}
+: ${GENERATE_CACHE:="yes"}
+: ${CLEAN_CACHE:="14"} # number of days to keep a cache file
+
+CACHE_DIR="@localstatedir@/cache/ganeti-instance-debootstrap"
+
+if [ "$GENERATE_CACHE" = "yes" -a ! -d "$CACHE_DIR" ]; then
+ mkdir -p "$CACHE_DIR"
+fi
DPKG_ARCH=${ARCH:-`dpkg --print-architecture`}
-CACHE_FILE="cache-${SUITE}-${DPKG_ARCH}.tar"
+CACHE_FILE="$CACHE_DIR/cache-${SUITE}-${DPKG_ARCH}.tar"
TEMP=`getopt -o i:b:s: -n '$0' -- "$@"`
# remove the cache file if it's old (> 2 weeks) and writable by the owner (the
# default due to the standard umask)
-if [ -f "$CACHE_FILE" ]; then
- find "$CACHE_FILE" -perm -0200 -daystart -mtime +14 -print0 | \
+if [ "$CLEAN_CACHE" -a -d "$CACHE_DIR" ]; then
+ find "$CACHE_DIR" -name 'cache-*.tar' -type f \
+ -daystart -mtime "+${CLEAN_CACHE}" -print0 | \
xargs -r0 rm -f
fi
# interfaces as eth0, eth1, ...
rm -f "$TMPDIR/etc/udev/rules.d/z25_persistent-net.rules"
- if [ ! -e no_cache ]; then
+ if [ "$GENERATE_CACHE" = "yes" ]; then
TMP_CACHE=`mktemp "${CACHE_FILE}.XXXXXX"`
tar cf "$TMP_CACHE" -C $TMPDIR .
mv -f "$TMP_CACHE" "$CACHE_FILE"
# for etch amd64 (lenny doesn't have xen support in amd64):
# EXTRA_PKGS="linux-image-xen-amd64"
+
+# GENERATE_CACHE: if set to yes (the default), create new cache files;
+# any other value will disable the generation of cache files (but they
+# will still be used if they exist)
+GENERATE_CACHE="yes"
+
+# CLEAN_CACHE: should be set to the number of days after which to
+# clean the cache; the default is 14 (two weeks); to disable cache
+# cleaning, set it to an empty value ("")
+CLEAN_CACHE="14"