-
Notifications
You must be signed in to change notification settings - Fork 3
/
wizard.sh
61 lines (49 loc) · 1.34 KB
/
wizard.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
#!/bin/bash
REPO_DIR=$PWD
list_versions() {
echo "Available versions:"
ls -d */ | grep -vE '0\.6\.x-bin|0\.7\.x-bin|resources'
}
list_mod_per_version() {
version=$1
echo "Mods available for $version:"
ls -d "$REPO_DIR/$version"/*/
}
install_mod() {
version=$1
mod=$2
mod_path="$REPO_DIR/$version/$mod"
if [ -d "$mod_path" ]; then
cd "$REPO_DIR/$version/$mod"
bash compile.sh
echo "Success: $mod has been installed!"
exit
else
echo "Error: Something went wrong."
fi
}
echo "Welcome to the teeworlds-mods installer!"
list_versions
while true; do
echo "Enter the mod version below (or say exit to quit):"
read choose_version
if [ "$choose_version" == "exit" ]; then
echo "Leaving..."
break
fi
if [ -d "$REPO_DIR/$choose_version" ]; then
list_mod_per_version "$choose_version"
echo "Enter the mod you want to install (or say 'leave' to choose another version):"
read choose_mod
if [ "$choose_mod" == "leave" ]; then
continue
fi
if [ -d "$REPO_DIR/$choose_version/$choose_mod" ]; then
install_mod "$choose_version" "$choose_mod"
else
echo "Mod not found. Try again."
fi
else
echo "Version not found. Try again."
fi
done