diff --git a/bin/box b/bin/box index 09a279a..92d8d78 100755 --- a/bin/box +++ b/bin/box @@ -9,6 +9,12 @@ root="$(cd "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")/.." && pwd)" remote=""; mode="auto"; name=""; from=""; template=""; force=0; json=0; want_help=0 cpu=""; memory=""; disk=""; instance_only=0 inst="" # the resolved Incus instance, set by the 'box' precondition +# Labels snapshot_mark actually CREATED this run, space-separated. Every path +# through snapshot_mark returns 0 on purpose — the never-fatal contract — so +# the exit status cannot tell a mark that was taken from one that was skipped +# (dir pool, knob=0) or refused (incus said no). Anything that offers the +# operator a mark must ask this, not assume the call happened. +marks="" die() { echo "box: $*" >&2; exit 1; } # 1 = it went wrong usage_error() { echo "box: $*" >&2; echo "try 'box help'." >&2; exit 2; } # 2 = you asked wrong @@ -1216,9 +1222,15 @@ snapshot_mark() { echo "box: the box is fine; it just has no $label mark. The mint continues." >&2 return 0 fi + marks="$marks $label" echo "box: roll back to it any time with: box restore $name $label" } +# Did THIS run actually create