-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-koboldcomforts.sh
More file actions
executable file
·42 lines (31 loc) · 941 Bytes
/
build-koboldcomforts.sh
File metadata and controls
executable file
·42 lines (31 loc) · 941 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
MOD_NAME="koboldcomforts"
MOD_DIR="${ROOT_DIR}/${MOD_NAME}"
if [ ! -d "$MOD_DIR" ]; then
echo "Error: mod directory '$MOD_DIR' not found." >&2
exit 1
fi
cd "$MOD_DIR"
if [ ! -f "modinfo.json" ]; then
echo "Error: modinfo.json not found in '$MOD_DIR'." >&2
exit 1
fi
if [ ! -d "assets" ]; then
echo "Error: assets directory not found in '$MOD_DIR'." >&2
exit 1
fi
if ! command -v jq >/dev/null 2>&1; then
echo "Error: 'jq' is required but not installed. For example: sudo apt install jq" >&2
exit 1
fi
VERSION="$(jq -r '.version // empty' modinfo.json)"
if [ -z "$VERSION" ]; then
echo "Error: could not read 'version' from modinfo.json." >&2
exit 1
fi
OUTPUT_ZIP="${ROOT_DIR}/${MOD_NAME}_${VERSION}.zip"
rm -f "$OUTPUT_ZIP"
zip -r "$OUTPUT_ZIP" assets modicon.png modinfo.json >/dev/null
echo "Created $OUTPUT_ZIP"