Created
August 23, 2018 20:50
-
-
Save whoo/c0ee5d97f5071b81d618cf04fb20175e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# script generated by ./play.it 2.11.0~dev - http://wiki.dotslashplay.it/ | |
set -o errexit | |
# Set executable file | |
APP_EXE='lba2.exe' | |
APP_OPTIONS="" | |
LD_LIBRARY_PATH=":/usr/$(portageq envvar LIBDIR_x86)/debiancompat:$LD_LIBRARY_PATH" | |
export LD_LIBRARY_PATH | |
# Set game-specific variables | |
GAME_ID='little-big-adventure-2' | |
PATH_GAME='/usr/local/share/little-big-adventure-2' | |
CONFIG_DIRS='' | |
CONFIG_FILES='./lba2.cfg' | |
DATA_DIRS='' | |
DATA_FILES='' | |
# Set prefix name | |
[ "$PREFIX_ID" ] || PREFIX_ID="$GAME_ID" | |
# Set prefix-specific variables | |
[ "$XDG_CONFIG_HOME" ] || XDG_CONFIG_HOME="$HOME/.config" | |
[ "$XDG_DATA_HOME" ] || XDG_DATA_HOME="$HOME/.local/share" | |
PATH_CONFIG="$XDG_CONFIG_HOME/$PREFIX_ID" | |
PATH_DATA="$XDG_DATA_HOME/games/$PREFIX_ID" | |
PATH_PREFIX="$XDG_DATA_HOME/play.it/prefixes/$PREFIX_ID" | |
# Set ./play.it functions | |
init_prefix_dirs() { | |
( | |
cd "$1" | |
for dir in $2; do | |
if [ ! -e "$dir" ]; then | |
if [ -e "$PATH_PREFIX/$dir" ]; then | |
( | |
cd "$PATH_PREFIX" | |
cp --dereference --parents --recursive "$dir" "$1" | |
) | |
elif [ -e "$PATH_GAME/$dir" ]; then | |
( | |
cd "$PATH_GAME" | |
cp --parents --recursive "$dir" "$1" | |
) | |
else | |
mkdir --parents "$dir" | |
fi | |
fi | |
rm --force --recursive "$PATH_PREFIX/$dir" | |
mkdir --parents "$PATH_PREFIX/${dir%/*}" | |
ln --symbolic "$(readlink --canonicalize-existing "$dir")" "$PATH_PREFIX/$dir" | |
done | |
) | |
} | |
init_prefix_files() { | |
( | |
local file_prefix | |
local file_real | |
cd "$1" | |
find . -type f | while read -r file; do | |
if [ -e "$PATH_PREFIX/$file" ]; then | |
file_prefix="$(readlink -e "$PATH_PREFIX/$file")" | |
else | |
unset file_prefix | |
fi | |
file_real="$(readlink -e "$file")" | |
if [ "$file_real" != "$file_prefix" ]; then | |
if [ "$file_prefix" ]; then | |
rm --force "$PATH_PREFIX/$file" | |
fi | |
mkdir --parents "$PATH_PREFIX/${file%/*}" | |
ln --symbolic "$file_real" "$PATH_PREFIX/$file" | |
fi | |
done | |
) | |
( | |
cd "$PATH_PREFIX" | |
for file in $2; do | |
if [ -e "$file" ] && [ ! -e "$1/$file" ]; then | |
cp --parents "$file" "$1" | |
rm --force "$file" | |
ln --symbolic "$1/$file" "$file" | |
fi | |
done | |
) | |
} | |
init_userdir_files() { | |
( | |
cd "$PATH_GAME" | |
for file in $2; do | |
if [ ! -e "$1/$file" ] && [ -e "$file" ]; then | |
cp --parents "$file" "$1" | |
fi | |
done | |
) | |
} | |
# Build prefix | |
for dir in "$PATH_PREFIX" "$PATH_CONFIG" "$PATH_DATA"; do | |
if [ ! -e "$dir" ]; then | |
mkdir --parents "$dir" | |
fi | |
done | |
( | |
cd "$PATH_GAME" | |
find . -type d | while read dir; do | |
if [ -h "$PATH_PREFIX/$dir" ]; then | |
rm "$PATH_PREFIX/$dir" | |
fi | |
done | |
) | |
cp --recursive --remove-destination --symbolic-link "$PATH_GAME"/* "$PATH_PREFIX" | |
( | |
cd "$PATH_PREFIX" | |
find . -type l | while read link; do | |
if [ ! -e "$link" ]; then | |
rm "$link" | |
fi | |
done | |
find . -depth -type d | while read dir; do | |
if [ ! -e "$PATH_GAME/$dir" ]; then | |
rmdir --ignore-fail-on-non-empty "$dir" | |
fi | |
done | |
) | |
init_userdir_files "$PATH_CONFIG" "$CONFIG_FILES" | |
init_userdir_files "$PATH_DATA" "$DATA_FILES" | |
init_prefix_files "$PATH_CONFIG" "$CONFIG_FILES" | |
init_prefix_files "$PATH_DATA" "$DATA_FILES" | |
init_prefix_dirs "$PATH_CONFIG" "$CONFIG_DIRS" | |
init_prefix_dirs "$PATH_DATA" "$DATA_DIRS" | |
# Run the game | |
cd "$PATH_PREFIX" | |
dosbox -c "mount c . | |
c: | |
imgmount d lba2.dat -t iso -fs iso | |
$APP_EXE $APP_OPTIONS $@ | |
exit" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment