set -e
set -o pipefail
+if [ "x$1" != "x--force" ]; then
+ log_error "WARNING: This will cause the system to halt."
+ log_error "Use --force if you know what you're doing."
+ exit 1
+fi
+
# terminate helper vm when the script exits
add_cleanup telinit 0
if [ ! -e "$HELPER_PKG" ]; then
log_error "Helper package \`$HELPER_PKG' not found."
- log_error "You need to provide this for the script to work"
+ log_error "You need to provide this for the script to work."
exit 1
fi
echo "not found"
echo "Debootstraping to create a new root filesystem:"
debootstrap --arch amd64 --include "$HELPER_EXTRA_PKGS" \
- --variant=minbase squeeze "$target" 2>&1 | sed -e 's/^/DEBOOTSTRAP: /g'
+ --variant=minbase stable "$target" 2>&1 | sed -e 's/^/DEBOOTSTRAP: /g'
# remove the downloaded debs, as they are no longer needed
find "$target/var/cache/apt/archives" -type f -name '*.deb' -print0 | \
#
# By default this script does nothing.
-/usr/bin/snf-image-helper
+if ! grep -q snf_image_activate_helper /proc/cmdline; then
+ echo "WARNING: NOT calling snf-image-helper, add snf_image_activate_helper"
+ echo "to the kernel command line if you want to do so."
+else
+ /usr/bin/snf-image-helper --force
+fi
exit 0
EOF