summarylogtreecommitdiffstats
path: root/mekhq.sh
blob: d8477a92f837ecafe1de2a1c2ccb60f361f805b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env bash

export script_name="${0##*/}"

conf_name=mekhq-0.49.11
if [[ -n "$MEKHQ_CONF_NAME" ]]
then
    conf_name="$MEKHQ_CONF_NAME"
fi

conf="$HOME/.config/${conf_name}"

if [[ -n "$XGD_CONFIG_HOME" ]]
then
    conf="$XDG_CONFIG_HOME/${conf_name}"
fi

if [[ ! -d "$conf" ]]
then
    mkdir -p "$conf"
    rsync -avc /usr/lib/mekhq/ "$conf/"
fi

startup_name="mhq-startup"

case "${script_name}" in
    
    "megamek")
        startup_name="mm-startup"
        ;;
    "megameklab")
        startup_name="mml-startup"
        ;;
esac    

cd "${conf}"

exec env MEGAMEK_CONFPATH="$conf" "${conf}/${startup_name}"