Files
eden/tools/cpm/package/rm.sh
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

31 lines
523 B
Bash
Raw Normal View History

2025-12-31 17:16:46 +01:00
#!/bin/sh -e
# SPDX-FileCopyrightText: Copyright 2026 crueter
2025-12-31 17:16:46 +01:00
# SPDX-License-Identifier: LGPL-3.0-or-later
RETURN=0
usage() {
cat <<EOF
Usage: cpmutil.sh package rm [PACKAGE]...
Delete a package or packages' cpmfile definition(s).
EOF
exit $RETURN
}
[ $# -ge 1 ] || usage
2025-12-31 17:16:46 +01:00
for pkg in "$@"; do
JSON=$("$SCRIPTS"/which.sh "$pkg") || {
echo "!! No cpmfile definition for $pkg"
continue
}
jq --indent 4 "del(.\"$pkg\")" "$JSON" >"$JSON".tmp
mv "$JSON".tmp "$JSON"
echo "-- Removed $pkg from $JSON" || :
done