mirror of
https://github.com/Ysurac/openmptcprouter-vps.git
synced 2025-03-09 15:50:00 +00:00
Check if user is root, fix error in omr-service
This commit is contained in:
parent
b2cddfca38
commit
fd11069012
2 changed files with 4 additions and 2 deletions
|
@ -56,6 +56,8 @@ export LC_ALL=C
|
||||||
export PATH=$PATH:/sbin
|
export PATH=$PATH:/sbin
|
||||||
export DEBIAN_FRONTEND=noninteractive
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
if [ "$(id -u)" -ne 0 ]; then echo 'Please run as root.' >&2; exit 1; fi
|
||||||
|
|
||||||
# Check Linux version
|
# Check Linux version
|
||||||
if test -f /etc/os-release ; then
|
if test -f /etc/os-release ; then
|
||||||
. /etc/os-release
|
. /etc/os-release
|
||||||
|
@ -132,7 +134,7 @@ if [ "$ID" = "debian" ] && [ "$VERSION_ID" = "9" ] && [ "$UPDATE_OS" = "yes" ];
|
||||||
VERSION_ID="10"
|
VERSION_ID="10"
|
||||||
fi
|
fi
|
||||||
if [ "$ID" = "ubuntu" ] && [ "$VERSION_ID" = "18.04" ] && [ "$UPDATE_OS" = "yes" ]; then
|
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 upgrade
|
||||||
apt-get -y -f --force-yes dist-upgrade
|
apt-get -y -f --force-yes dist-upgrade
|
||||||
sed -i 's:bionic:focal:g' /etc/apt/sources.list
|
sed -i 's:bionic:focal:g' /etc/apt/sources.list
|
||||||
|
|
|
@ -40,7 +40,7 @@ _lan_route() {
|
||||||
cat /etc/openmptcprouter-vps-admin/omr-admin-config.json | jq -c '.users[0][]' |
|
cat /etc/openmptcprouter-vps-admin/omr-admin-config.json | jq -c '.users[0][]' |
|
||||||
while IFS=$"\n" read -r c; do
|
while IFS=$"\n" read -r c; do
|
||||||
vpnremoteip=$(echo "$c" | jq -r '.vpnremoteip')
|
vpnremoteip=$(echo "$c" | jq -r '.vpnremoteip')
|
||||||
if [ -n "$vpnremoteip" ]; then
|
if [ -n "$vpnremoteip" ] && [ "$vpnremoteip" != "null" ]; then
|
||||||
echo "$c" | jq -c '.lanips //empty' |
|
echo "$c" | jq -c '.lanips //empty' |
|
||||||
while IFS=$"\n" read -r d; do
|
while IFS=$"\n" read -r d; do
|
||||||
network=$(ipcalc -n $d | grep Network | awk '{print $2}')
|
network=$(ipcalc -n $d | grep Network | awk '{print $2}')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue