#!/bin/bash

set -e

SCRIPT_PATH=$(dirname $(realpath $0))
TARGET=${SCRIPT_PATH}/sign-deb-package.sh
EOF_MARKER="# Script EOF"

if [ $# -gt 0 ]; then
	TARGET=$1
fi

grep "^${EOF_MARKER}" ${TARGET} >/dev/null 2>&1 || { echo "Error: no EOF marker in ${TARGET}"; exit 1; }
echo "Removing packages from ${TARGET}"

sed -i "/^${EOF_MARKER}/q" ${TARGET}

exit 0
