From a7b52be51a7e60b749a5d376a819d2979535e60e Mon Sep 17 00:00:00 2001
From: Fedja Beader <fedja@protonmail.ch>
Date: Tue, 18 Mar 2025 03:57:26 +0100
Subject: Deduplicate further + touch up the script a tad

---
 .gitlab-ci.yml         |  4 ++--
 .tools/manaplus.sh     | 11 +++++++----
 .tools/old_manaplus.sh | 11 +++++++----
 3 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 605db3ea..bf55218b 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -27,7 +27,7 @@ manaplus:
   stage: test
   image: debian:unstable
   script:
-  - ./.tools/manaplus.sh
+  - ./.tools/manaplus.sh manaplus master
   artifacts:
     paths:
     - shared
@@ -38,7 +38,7 @@ old_manaplus:
   stage: test
   image: debian:buster
   script:
-  - ./.tools/old_manaplus.sh
+  - ./.tools/old_manaplus.sh packetver24 s20180215
   artifacts:
     paths:
     - shared
diff --git a/.tools/manaplus.sh b/.tools/manaplus.sh
index ed9c29a9..d24c7f99 100755
--- a/.tools/manaplus.sh
+++ b/.tools/manaplus.sh
@@ -1,5 +1,8 @@
 #!/bin/bash
 
+spm_branch="$1"
+client_branch="$2"
+
 source ./.tools/init.sh
 
 clientdata_init
@@ -14,11 +17,11 @@ aptget_install \
 pwd
 ls
 
-./clientdata/.tools/downloadlib.sh manaplus manaplus master || exit 1
+./clientdata/.tools/downloadlib.sh "$spm_branch" manaplus "$client_branch" || exit 1
 
-export HOME=`pwd`/clientdata/shared
+export HOME="$PWD/clientdata/shared"
 
-cd manaplus_master || exit 1
+pushd "manaplus_$client_branch" || exit 1
 export SDL_VIDEODRIVER=dummy
 ./bin/manaplus --version || exit 1
 ./bin/manaplus --validate -u -d ../clientdata || exit 1
@@ -31,4 +34,4 @@ if [ "$?" == 0 ]; then
     exit 1
 fi
 
-cd ..
+popd
diff --git a/.tools/old_manaplus.sh b/.tools/old_manaplus.sh
index d8446179..ddbcad05 100755
--- a/.tools/old_manaplus.sh
+++ b/.tools/old_manaplus.sh
@@ -1,5 +1,8 @@
 #!/bin/bash
 
+spm_branch="$1"
+client_branch="$2"
+
 source ./.tools/init.sh
 
 clientdata_init
@@ -14,11 +17,11 @@ aptget_install \
 pwd
 ls
 
-./clientdata/.tools/downloadlib.sh packetver24 manaplus s20180215 || exit 1
+./clientdata/.tools/downloadlib.sh "$spm_branch" manaplus "$client_branch" || exit 1
 
-export HOME=`pwd`/clientdata/shared
+export HOME="$PWD/clientdata/shared"
 
-cd manaplus_s20180215 || exit 1
+pushd "manaplus_$client_branch" || exit 1
 export SDL_VIDEODRIVER=dummy
 ./bin/manaplus --version || exit 1
 ./bin/manaplus --validate -u -d ../clientdata || exit 1
@@ -31,4 +34,4 @@ if [ "$?" == 0 ]; then
     exit 1
 fi
 
-cd ..
+popd.
-- 
cgit v1.2.3-70-g09d2