Commit ff7783b8 authored by Vangelis Koukis's avatar Vangelis Koukis
Browse files

Avoid activating snf-image-helper by mistake

Only activate the snf-image-helper automatically if the caller
has passed a magic argument in the kernel command line.

Require a '--force' argument to activate snf-image-helper,
to avoid accidental execution of the script.
parent 4278b4fa
......@@ -34,6 +34,12 @@
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
# terminate helper vm when the script exits
add_cleanup telinit 0
......@@ -7,7 +7,7 @@ set -o pipefail
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
......@@ -66,7 +66,7 @@ else
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 | \
......@@ -131,7 +131,12 @@ cat > "$target/etc/rc.local" <<EOF
# By default this script does nothing.
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."
/usr/bin/snf-image-helper --force
exit 0
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment