aboutsummaryrefslogtreecommitdiff
path: root/tools/cpmutil.sh
diff options
context:
space:
mode:
authorcrueter <crueter@eden-emu.dev>2025-12-31 17:16:46 +0100
committercrueter <crueter@eden-emu.dev>2025-12-31 17:16:46 +0100
commit966fcc0c30d8ade96ebc795745d5b5af6111f83e (patch)
tree7c1ef75fcffdd39864f09c359a88896aac38997c /tools/cpmutil.sh
parent80327312dd981c8ec94588402dfe6ae410d679a5 (diff)
[cmake, docs, tools] update CPMUtil (#3183)
Rewrote the entire tooling scheme. That's about it, just make sure tooling works as expected everywhere. Signed-off-by: crueter <crueter@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3183 Reviewed-by: MaranBr <maranbr@eden-emu.dev> Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Reviewed-by: Lizzie <lizzie@eden-emu.dev>
Diffstat (limited to 'tools/cpmutil.sh')
-rwxr-xr-xtools/cpmutil.sh78
1 files changed, 78 insertions, 0 deletions
diff --git a/tools/cpmutil.sh b/tools/cpmutil.sh
new file mode 100755
index 0000000000..52afba2623
--- /dev/null
+++ b/tools/cpmutil.sh
@@ -0,0 +1,78 @@
+#!/bin/sh -e
+
+# SPDX-FileCopyrightText: Copyright 2025 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 all cpmfiles
+ update Update CPMUtil and its tooling
+ ls List all cpmfiles
+ 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 Find which cpmfile a package is defined in
+ download Get the download URL for a package
+
+EOF
+
+ exit $RETURN
+}
+
+export ROOTDIR
+
+while :; do
+ case "$1" in
+ -h | --help) usage ;;
+ ls)
+ echo "$CPMFILES" | tr ' ' '\n'
+ break
+ ;;
+ format)
+ "$SCRIPTS"/format.sh
+ break
+ ;;
+ update)
+ "$SCRIPTS"/update.sh
+ break
+ ;;
+ migrate)
+ "$SCRIPTS"/migrate.sh
+ break
+ ;;
+ package)
+ shift
+ "$SCRIPTS"/package.sh "$@"
+ break
+ ;;
+ *) usage ;;
+ esac
+
+ shift
+done