1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-12 03:00:28 +00:00
freebsd-ports/games/linux-x-plane/files/x-plane-wrapper.in
Jean-Yves Lefort a534619279 Update to 8.20
2005-12-07 14:56:36 +00:00

58 lines
1.4 KiB
Bash

#!/bin/sh
xdir="%%XDIR%%"
userdir="$HOME/.x-plane"
portversion="%%PORTVERSION%%"
programs="%%PROGRAMS%%"
targets="athlon-xp i586 pentium-3"
# The executables need to be run from the data directory, and need to
# write files in it. We therefore mirror the data directory hierarchy
# in $userdir, and create symlinks to the data files.
if [ "x`cat $userdir/version 2>/dev/null`" != "x$portversion" ]; then
if [ -e $userdir ]; then
cd $userdir || exit 1
echo "Removing dangling symlinks from $userdir"
find * -type l ! -exec stat -L {} \; -delete >/dev/null 2>&1
echo "Removing obsolete configuration from $userdir"
rm -f Resources/Preferences/*
rm -f $userdir/cpu
echo "Removing empty directories from $userdir"
find -d * -type d -empty -delete
fi
echo "Updating hierarchy in $userdir"
cd $xdir || exit 1
find * -type d -exec mkdir -p "$userdir/{}" \; || exit 1
find * -type f ! -name '*.prf' -exec ln -sf "$xdir/{}" "$userdir/{}" \; || exit 1
for p in $programs; do
for t in $targets; do
if [ -e $p-$t ]; then
rm -f $userdir/$p-$t
cp -p $p-$t $userdir || exit 1
fi
done
done
echo "$portversion" > $userdir/version || exit 1
fi
program=`basename $0`
cd $userdir || exit 1
for t in $targets; do
if [ -e $program-$t ]; then
exec ./$program-$t "$@"
fi
done
echo "$program not found. Check your X-Plane installation." >&2
exit 1