Patcher/run.sh

49 lines
1.1 KiB
Bash
Raw Normal View History

2024-12-08 17:51:31 +01:00
#!/bin/bash
2024-12-11 16:41:49 +01:00
# Parse arguments
ROOT_PATH=""
PATCHES_SOURCE=""
while [[ "$#" -gt 0 ]]; do
case $1 in
--path)
ROOT_PATH="$2"
shift
;;
--patches)
PATCHES_SOURCE="$2"
shift
;;
*)
echo "Unknown parameter: $1"
echo "Usage: $0 --path <path-to-apply> --patches <patches-directory>"
exit 1
;;
esac
shift
done
# Validate arguments
if [[ -z "$ROOT_PATH" ]] || [[ -z "$PATCHES_SOURCE" ]]; then
echo "Both --path and --patches arguments are required."
echo "Usage: $0 --path <path-to-apply> --patches <patches-directory>"
exit 1
fi
# Log paths for debugging
echo "Root path: $ROOT_PATH"
echo "Patches source: $PATCHES_SOURCE"
# Verify the patches directory exists
if [[ ! -d "$PATCHES_SOURCE" ]]; then
echo "Failed to access patches source: $PATCHES_SOURCE does not exist."
exit 1
2024-12-08 17:51:31 +01:00
fi
2024-12-11 16:41:49 +01:00
# Run the Go application with the specified path and patches
go run main.go pref.go standard.go new.go --path "$ROOT_PATH" --patches "$PATCHES_SOURCE"
# Exit with the status of the last command
exit $?
2024-12-08 17:51:31 +01:00