#!/usr/bin/env bash # SPDX-License-Identifier: GPL-2.0-or-later # Copyright (C) 2026 Bryan Joshua Pedini # fake dpkg-query (unit tests): the dpkg database dump used for dependency closures # shellcheck source=../fakelib.bash . "${BASH_SOURCE[0]%/*}/../fakelib.bash" fake_log "$@" # FAKE_STATE_APPEND / FAKE_STATE_SED: simulate another process writing the statefile meanwhile st=${SKEPTICAL_UPDATER_STATE_DIR:-}/trusted.tsv if [[ -n ${FAKE_STATE_APPEND:-} ]]; then printf '%s\n' "$FAKE_STATE_APPEND" >>"$st"; fi if [[ -n ${FAKE_STATE_SED:-} ]]; then sed -i "$FAKE_STATE_SED" "$st"; fi case " $* " in *' -W '*) cat "$FAKE_DATA/apt/dpkg-status.tsv" ;; *) echo "fake dpkg-query: unhandled: $*" >&2 exit 99 ;; esac