forked from rockerbacon/modorganizer2-linux-installer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·86 lines (63 loc) · 1.92 KB
/
install.sh
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
79
80
81
82
83
84
85
#!/usr/bin/env bash
cache_enabled="${CACHE:-1}"
set -eu
set -o pipefail
script_root=$(realpath "$(dirname "${BASH_SOURCE[0]}")")
utils="$script_root/utils"
dialog="$utils/dialog.sh"
gamesinfo="$script_root/gamesinfo"
handlers="$script_root/handlers"
launchers="$script_root/launchers"
redirector="$script_root/steam-redirector"
step="$script_root/step"
workarounds="$script_root/workarounds"
downloads_cache=/tmp/mo2-linux-installer-downloads-cache
shared="$HOME/.local/share/modorganizer2"
started_download_step=0
expect_exit=0
mkdir -p "$downloads_cache"
mkdir -p "$shared"
function handle_error() {
if [ "$expect_exit" != "1" ]; then
if [ "$started_download_step" == "1" ]; then
purge_downloads_cache
fi
"$dialog" \
errorbox \
"Operation canceled. Check the terminal for details"
fi
}
function log_info() {
echo "INFO:" "$@" >&2
}
function log_warn() {
echo "WARN:" "$@" >&2
}
function log_error() {
echo "ERROR:" "$@" >&2
}
trap handle_error EXIT
if [ "$UID" == "0" ]; then
log_error "Attempted to run as root"
log_error "Please follow the install instructions provided at https://github.com/rockerbacon/modorganizer2-linux-installer"
exit 1
fi
expect_exit=1
source "$step/check_dependencies.sh"
selected_game=$(source "$step/select_game.sh")
log_info "selected game '$selected_game'"
source "$step/load_gameinfo.sh"
source "$step/clean_game_prefix.sh"
install_dir=$(source "$step/select_install_dir.sh")
log_info "selected install directory '$install_dir'"
expect_exit=0
source "$step/download_external_resources.sh"
source "$step/install_external_resources.sh"
source "$step/install_nxm_handler.sh"
source "$step/configure_steam_wineprefix.sh"
source "$step/install_steam_redirector.sh"
source "$step/register_installation.sh"
source "$step/apply_workarounds.sh"
log_info "installation completed successfully"
expect_exit=1
"$dialog" infobox "Installation successful!\n\Launch the game on Steam to use Mod Organizer 2"