blob: 749ad11197306f6e8e70ec2c3687804a58dab270 (
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
#!/usr/bin/bash
base_name="$(basename "$0")"
path_name=rbdoom3bfg-launcher
conf_dir="${XDG_CONFIG_HOME:-$HOME/.config}"/"$path_name"
data_dir="${XDG_DATA_HOME:-$HOME/.local/share}"/"$path_name"
if [ -f "$(which yad)" ]; then
gui="$(which yad) --splash --class=$base_name --name=$base_name --title=$base_name"
file_select="$gui --file --directory"
fi
if [ -f "$(which zenity)" ]; then
gui="$(which zenity) --class=$base_name --name=$base_name --title=$base_name"
file_select="$gui --file-selection --directory"
fi
if [ ! -f "$(which mergerfs)" ]; then
error_text="mergerfs is not installed."
if [ -z "$gui" ]; then
printf "%s: %s" "$(basename "$0")" "$error_text"
else
$gui --error --text="$error_text"
fi
exit 1
fi
if [ ! -d "$conf_dir" ]; then
mkdir -p "$conf_dir"
fi
conf="$conf_dir"/launcher.conf
old_conf="$HOME"/.rbdoom3bfg/launcher.conf
if [ ! -f "$conf" ] && [ -f "$old_conf" ]; then
mv "$old_conf" "$conf"
fi
if [ -f "$conf" ]; then
source "$conf"
else
echo "install_dir=\"\"" > "$conf"
fi
basepath=""
if [ -z "$install_dir" ]; then
if [ -z "$gui" ]; then
printf "%s: install_dir is not set." "$base_name"
printf "\n\n"
printf "\tThe default install locations will be searched.\n"
printf "\tIf RBDoom3BFG fails to start, specify the Doom 3 BFG\n"
printf "\tinstallation directory in %s.\n\n" "$conf"
else
info_text="install_dir is not set in the configuration file \n$conf\n"
info_text+="Without it, the default locations will be searched for game files.\n"
info_text+="\nDo you want to set it now?\n"
if $gui --question --text="$info_text"; then
install_dir="$($file_select)"
if [ -n "$install_dir" ]; then
echo "install_dir=\"$install_dir\"" >> "$conf"
fi
fi
fi
fi
if [ -n "$install_dir" ]; then
if [ ! -d "$data_dir" ]; then
mkdir -p "$data_dir"
fi
mergerfs -o fsname=RBDoom3BFG /usr/share/games/doom3bfg:"$install_dir" "$data_dir"
basepath="+set fs_basepath $data_dir"
fi
# Disable terminal support too, if the user knows
# what they are doing, they don't need the launcher anyways
RBDoom3BFG +set in_tty 0 $basepath "$@"
if mountpoint -q "$data_dir"; then
umount "$data_dir"
fi
exit 0
|