summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorConstantin Nickel2016-11-19 07:39:52 +0100
committerConstantin Nickel2016-11-19 07:54:21 +0100
commitf7eb19b64f5be4bedf0e462723b1bdacbd1b11ff (patch)
tree447262f561501f2510dd1a0d8b3b1ef88c6077ca
downloadaur-f7eb19b64f5be4bedf0e462723b1bdacbd1b11ff.tar.gz
initial commit
-rw-r--r--.SRCINFO28
-rw-r--r--PKGBUILD73
-rw-r--r--dosbox_windowed.conf2
-rw-r--r--fix-dosbox-mounts.patch28
-rw-r--r--fix-permissions.sh15
-rw-r--r--jagged-alliance-gog.desktop7
-rw-r--r--jagged-alliance-gog.install16
-rw-r--r--jagged-alliance-gog.sh71
8 files changed, 240 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 00000000000..2d954d5ae3b
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,28 @@
+pkgbase = jagged-alliance-gog
+ pkgdesc = A turn-based tactics game that takes place on the fictional South Atlantic island of Metavira.
+ pkgver = 2.0.0.2
+ pkgrel = 1
+ url = https://www.gog.com/game/jagged_alliance
+ install = jagged-alliance-gog.install
+ arch = any
+ groups = games
+ license = custom:eula
+ makedepends = innoextract
+ makedepends = icoutils
+ depends = dosbox
+ optdepends = unionfs-fuse: mounting game folder to home for savegames and settings
+ source = setup_jagged_alliance_2.0.0.2.exe::gogdownloader://jagged_alliance/installer_win_en
+ source = jagged-alliance-gog.sh
+ source = jagged-alliance-gog.desktop
+ source = dosbox_windowed.conf
+ source = fix-dosbox-mounts.patch
+ source = fix-permissions.sh
+ sha256sums = c4800b3a93b1a83f77f69824fc9fa2c8e800b6d3657e959b6f1fb6347a688988
+ sha256sums = 0859a50cc4aaa025bbb4211f3b80ea11e997f6da12408c23c9a3f7b1cc9af03c
+ sha256sums = ea3f11dce620e6f1f9c2d6712c9168fe3216e6df5751f01f2ead022e1e746874
+ sha256sums = 50b601b33522677a9bcaf23edc833329067bb87ccda33039c0b95f0d4ddca578
+ sha256sums = f799b02666773c286c96c9bd6583540dc17f78e263ed54efbfbbe8bec7ab7ea7
+ sha256sums = 68233aebc7a7ba578fda0ab0744ecfa9a3d5964c27e81c1d080a9f522cf78a89
+
+pkgname = jagged-alliance-gog
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 00000000000..3d0c9b0a1ab
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,73 @@
+# Maintainer: Constantin Nickel <constantin dot nickel at gmail dot com>
+
+pkgname=jagged-alliance-gog
+pkgver=2.0.0.2
+pkgrel=1
+pkgdesc="A turn-based tactics game that takes place on the fictional South Atlantic island of Metavira."
+url="https://www.gog.com/game/jagged_alliance"
+license=('custom:eula')
+groups=('games')
+arch=('any')
+makedepends=('innoextract' 'icoutils')
+depends=('dosbox')
+optdepends=('unionfs-fuse: mounting game folder to home for savegames and settings')
+install=$pkgname.install
+
+source=("setup_jagged_alliance_$pkgver.exe"::"gogdownloader://jagged_alliance/installer_win_en"
+ "jagged-alliance-gog.sh"
+ "jagged-alliance-gog.desktop"
+ "dosbox_windowed.conf"
+ "fix-dosbox-mounts.patch"
+ "fix-permissions.sh")
+
+sha256sums=('c4800b3a93b1a83f77f69824fc9fa2c8e800b6d3657e959b6f1fb6347a688988'
+ '0859a50cc4aaa025bbb4211f3b80ea11e997f6da12408c23c9a3f7b1cc9af03c'
+ 'ea3f11dce620e6f1f9c2d6712c9168fe3216e6df5751f01f2ead022e1e746874'
+ '50b601b33522677a9bcaf23edc833329067bb87ccda33039c0b95f0d4ddca578'
+ 'f799b02666773c286c96c9bd6583540dc17f78e263ed54efbfbbe8bec7ab7ea7'
+ '68233aebc7a7ba578fda0ab0744ecfa9a3d5964c27e81c1d080a9f522cf78a89')
+
+# You need to download the gog.com installer file to this directory ($PWD),
+# either manually or with lgogdownloader. You can also configure DLAGENTS in
+# makepkg.conf to auto-download.
+#
+# The following is just a fallback to the above to notify the user:
+DLAGENTS+=('gogdownloader::/usr/bin/awk BEGIN{print"Please\ download\ the\ file\ \\""\ substr("%o",1,length("%o")-5)\ "\\"\ manually\\nor\ setup\ a\ gogdownloader://\ DLAGENT\ in\ makepkg.conf!\ Read\ this\ PKGBUILD\ for\ more\ information.";exit\ 1}')
+
+prepare() {
+ # extract installer (convert files to lowercase, as DOS does not care)
+ innoextract -e -L -d "$srcdir" setup_jagged_alliance_$pkgver.exe
+ # convert icon
+ icotool -x app/gfw_high.ico
+ # create launchers
+ for _m in settings; do
+ sed "s|Exec=jagged-alliance|& --$_m|;s|Name=Jagged Alliance|& (${_m^})|" \
+ $pkgname.desktop > jagged-alliance-$_m.desktop
+ done
+ # remove bundled dosbox, windows stuff and gog client files
+ rm -rf app/{dosbox/,*.ico,*.dll,*.zip,__support}
+ # fix mount directory
+ patch -p1 -i "$srcdir"/fix-dosbox-mounts.patch
+}
+
+package() {
+ # data
+ install -d "$pkgdir"/opt/jagged-alliance
+ cp -r app/* "$pkgdir"/opt/jagged-alliance
+ # fix permissions script
+ install -Dm755 fix-permissions.sh "$pkgdir"/opt/jagged-alliance
+ # additional dosbox config
+ install -m644 dosbox_windowed.conf "$pkgdir"/opt/jagged-alliance
+ # doc + licenses
+ install -d "$pkgdir"/usr/share/{doc,licenses}/$pkgname
+ ln -s -t "$pkgdir"/usr/share/doc/$pkgname /opt/jagged-alliance/{manual.pdf,quickrefcard.pdf}
+ install -m644 tmp/{gog_,}eula.txt "$pkgdir"/usr/share/licenses/$pkgname
+ # .desktop files and launchers
+ install -Dm644 $pkgname.desktop "$pkgdir"/usr/share/applications/jagged-alliance.desktop
+ install -Dm755 $pkgname.sh "$pkgdir"/usr/bin/jagged-alliance
+ for _m in settings; do
+ install -m644 jagged-alliance-$_m.desktop "$pkgdir"/usr/share/applications
+ done
+ # icon
+ install -Dm644 gfw_high_6_256x256x32.png "$pkgdir"/usr/share/pixmaps/jagged-alliance.png
+}
diff --git a/dosbox_windowed.conf b/dosbox_windowed.conf
new file mode 100644
index 00000000000..79c944cd3b8
--- /dev/null
+++ b/dosbox_windowed.conf
@@ -0,0 +1,2 @@
+[sdl]
+fullscreen=false \ No newline at end of file
diff --git a/fix-dosbox-mounts.patch b/fix-dosbox-mounts.patch
new file mode 100644
index 00000000000..00328b7faad
--- /dev/null
+++ b/fix-dosbox-mounts.patch
@@ -0,0 +1,28 @@
+diff --git a/app/dosboxja_settings.conf b/app/dosboxja_settings.conf
+--- a/app/dosboxja_settings.conf
++++ b/app/dosboxja_settings.conf
+@@ -8,8 +8,8 @@ ipx=true
+ # Lines in this section will be run at startup.
+
+ @ECHO OFF
+-mount C ".."
+-imgmount d "..\ja1.gog" -t iso -fs iso
++mount C "."
++imgmount d "ja1.gog" -t iso -fs iso
+ c:
+ cls
+ SETSOUND.EXE
+diff --git a/app/dosboxja_single.conf b/app/dosboxja_single.conf
+--- a/app/dosboxja_single.conf
++++ b/app/dosboxja_single.conf
+@@ -8,8 +8,8 @@ ipx=true
+ # Lines in this section will be run at startup.
+
+ @ECHO OFF
+-mount C ".."
+-imgmount d "..\ja1.gog" -t iso -fs iso
++mount C "."
++imgmount d "ja1.gog" -t iso -fs iso
+ c:
+ cls
+ ja.exe
diff --git a/fix-permissions.sh b/fix-permissions.sh
new file mode 100644
index 00000000000..8218c3b94d2
--- /dev/null
+++ b/fix-permissions.sh
@@ -0,0 +1,15 @@
+#!/usr/bin/sh
+
+_group="${1:-games}"
+
+getent group $_group &> /dev/null
+
+if [ $? != 0 ]; then
+ echo "group '$_group' not found";
+ echo "${0##/} [group] default: games"
+ exit 1
+fi
+
+# fix permissions
+chgrp $_group /opt/jagged-alliance/{,sound.cfg,qickstrt.sav}
+chmod g+w /opt/jagged-alliance/{,sound.cfg,qickstrt.sav}
diff --git a/jagged-alliance-gog.desktop b/jagged-alliance-gog.desktop
new file mode 100644
index 00000000000..172cda79818
--- /dev/null
+++ b/jagged-alliance-gog.desktop
@@ -0,0 +1,7 @@
+[Desktop Entry]
+Type=Application
+Name=Jagged Alliance
+Exec=jagged-alliance
+Icon=jagged-alliance
+Categories=Game;
+Terminal=false
diff --git a/jagged-alliance-gog.install b/jagged-alliance-gog.install
new file mode 100644
index 00000000000..11eff20c9fd
--- /dev/null
+++ b/jagged-alliance-gog.install
@@ -0,0 +1,16 @@
+post_install() {
+ echo "In order to save or change settings you have to use the fix-permissions.sh"
+ echo "script or install 'unionfs-fuse' to get the game folder mounted in your home dir."
+ echo ""
+ echo "Fix permissions: The default group is 'games'"
+ echo "/opt/jagged-alliance/fix-permissions.sh [group]"
+ echo ""
+ echo "Unionfs:"
+ echo 'LOWER_DIR=/opt/jagged-alliance'
+ echo 'UPPER_DIR=$HOME/.gog/jagged-alliance/config'
+ echo 'UNION_DIR=$HOME/.gog/jagged-alliance/game'
+}
+
+post_upgrade() {
+ post_install
+}
diff --git a/jagged-alliance-gog.sh b/jagged-alliance-gog.sh
new file mode 100644
index 00000000000..ff7ccff73f2
--- /dev/null
+++ b/jagged-alliance-gog.sh
@@ -0,0 +1,71 @@
+#!/usr/bin/bash
+
+_help() {
+cat <<EOF
+ Usage: $script [options]
+ Options:
+ -h --help Show this message
+ --windowed Windowed mode
+ --settings Change settings
+ Examples:
+
+ $script --windowed
+ $script --settings
+EOF
+ exit 0
+}
+
+pushd() { builtin pushd "$@" > /dev/null; }
+popd() { builtin popd > /dev/null; }
+
+INSTALL_DIR=/opt/jagged-alliance
+HOME_DIR="$HOME"/.gog/jagged-alliance
+
+if which unionfs &> /dev/null; then
+ USE_UNIONFS=1
+fi
+
+script=${0##*/}
+
+TEMP=$(getopt -o h --long help,windowed,settings \
+ -n "$script" -- "$@")
+
+if [ $? != 0 ] ; then exit 1 ; fi
+
+eval set -- "$TEMP"
+
+while true; do
+ case "$1" in
+ -h|--help) _help; shift ;;
+ --windowed) WINDOWED=1; shift ;;
+ --settings) START_SETTINGS=1; WINDOWED=1; shift ;;
+ --) shift; break ;;
+ esac
+done
+
+configs=('-conf' 'dosboxja.conf')
+
+if [ "$WINDOWED" ]; then
+ configs+=('-conf' 'dosbox_windowed.conf')
+fi
+
+if [ "$START_SETTINGS" ]; then
+ configs+=('-conf' 'dosboxja_settings.conf')
+else
+ configs+=('-conf' 'dosboxja_single.conf')
+fi
+
+if [ "$USE_UNIONFS" ]; then
+ LOWER_DIR="$INSTALL_DIR"
+ UPPER_DIR="$HOME_DIR/config"
+ UNION_DIR="$HOME_DIR/game"
+ mkdir -p "$HOME_DIR"/{game,config}
+
+ unionfs -o cow,relaxed_permissions "$UPPER_DIR=RW:$LOWER_DIR=RO" "$UNION_DIR"
+ echo "Launching game within $UNION_DIR"
+ pushd "$UNION_DIR" && dosbox "${configs[@]}"
+ popd && fusermount -u "$UNION_DIR"
+else
+ echo "Launching game within $INSTALL_DIR"
+ cd $INSTALL_DIR && dosbox "${configs[@]}"
+fi