eden/tools/cpmutil.sh
crueter c993bc01a4
Some checks are pending
tx-src / sources (push) Waiting to run
Check Strings / check-strings (push) Waiting to run
[cmake] Update CPMUtil (#4123)
Notable changes

- Single cpmfile
- version/min_version/git_version have been fixed and replaced with
  version and min_version
- Docs rewrite
- Legacy options are gone
- Fixed update/version commands
- Added patch creation functionality

Signed-off-by: crueter <crueter@eden-emu.dev>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4123
Reviewed-by: Lizzie <lizzie@eden-emu.dev>
Reviewed-by: MaranBr <maranbr@eden-emu.dev>
2026-06-26 02:22:04 +02:00

68 lines
1.3 KiB
Bash
Executable file

#!/bin/sh -e
# SPDX-FileCopyrightText: Copyright 2026 crueter
# SPDX-License-Identifier: LGPL-3.0-or-later
# shellcheck disable=SC1091
ROOTDIR=$(CDPATH='' cd -- "$(dirname -- "$0")/cpm" && pwd)
SCRIPTS="$ROOTDIR"
. "$SCRIPTS"/common.sh
RETURN=0
die() {
echo "-- $*" >&2
exit 1
}
usage() {
cat <<EOF
Usage: $0 [command]
General command-line utility for CPMUtil operations.
Commands:
package Run operations on a package or packages
format Format cpmfile
update Update CPMUtil and its tooling
migrate Convert submodules to a basic cpmfile
Package commands:
hash Verify the hash of a package, and update it if needed
update Check for updates for a package
fetch Fetch a package and place it in the cache
add Add a new package
rm Remove a package
version Change the version of a package
which Check if a package is defined
download Get the download URL for a package
dir Get the local directory for a package
reset Reset a fetched package to its original state
patch Create an in-tree patch based on local modifications
EOF
exit $RETURN
}
export ROOTDIR
while :; do
case "$1" in
format | update | migrate)
"$SCRIPTS/$1".sh
break
;;
package)
cmd="$1"
shift
"$SCRIPTS/$cmd".sh "$@"
break
;;
*) usage ;;
esac
shift
done