#!/usr/bin/bash
# SPDX-License-Identifier: MIT
set -euo pipefail
. /usr/lib/os-release
boot="$(bootctl --print-boot-path)"
[[ ${boot} == /boot || ${boot} == /efi ]] || exit 1
export IMAGE_ETC_METADATA=.image-etc-factory.json
exec /usr/lib/image-etc-factory cleanup --state=/.system \
    --image-id="${IMAGE_ID:?missing deployment identity}" --boot="${boot}"
