diff options
author | Y | 2015-06-09 19:07:37 +0200 |
---|---|---|
committer | Y | 2015-06-09 19:07:37 +0200 |
commit | 440d893b68c91c0d7d49b3781a1d86e6c9371e12 (patch) | |
tree | bd781ce729a410b9159e5e3405e1a2535d54b496 /ysflight.sh | |
download | aur-440d893b68c91c0d7d49b3781a1d86e6c9371e12.tar.gz |
version 20150523
Diffstat (limited to 'ysflight.sh')
-rwxr-xr-x | ysflight.sh | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/ysflight.sh b/ysflight.sh new file mode 100755 index 000000000000..947d4ff24cf4 --- /dev/null +++ b/ysflight.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +# Mirror files to the home directory +if [ ! -d "$HOME/.config/ysflight" ]; then + [ -d "$HOME/.config" ] || mkdir "$HOME/.config" + cp -r "YSFLIGHT_DIR/ysflight/config" "$HOME/.config/ysflight" +fi +if [ -d "$HOME/.cache/ysflight" ] && [ "$0" -nt "$HOME/.cache/ysflight" ]; then + rm -rf "$HOME/.cache/ysflight" +fi +if [ ! -d "$HOME/.cache/ysflight" ]; then + mkdir -p "$HOME/.cache/ysflight" + # lndir without lndir… + find "YSFLIGHT_DIR/ysflight" -mindepth 1 -printf '%y\t%P\n' \ + | while IFS=$'\t' read t n; do case $t in + d) mkdir "$HOME/.cache/ysflight/$n" ;; + *) ln -s "YSFLIGHT_DIR/ysflight/$n" "$HOME/.cache/ysflight/$n" ;; + esac; done + rm -rf "$HOME/.cache/ysflight/config" + ln -s "$HOME/.config/ysflight" "$HOME/.cache/ysflight/config" +fi + +# Launch YsFlight +cd "$HOME/.cache/ysflight/" +arch=$(uname -m | grep -o 64 || echo 32) +conf="$HOME/.config/ysflight/archlinux" + +if [ "${0##*/}" == 'ysflight-server' ]; then + exec ./ysflight${arch}_nownd "$@" +else + # Setup + while [ ! -f "$HOME/.config/ysflight/archlinux" ]; do + version=$(zenity --list --radiolist --print-column=2 --hide-column=2 \ + --title 'Choose your YsFlight binary' \ + --text "The choice is stored in ${conf}; remove this file to get this dialog again." \ + --column="Choice" --column "" --column="Binary" \ + 1 gl1 'OpenGL 1.x' \ + 2 gl2 'OpenGL 2.0' || exit 1) + [ -n "$version" ] && printf 'version="%s"\n' "$version" >"$conf" + done + . "$conf" + # Run + exec ./ysflight${arch}_${version} "$@" +fi |