1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-vps.git synced 2025-02-12 11:21:56 +00:00

Check if user is root, fix error in omr-service

This commit is contained in:
Ycarus (Yannick Chabanois) 2020-08-14 08:18:13 +00:00
parent b2cddfca38
commit fd11069012
2 changed files with 4 additions and 2 deletions

View file

@ -56,6 +56,8 @@ export LC_ALL=C
export PATH=$PATH:/sbin
export DEBIAN_FRONTEND=noninteractive
if [ "$(id -u)" -ne 0 ]; then echo 'Please run as root.' >&2; exit 1; fi
# Check Linux version
if test -f /etc/os-release ; then
. /etc/os-release
@ -132,7 +134,7 @@ if [ "$ID" = "debian" ] && [ "$VERSION_ID" = "9" ] && [ "$UPDATE_OS" = "yes" ];
VERSION_ID="10"
fi
if [ "$ID" = "ubuntu" ] && [ "$VERSION_ID" = "18.04" ] && [ "$UPDATE_OS" = "yes" ]; then
echo "Update Ubutnu 18.04 to Ubuntu 20.04"
echo "Update Ubuntu 18.04 to Ubuntu 20.04"
apt-get -y -f --force-yes upgrade
apt-get -y -f --force-yes dist-upgrade
sed -i 's:bionic:focal:g' /etc/apt/sources.list

View file

@ -40,7 +40,7 @@ _lan_route() {
cat /etc/openmptcprouter-vps-admin/omr-admin-config.json | jq -c '.users[0][]' |
while IFS=$"\n" read -r c; do
vpnremoteip=$(echo "$c" | jq -r '.vpnremoteip')
if [ -n "$vpnremoteip" ]; then
if [ -n "$vpnremoteip" ] && [ "$vpnremoteip" != "null" ]; then
echo "$c" | jq -c '.lanips //empty' |
while IFS=$"\n" read -r d; do
network=$(ipcalc -n $d | grep Network | awk '{print $2}')