Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- #
- # Runs Wesnoth using a clean, throwaway config directory.
- #
- # The configuration directory is created on your temporary
- # directory (i.e. /tmp) with a unique name every time, and
- # deleted when finished.
- #
- # Usage:
- # wesnoth-defaults <command line>
- #
- # Examples:
- # wesnoth-defaults ~/src/wesnoth-1.10/wesnoth
- # wesnoth-defaults ~/src/wesnoth-1.10/wesnoth -s server.wesnoth.org
- # wesnoth-defaults ~/src/wesnoth-trunk/wesnoth-debug --campaign Heir_To_The_Throne
- #
- SELF=`basename $0`
- do_error()
- {
- echo "$SELF: $*" 1>&2
- }
- if test x$1 = x; then
- do_error "You must specify a command line to run!"
- exit 1
- fi
- WESNOTH_BIN_PATH=$1
- TEMP_CONFIG_DIR=`mktemp -qd --tmpdir wesnoth-default.XXXXXXXXXX`
- if test x$TEMP_CONFIG_DIR = x; then
- do_error "Could not create temporary dir before launch!"
- exit 2
- fi
- do_cleanup()
- {
- rm -rf $TEMP_CONFIG_DIR || do_error "Could not remove temporary config dir"
- exit $1
- }
- trap do_cleanup INT QUIT HUP TERM EXIT
- shift
- $WESNOTH_BIN_PATH --config-dir $TEMP_CONFIG_DIR $@
Advertisement
Add Comment
Please, Sign In to add comment