Skip to content

Instantly share code, notes, and snippets.

@mikeshardmind
Last active April 15, 2020 23:05
Show Gist options
  • Save mikeshardmind/418d01bf8b489bf37f1d7516d09c061e to your computer and use it in GitHub Desktop.
Save mikeshardmind/418d01bf8b489bf37f1d7516d09c061e to your computer and use it in GitHub Desktop.
Because Ankama still can't actually properly package for linux. (Ubuntu 18.04 Bionic tested)
#!/bin/bash
# This is a shitty workaround to Ankama not providing everything required in an actual package
# or even a proper dependency list.
# License: Unlicense, see bottom of file
if [ $# -ne 2 ]; then
echo "Usage: $0 path/to/dofus.tar.gz path/to/place/game/folder"
exit 0
fi
if [ ! -d $2 ]; then
echo "Destination does not exist"
echo "you can create it with:"
echo "mkdir -p $2"
exit 0
fi
#fix the fact that occasionally Ankama packs these without making certain files executable
#may remove this section in future versions, it has been nearly a year since the last time they messed this up.
if [ $EUID -ne 0 ]; then
tar -xf $1 -C $2
pushd $2 > /dev/null
find . -print0 | xargs -0 -I '{}' file '{}' | grep "executable" | awk '{print $1}' | sed 's/.$//' | xargs chmod u+x
echo "The script will relaunch and prompt for sudo to continue. it will take a lot of automated actions, so I hope you arent blindly trusting random code and read this. (5 seconds...)" 1>&2
popd > /dev/null
sleep 5
sudo "$0" "$@"
exit $?
fi
#sound dependency, After some testing, this one is no longer needed, removing from next version of script should this stay
# apt install -y libasound2-plugins:i386
#outdated lib needed, but not packaged with (libpng12)
wget -q -O /tmp/libpng12.deb http://mirrors.kernel.org/ubuntu/pool/main/libp/libpng/libpng12-0_1.2.54-1ubuntu1_amd64.deb \
&& dpkg -i /tmp/libpng12.deb \
&& rm /tmp/libpng12.deb
#multiarch? hahaha
if ! dpkg --print-foreign-architectures | grep "i386"; then
dpkg --add-architecture i386
fi
#wine dependency, but launching the game is a shell script :neutral-face:
#also, not just packaging a wine binary to keep from relying on system wine being a specific version...
wget -q -O https://dl.winehq.org/wine-builds/Release.key \
&& apt-key add Release.key
&& apt-add-repository https://dl.winehq.org/wine-builds/ubuntu/
apt update && apt install -y --install-recommends winehq-stable
# Other non-listed dependencies:
# Accurate as of 2.47, fails on 2.48 without gtk2-engines-murrine:i386 or libcanberra-gtk-module:i386
# TODO: test which others are still needed, may still be all.
apt install -y \
libxt6:i386 \
libgtk2.0-0:i386 \
libstdc++6:i386 \
libxml2:i386 \
libxslt1.1:i386 \
libcanberra-gtk-module:i386 \
gtk2-engines-murrine:i386 \
libxaw7
echo "You should be ready to run now."
# This is free and unencumbered software released into the public domain.
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
# binary, for any purpose, commercial or non-commercial, and by any
# means.
# In jurisdictions that recognize copyright laws, the author or authors
# of this software dedicate any and all copyright interest in the
# software to the public domain. We make this dedication for the benefit
# of the public at large and to the detriment of our heirs and
# successors. We intend this dedication to be an overt act of
# relinquishment in perpetuity of all present and future rights to this
# software under copyright law.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
# For more information, please refer to <http://unlicense.org/>
@progressify
Copy link

Thanks for libpng12 trick :)

@jpleyvat
Copy link

Any clue on how to implement something similar in arch?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment