Skip to content

Commit 9a1516d

Browse files
committed
refactor: Normalize OS and architecture names
1 parent 99a9a68 commit 9a1516d

File tree

1 file changed

+20
-21
lines changed

1 file changed

+20
-21
lines changed

config.sh

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,21 @@ if [ ! -d /tmp/MPLCONFIGDIR ]; then
66
mkdir -p /tmp/MPLCONFIGDIR
77
fi
88
export MPLCONFIGDIR=/tmp/MPLCONFIGDIR
9-
# Detect architecture
10-
case "$(uname -m)" in
11-
arm64|aarch64)
12-
ARCH_TYPE="aarch64"
13-
;;
14-
x86_64)
15-
ARCH_TYPE="x64"
16-
;;
17-
*)
18-
show_error "Unsupported architecture: $(uname -m)"
19-
exit 1
20-
;;
9+
10+
# === Detect OS and architecture ===
11+
OS_TYPE=$(echo "$(uname -s)")
12+
ARCH_TYPE=$(uname -m)
13+
# Normalize OS name
14+
case "${OS_TYPE}" in
15+
Darwin) OS_NAME="macos" ;;
16+
Linux) OS_NAME="linux" ;;
17+
*) OS_NAME=$(echo "$OS_TYPE" | tr '[:upper:]' '[:lower:]') ;;
18+
esac
19+
# Normalize architecture name
20+
case "$ARCH_TYPE" in
21+
x86_64) ARCH_NAME="amd64" ;;
22+
aarch64|arm64) ARCH_NAME="arm64" ;;
23+
*) ARCH_NAME="$ARCH_TYPE" ;;
2124
esac
2225

2326
# Set dir name
@@ -35,16 +38,12 @@ FILE_CURL2_HTTPCODE="${DIR_LOG}/$(basename $0)__FILE_CURL2.http_code"
3538
FILE_FDSNWS_NODES_URLS="stationxml.conf"
3639

3740
# Set software
38-
#STATIONXML_TO_SEED="java -jar ./stationxml-converter-1.0.10.jar -s"
3941
STATIONXML_TO_SEED="java -jar ./stationxml-seed-converter-2.1.0.jar"
40-
case "${ARCH_TYPE}" in
41-
aarch64)
42-
RDSEED="rdseed-aarch64"
43-
;;
44-
x64)
45-
RDSEED="rdseed-amd64"
46-
;;
47-
esac
42+
RDSEED="rdseed-${OS_NAME}-${ARCH_NAME}"
43+
if [ ! -f /usr/bin/${RDSEED} ]; then
44+
echo "Error: rdseed executable not found for OS \"${OS_NAME}\" and ARCH \"${ARCH_NAME}\"."
45+
exit 1
46+
fi
4847

4948
# Set var
5049
N_PROCESS_TO_GET_TYPE=20

0 commit comments

Comments
 (0)