summarylogtreecommitdiffstats
path: root/launch_gog-cuphead.bash
diff options
context:
space:
mode:
authorClaudia2017-10-08 21:26:29 +0200
committerClaudia Pellegrino2017-10-08 21:27:44 +0200
commitd6e20c0185835219e910bf60e7d0e57300544514 (patch)
tree1a050bd12c94157ff475a63021b0d47a35fe3d30 /launch_gog-cuphead.bash
downloadaur-gog-cuphead.tar.gz
Initial commit
Diffstat (limited to 'launch_gog-cuphead.bash')
-rwxr-xr-xlaunch_gog-cuphead.bash74
1 files changed, 74 insertions, 0 deletions
diff --git a/launch_gog-cuphead.bash b/launch_gog-cuphead.bash
new file mode 100755
index 00000000000..037f9ec2ea0
--- /dev/null
+++ b/launch_gog-cuphead.bash
@@ -0,0 +1,74 @@
+#!/usr/bin/env bash
+set -eu
+
+PKGNAME='gog-cuphead'
+APPNAME_UPSTREAM='Cuphead'
+EXE="C:/GOG Games/${APPNAME_UPSTREAM}/Cuphead.exe"
+
+echo >&2 "Initializing"
+
+export WINEARCH='win64'
+export WINEPREFIX=~/".local/share/${PKGNAME}/wine"
+
+APPDIR_SOURCE="/opt/${PKGNAME}/app"
+APPDIR_PARENT="${WINEPREFIX}/drive_c/GOG Games"
+
+USER_APPDATADIR_SOURCE=~/".config/${PKGNAME}/userappdata"
+USER_APPDATADIR_TARGET="${WINEPREFIX}/drive_c/users/$(whoami)`
+ `/Application Data"
+USER_LOGDIR=~/".local/share/${PKGNAME}/log"
+
+USER_LOGFILE_STDOUT="${USER_LOGDIR}/${PKGNAME}_out.log"
+USER_LOGFILE_STDERR="${USER_LOGDIR}/${PKGNAME}_err.log"
+
+mkdir -p "${USER_LOGDIR}"
+: > "${USER_LOGFILE_STDOUT}"
+: > "${USER_LOGFILE_STDERR}"
+
+echo >&2 "Logging stdout to: ${USER_LOGFILE_STDOUT}"
+echo >&2 "Logging stderr to: ${USER_LOGFILE_STDERR}"
+echo >&2 "Checking for Wine prefix"
+
+if ! [ -d "${WINEPREFIX}" ]; then
+ echo >&2 "==> Bootstrapping Wine prefix"
+ (
+ mkdir -pv "${WINEPREFIX}"
+ wineboot -i
+ rm -fv "${WINEPREFIX}/dosdevices/z:"
+ ) >> "${USER_LOGFILE_STDOUT}" 2>> "${USER_LOGFILE_STDERR}"
+ echo >&2 "==> Done"
+fi
+
+mkdir -p "${USER_APPDATADIR_SOURCE}/${APPNAME_UPSTREAM}"
+
+echo >&2 "Checking user data directory"
+
+if ! [ -h "${USER_APPDATADIR_TARGET}/${APPNAME_UPSTREAM}" ]; then
+ echo >&2 "==> Creating symlink to user data directory"
+ (
+ mkdir -pv "${USER_APPDATADIR_TARGET}"
+ cd "${USER_APPDATADIR_TARGET}"
+ ln -fnsv ../../../../../../../..`
+ `/".config/${PKGNAME}/userappdata/${APPNAME_UPSTREAM}"
+ ) >> "${USER_LOGFILE_STDOUT}" 2>> "${USER_LOGFILE_STDERR}"
+ echo >&2 "==> Done"
+fi
+
+echo >&2 "Checking app directory"
+
+if ! [ -d "${APPDIR_PARENT}/${APPNAME_UPSTREAM}" ]; then
+ echo >&2 "==> Creating symlink to app directory"
+ (
+ mkdir -pv "${APPDIR_PARENT}"
+ ln -fnsv "${APPDIR_SOURCE}" \
+ "${APPDIR_PARENT}/${APPNAME_UPSTREAM}"
+ ) >> "${USER_LOGFILE_STDOUT}" 2>> "${USER_LOGFILE_STDERR}"
+ echo >&2 "==> Done"
+fi
+
+echo >&2 "Launching ${APPNAME_UPSTREAM} via Wine"
+
+wine "${EXE}" \
+ >> "${USER_LOGFILE_STDOUT}" 2>> "${USER_LOGFILE_STDERR}"
+
+echo >&2 "==> Finished"