#!/bin/sh
# Generated by synopkgland. Hyper Backup runs this as root. It only switches
# to the package account and moves one archive; it never reads the archive.
T=$(printf '%s' "$SYNOPKG_BKP_INPUT" | /usr/bin/jq -er .temp_path) || exit 1
U=$(/usr/bin/stat -c %u:%g "$SYNOPKG_PKGVAR") || exit 1
case $U in 0:*|*:0) exit 1 ;; esac
if [ "$(/usr/bin/id -u)" = 0 ]; then RUN="/usr/bin/chroot --userspec=$U /"; else RUN=; fi
$RUN /bin/sh -c 'exec "$SYNOPKG_PKGDEST/backup/control" import' < "$T/payload.tar" || exit 1
printf '{"app_data_version":"1.0"}' > "$SYNOPKG_BKP_OUTPUT_PATH"
