This repository has been archived by the owner on Apr 26, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 19
/
AnberPorts.sh
executable file
·104 lines (84 loc) · 2.79 KB
/
AnberPorts.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#!/bin/bash
version=1.3.7
# Copyright (c) 2021
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301 USA
#
# Authored by: Kris Henriksen <[email protected]>
#
# AnberPorts
#
if id "ark" &>/dev/null || id "odroid" &>/dev/null; then
sudo chmod 666 /dev/tty1
fi
export TERM=linux
export XDG_RUNTIME_DIR=/run/user/$UID/
printf "\033c" > /dev/tty1
#
# Check connectivity
#
GW=`ip route | awk '/default/ { print $3 }'`
if [ -z "$GW" ]; then
printf "\e[32mYour network connection does not seem to be working.\nDid you make sure to configure your wifi connection\nusing the Wifi selection in the Options menu?" > /dev/tty1
sleep 10
exit 1
fi
if id "ark" &>/dev/null || id "odroid" &>/dev/null; then
if ! dpkg -s "dialog" &> /dev/null ; then
install_dependencies="$install_dependencies dialog"
fi
if ! dpkg -s "zip" &> /dev/null ; then
install_dependencies="$install_dependencies zip"
fi
if ! dpkg -s "unzip" &> /dev/null ; then
install_dependencies="$install_dependencies unzip"
fi
if ! dpkg -s "curl" &> /dev/null ; then
install_dependencies="$install_dependencies curl"
fi
if ! dpkg -s "wget" &> /dev/null ; then
install_dependencies="$install_dependencies wget"
fi
if ! dpkg -s "libevdev2" &> /dev/null ; then
install_dependencies="$install_dependencies libevdev2"
fi
if ! dpkg -s "rsync" &> /dev/null ; then
install_dependencies="$install_dependencies rsync"
fi
if [ ! -z "$install_dependencies" ]
then
printf "\e[32mInstalling dependencies ...\n" > /dev/tty1
sudo apt update && sudo apt install -y $install_dependencies --no-install-recommends
fi
fi
#
# Version management
#
latest=`wget -qO- https://api.github.com/repos/krishenriksen/AnberPorts/releases/latest | grep tag_name | cut -d '"' -f 4`
update="Using latest version"
if [ $latest \> $version ]; then
update="New version available!"
fi
GAMEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )/AnberPorts"
cd $GAMEDIR
#
# Menu type ( sdl or dialog )
#
if [[ `cat ./type.txt` == "sdl" ]]; then
./AnberPortsSDL "$update" 2>&1 | tee -a ./log.txt
else
bash ./AnberPorts "$version" "$update" 2>&1 | tee -a ./log.txt
fi