forked from OpenDiablo2/OpenDiablo2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·54 lines (46 loc) · 1.22 KB
/
run.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
#!/bin/sh
#
# About: Build OpenDiablo 2 automatically
# Author: liberodark
# License: GNU GPLv3
set -eu
version="0.0.2"
echo "OpenDiablo 2 Build Script $version"
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST AND VAR
#=================================================
distro=$(sed -n 's#PRETTY_NAME="\([^"]*\)"#\1#p' /etc/os-release)
# Check OS & go
if ! command -v go >/dev/null
then
echo "Install Go for OpenDiablo 2 ($distro)? y/n"
read -r choice
[ "$choice" != y ] && [ "$choice" != Y ] && exit
case "$(echo "$distro" | tr '[:upper:]' '[:lower:]')" in
centos|red\ hat|suse|oracle)
sudo yum install -y go >/dev/null 2>&1
;;
fedora)
sudo dnf install -y go >/dev/null 2>&1
;;
debian|ubuntu|deepin)
sudo apt-get update >/dev/null 2>&1
sudo apt-get install -y go --force-yes >/dev/null 2>&1
;;
manjaro|arch\ linux)
sudo pacman -S go --noconfirm >/dev/null 2>&1
;;
gentoo/linux)
sudo emerge --ask n go /dev/null 2>&1
;;
*)
echo "$distro: unsupported distribution, please install Go by yourself"
exit 1
;;
esac
fi
# Build
echo "Build OpenDiablo 2"
go get
go build
echo "Build finished. Please edit config.json before running OpenDiablo2"