57 lines
1.2 KiB
Bash
Executable file
57 lines
1.2 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
bin=$(basename "$0")
|
|
|
|
config_file="zosu.conf"
|
|
|
|
usage()
|
|
{
|
|
echo "$bin [options] <operation> [arguments]"
|
|
echo 'Perform operations on a wined osu instance
|
|
|
|
Operations:
|
|
start Start the wined osu
|
|
kill Kill the wine server
|
|
sound Change the sound driver
|
|
|
|
Options:
|
|
-h Display this help
|
|
-c Path to conf file (default zosu.conf)
|
|
'
|
|
}
|
|
|
|
while getopts ":hc:" opt;
|
|
do
|
|
case $opt in
|
|
h) usage ; exit 0 ;;
|
|
c) config_file="$OPTARG" ;;
|
|
*) echo "Unknown option: $OPTARG" >&2 ; usage ; exit 1 ;;
|
|
esac
|
|
done
|
|
|
|
# resolve config file path
|
|
[ "$(echo $config_file | cut -c1)" != "/" ] && config_file="$(pwd)/$config_file"
|
|
|
|
# load config file
|
|
[ -f "$config_file" ] && . "$config_file"
|
|
|
|
# default environment
|
|
[ -z "$OSUDIR" ] && export OSUDIR=osu
|
|
[ -z "$WINEPREFIX" ] && export WINEPREFIX="$(pwd)/.wine"
|
|
export vblank_mode=0
|
|
|
|
|
|
shift $((OPTIND-1))
|
|
|
|
|
|
case $1 in
|
|
start) shift $((OPTIND)) && wine "$OSUDIR/osu\!.exe" "$@" ;;
|
|
kill) wineserver -k ;;
|
|
sound)
|
|
case $2 in
|
|
pulse|stable) winetricks sound=pulse ;;
|
|
alsa|lowlatency) winetricks sound=alsa ;;
|
|
*) echo "$bin sound <pulse/alsa>" >&2 ; exit 1 ;;
|
|
esac ;;
|
|
*) usage ; exit 1 ;;
|
|
esac
|