mirror of
https://github.com/Ysurac/openmptcprouter-vps.git
synced 2025-02-12 19:31:54 +00:00
Fix VPS update via web and update omr-test-speed
This commit is contained in:
parent
c39b07eaa5
commit
df637bb0c4
7 changed files with 116 additions and 29 deletions
3
debian/postinst
vendored
3
debian/postinst
vendored
|
@ -6,7 +6,8 @@ test $DEBIAN_SCRIPT_DEBUG && set -v -x
|
||||||
. /usr/share/debconf/confmodule
|
. /usr/share/debconf/confmodule
|
||||||
|
|
||||||
sed -i -e "s/^LOCALFILES=.*$/LOCALFILES=no/" -e "s/^SOURCES=.*$/SOURCES=no/" /usr/share/omr-server/debian9-x86_64.sh
|
sed -i -e "s/^LOCALFILES=.*$/LOCALFILES=no/" -e "s/^SOURCES=.*$/SOURCES=no/" /usr/share/omr-server/debian9-x86_64.sh
|
||||||
systemctl enable omr-update
|
systemctl daemon-reload
|
||||||
|
systemctl restart omr-update
|
||||||
|
|
||||||
db_stop
|
db_stop
|
||||||
|
|
||||||
|
|
4
debian/rules
vendored
4
debian/rules
vendored
|
@ -13,6 +13,6 @@ override_dh_auto_install:
|
||||||
cp -r ./shorewall4 $(CURDIR)/debian/omr-server/usr/share/omr-server/
|
cp -r ./shorewall4 $(CURDIR)/debian/omr-server/usr/share/omr-server/
|
||||||
cp -r ./shorewall6 $(CURDIR)/debian/omr-server/usr/share/omr-server/
|
cp -r ./shorewall6 $(CURDIR)/debian/omr-server/usr/share/omr-server/
|
||||||
cp -r ./bin $(CURDIR)/debian/omr-server/usr/share/omr-server/
|
cp -r ./bin $(CURDIR)/debian/omr-server/usr/share/omr-server/
|
||||||
mkdir -p $(CURDIR)/debian/omr-server/lib/systemd/system
|
mkdir -p $(CURDIR)/debian/etc/openmptcprouter-vps-admin
|
||||||
cp omr-update.service.in $(CURDIR)/debian/omr-server/lib/systemd/system/omr-update.service
|
touch $(CURDIR)/debian/etc/openmptcprouter-vps-admin/update-bin
|
||||||
|
|
||||||
|
|
|
@ -46,8 +46,8 @@ MLVPN_BINARY_VERSION="3.0.0+20201216.git.2263bab"
|
||||||
UBOND_VERSION="672100fb57913ffd29caad63517e145a5974b078"
|
UBOND_VERSION="672100fb57913ffd29caad63517e145a5974b078"
|
||||||
OBFS_VERSION="486bebd9208539058e57e23a12f23103016e09b4"
|
OBFS_VERSION="486bebd9208539058e57e23a12f23103016e09b4"
|
||||||
OBFS_BINARY_VERSION="0.0.5-1"
|
OBFS_BINARY_VERSION="0.0.5-1"
|
||||||
OMR_ADMIN_VERSION="b40c6b615eca1a7171d83e3a3f58c7d4d17e0fd5"
|
OMR_ADMIN_VERSION="027d5c8e80ef469d33e43f6cbf3103b30e55ea1c"
|
||||||
OMR_ADMIN_BINARY_VERSION="0.3+20210414"
|
OMR_ADMIN_BINARY_VERSION="0.3+20210508"
|
||||||
DSVPN_VERSION="3b99d2ef6c02b2ef68b5784bec8adfdd55b29b1a"
|
DSVPN_VERSION="3b99d2ef6c02b2ef68b5784bec8adfdd55b29b1a"
|
||||||
DSVPN_BINARY_VERSION="0.1.4-2"
|
DSVPN_BINARY_VERSION="0.1.4-2"
|
||||||
V2RAY_VERSION="4.35.1"
|
V2RAY_VERSION="4.35.1"
|
||||||
|
@ -582,6 +582,12 @@ if systemctl -q is-active shadowsocks-libev-manager@manager; then
|
||||||
systemctl -q stop shadowsocks-libev-manager@manager > /dev/null 2>&1
|
systemctl -q stop shadowsocks-libev-manager@manager > /dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$LOCALFILES" = "no" ]; then
|
||||||
|
wget -O /lib/systemd/system/omr-update.service ${VPSURL}${VPSPATH}/omr-update.service.in
|
||||||
|
else
|
||||||
|
cp ${DIR}/omr-update.service.in /lib/systemd/system/omr-update.service
|
||||||
|
fi
|
||||||
|
|
||||||
# Install simple-obfs
|
# Install simple-obfs
|
||||||
if [ "$OBFS" = "yes" ]; then
|
if [ "$OBFS" = "yes" ]; then
|
||||||
echo "Install OBFS"
|
echo "Install OBFS"
|
||||||
|
@ -1260,6 +1266,7 @@ fi
|
||||||
|
|
||||||
if [ "$SOURCES" != "yes" ]; then
|
if [ "$SOURCES" != "yes" ]; then
|
||||||
apt-get -y install omr-server=${OMR_VERSION} 2>&1 >/dev/null || true
|
apt-get -y install omr-server=${OMR_VERSION} 2>&1 >/dev/null || true
|
||||||
|
rm -f /etc/openmtpcprouter-vps-admin/update-bin
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$update" = "0" ]; then
|
if [ "$update" = "0" ]; then
|
||||||
|
|
51
omr-test-speed
Executable file → Normal file
51
omr-test-speed
Executable file → Normal file
|
@ -1,30 +1,43 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# vim: set noexpandtab tabstop=4 shiftwidth=4 softtabstop=4 :
|
# vim: set noexpandtab tabstop=4 shiftwidth=4 softtabstop=4 :
|
||||||
INTERFACE="$1"
|
OVH=false
|
||||||
|
if [ "$1" = "ovh" ]; then
|
||||||
|
OVH=true
|
||||||
|
INTERFACE="$2"
|
||||||
|
else
|
||||||
|
INTERFACE="$1"
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Select best test server..."
|
[ -n "$INTERFACE" ] && [ ! -d "/sys/class/net/$INTERFACE" ] && {
|
||||||
HOSTLST="http://speedtest.frankfurt.linode.com/garbage.php?ckSize=10000 http://speedtest.tokyo2.linode.com/garbage.php?ckSize=10000 http://speedtest.singapore.linode.com/garbage.php?ckSize=10000 http://speedtest.newark.linode.com/garbage.php?ckSize=10000 http://speedtest.atlanta.linode.com/garbage.php?ckSize=10000 http://speedtest.dallas.linode.com/garbage.php?ckSize=10000 http://speedtest.fremont.linode.com/garbage.php?ckSize=10000 http://speedtest.tele2.net/1000GB.zip http://www.ovh.net/files/10Gb.dat https://speed.hetzner.de/10GB.bin http://ipv4.bouygues.testdebit.info/10G.iso http://par.download.datapacket.com/10000mb.bin http://nyc.download.datapacket.com/10000mb.bin http://ams.download.datapacket.com/10000mb.bin http://fra.download.datapacket.com/10000mb.bin http://lon.download.datapacket.com/10000mb.bin http://mad.download.datapacket.com/10000mb.bin http://prg.download.datapacket.com/10000mb.bin http://sto.download.datapacket.com/10000mb.bin http://vie.download.datapacket.com/10000mb.bin http://war.download.datapacket.com/10000mb.bin http://atl.download.datapacket.com/10000mb.bin http://chi.download.datapacket.com/10000mb.bin http://lax.download.datapacket.com/10000mb.bin http://mia.download.datapacket.com/10000mb.bin http://nyc.download.datapacket.com/10000mb.bin"
|
echo "You must use a real interface. You wan find them using 'ip a' for example"
|
||||||
bestping="999"
|
exit 0
|
||||||
for pinghost in $HOSTLST; do
|
}
|
||||||
domain=$(echo $pinghost | awk -F/ '{print $3}')
|
|
||||||
if [ -z "$INTERFACE" ]; then
|
if [ "$OVH" = false ]; then
|
||||||
ping=$(ping -c1 -w2 $domain | cut -d "/" -s -f5 | cut -d "." -f1)
|
echo "Select best test server..."
|
||||||
else
|
HOSTLST="http://speedtest.frankfurt.linode.com/garbage.php?ckSize=10000 http://speedtest.tokyo2.linode.com/garbage.php?ckSize=10000 http://speedtest.singapore.linode.com/garbage.php?ckSize=10000 http://speedtest.newark.linode.com/garbage.php?ckSize=10000 http://speedtest.atlanta.linode.com/garbage.php?ckSize=10000 http://speedtest.dallas.linode.com/garbage.php?ckSize=10000 http://speedtest.fremont.linode.com/garbage.php?ckSize=10000 http://speedtest.tele2.net/1000GB.zip http://proof.ovh.net/files/10Gb.dat https://speed.hetzner.de/10GB.bin http://ipv4.bouygues.testdebit.info/10G.iso http://par.download.datapacket.com/10000mb.bin http://nyc.download.datapacket.com/10000mb.bin http://ams.download.datapacket.com/10000mb.bin http://fra.download.datapacket.com/10000mb.bin http://lon.download.datapacket.com/10000mb.bin http://mad.download.datapacket.com/10000mb.bin http://prg.download.datapacket.com/10000mb.bin http://sto.download.datapacket.com/10000mb.bin http://vie.download.datapacket.com/10000mb.bin http://war.download.datapacket.com/10000mb.bin http://atl.download.datapacket.com/10000mb.bin http://chi.download.datapacket.com/10000mb.bin http://lax.download.datapacket.com/10000mb.bin http://mia.download.datapacket.com/10000mb.bin http://nyc.download.datapacket.com/10000mb.bin"
|
||||||
ping=$(ping -c1 -w2 -I $INTERFACE -B $domain | cut -d "/" -s -f5 | cut -d "." -f1)
|
bestping="9999"
|
||||||
fi
|
for pinghost in $HOSTLST; do
|
||||||
echo "host: $domain - ping: $ping"
|
domain=$(echo $pinghost | awk -F/ '{print $3}')
|
||||||
if [ -n "$ping" ] && [ "$ping" -lt "$bestping" ]; then
|
if [ -z "$INTERFACE" ]; then
|
||||||
bestping=$ping
|
ping=$(ping -c1 -w2 $domain | cut -d "/" -s -f5 | cut -d "." -f1)
|
||||||
HOST=$pinghost
|
else
|
||||||
fi
|
ping=$(ping -c1 -w2 -I $INTERFACE -B $domain | cut -d "/" -s -f5 | cut -d "." -f1)
|
||||||
done
|
fi
|
||||||
|
echo "host: $domain - ping: $ping"
|
||||||
|
if [ -n "$ping" ] && [ "$ping" -lt "$bestping" ]; then
|
||||||
|
bestping=$ping
|
||||||
|
HOST=$pinghost
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
[ -z "$HOST" ] && HOST="http://proof.ovh.net/files/10Gio.dat"
|
[ -z "$HOST" ] && HOST="http://proof.ovh.net/files/10Gio.dat"
|
||||||
|
|
||||||
echo "Best server is $HOST, running test:"
|
echo "Best server is $HOST, running test:"
|
||||||
trap : HUP INT TERM
|
trap : HUP INT TERM
|
||||||
if [ -z "$INTERFACE" ]; then
|
if [ -z "$INTERFACE" ]; then
|
||||||
curl -4 $HOST >/dev/null || echo
|
curl -4 -o /dev/null $HOST || echo
|
||||||
else
|
else
|
||||||
domain=$(echo $HOST | awk -F/ '{print $3}')
|
domain=$(echo $HOST | awk -F/ '{print $3}')
|
||||||
hostip=$(dig +nocmd +noall +answer A $domain | grep -v CNAME | awk '{print $5}' | tr '\n' ' ')
|
hostip=$(dig +nocmd +noall +answer A $domain | grep -v CNAME | awk '{print $5}' | tr '\n' ' ')
|
||||||
|
@ -33,7 +46,7 @@ else
|
||||||
ipset add ss_rules_dst_bypass_all $ip
|
ipset add ss_rules_dst_bypass_all $ip
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
curl -4 --interface $INTERFACE $HOST >/dev/null || echo
|
curl -4 -o /dev/null --interface $INTERFACE $HOST || echo
|
||||||
if [ -n "$(ipset list 2>/dev/null | grep ss_rules)" ]; then
|
if [ -n "$(ipset list 2>/dev/null | grep ss_rules)" ]; then
|
||||||
for ip in $hostip; do
|
for ip in $hostip; do
|
||||||
ipset del ss_rules_dst_bypass_all $ip
|
ipset del ss_rules_dst_bypass_all $ip
|
||||||
|
|
56
omr-test-speedv6
Normal file
56
omr-test-speedv6
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# vim: set noexpandtab tabstop=4 shiftwidth=4 softtabstop=4 :
|
||||||
|
OVH=false
|
||||||
|
if [ "$1" = "ovh" ]; then
|
||||||
|
OVH=true
|
||||||
|
INTERFACE="$2"
|
||||||
|
else
|
||||||
|
INTERFACE="$1"
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -n "$INTERFACE" ] && [ ! -d "/sys/class/net/$INTERFACE" ] && {
|
||||||
|
echo "You must use a real interface. You wan find them using 'ip a' for example"
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if [ "$OVH" = false ]; then
|
||||||
|
echo "Select best test server..."
|
||||||
|
HOSTLST="http://speedtest.frankfurt.linode.com/garbage.php?ckSize=10000 http://speedtest.tokyo2.linode.com/garbage.php?ckSize=10000 http://speedtest.singapore.linode.com/garbage.php?ckSize=10000 http://speedtest.newark.linode.com/garbage.php?ckSize=10000 http://speedtest.atlanta.linode.com/garbage.php?ckSize=10000 http://speedtest.dallas.linode.com/garbage.php?ckSize=10000 http://speedtest.fremont.linode.com/garbage.php?ckSize=10000 http://speedtest.tele2.net/1000GB.zip http://www.ovh.net/files/10Gb.dat https://speed.hetzner.de/10GB.bin http://ipv6.bouygues.testdebit.info/10G.iso http://par.download.datapacket.com/10000mb.bin http://nyc.download.datapacket.com/10000mb.bin http://ams.download.datapacket.com/10000mb.bin http://fra.download.datapacket.com/10000mb.bin http://lon.download.datapacket.com/10000mb.bin http://mad.download.datapacket.com/10000mb.bin http://prg.download.datapacket.com/10000mb.bin http://sto.download.datapacket.com/10000mb.bin http://vie.download.datapacket.com/10000mb.bin http://war.download.datapacket.com/10000mb.bin http://atl.download.datapacket.com/10000mb.bin http://chi.download.datapacket.com/10000mb.bin http://lax.download.datapacket.com/10000mb.bin http://mia.download.datapacket.com/10000mb.bin http://nyc.download.datapacket.com/10000mb.bin"
|
||||||
|
bestping="9999"
|
||||||
|
for pinghost in $HOSTLST; do
|
||||||
|
domain=$(echo $pinghost | awk -F/ '{print $3}')
|
||||||
|
if [ -z "$INTERFACE" ]; then
|
||||||
|
ping=$(ping -6 -c1 -w2 $domain | cut -d "/" -s -f5 | cut -d "." -f1)
|
||||||
|
else
|
||||||
|
ping=$(ping -6 -c1 -w2 -I $INTERFACE -B $domain | cut -d "/" -s -f5 | cut -d "." -f1)
|
||||||
|
fi
|
||||||
|
echo "host: $domain - ping: $ping"
|
||||||
|
if [ -n "$ping" ] && [ "$ping" -lt "$bestping" ]; then
|
||||||
|
bestping=$ping
|
||||||
|
HOST=$pinghost
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -z "$HOST" ] && HOST="http://proof.ovh.net/files/10Gio.dat"
|
||||||
|
|
||||||
|
echo "Best server is $HOST, running test:"
|
||||||
|
trap : HUP INT TERM
|
||||||
|
if [ -z "$INTERFACE" ]; then
|
||||||
|
curl -6 $HOST >/dev/null || echo
|
||||||
|
else
|
||||||
|
domain=$(echo $HOST | awk -F/ '{print $3}')
|
||||||
|
hostip=$(dig +nocmd +noall +answer AAAA $domain | grep -v CNAME | awk '{print $5}' | tr '\n' ' ')
|
||||||
|
if [ -n "$(ipset list 2>/dev/null | grep ss_rules6)" ]; then
|
||||||
|
for ip in $hostip; do
|
||||||
|
ipset add ss_rules6_dst_bypass_all $ip
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
curl -6 --interface $INTERFACE $HOST >/dev/null || echo
|
||||||
|
if [ -n "$(ipset list 2>/dev/null | grep ss_rules6)" ]; then
|
||||||
|
for ip in $hostip; do
|
||||||
|
ipset del ss_rules6_dst_bypass_all $ip
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
fi
|
11
omr-update
Executable file
11
omr-update
Executable file
|
@ -0,0 +1,11 @@
|
||||||
|
#!/bin/sh
|
||||||
|
if [ -f /etc/openmptcprouter-vps-admin/update ]; then
|
||||||
|
wget -O - http://www.openmptcprouter.com/server-test/debian10-x86_64.sh | sh
|
||||||
|
rm -f /etc/openmptcprouter-vps-admin/update
|
||||||
|
reboot
|
||||||
|
fi
|
||||||
|
if [ -f /etc/openmptcprouter-vps-admin/update-bin ]; then
|
||||||
|
LOCALFILES=yes SOURCES=yes REINSTALL=no /usr/share/omr-server/debian9-x86_64.sh
|
||||||
|
rm -f /etc/openmptcprouter-vps-admin/update-bin
|
||||||
|
#reboot
|
||||||
|
fi
|
|
@ -4,11 +4,10 @@ After=network.target network-online.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
Restart=no
|
Restart=never
|
||||||
Environment="SOURCES=no"
|
ExecStart=/usr/bin/omr-update
|
||||||
Environment="REINSTALL=no"
|
#ExecStart=/usr/share/omr-server/debian9-x86_64.sh
|
||||||
Environment="LOCALFILES=yes"
|
AmbientCapabilities=
|
||||||
ExecStart=/usr/share/omr-server/debian9-x86_64.sh
|
|
||||||
StandardOutput=file:/var/log/omr-update.log
|
StandardOutput=file:/var/log/omr-update.log
|
||||||
StandardError=file:/var/log/omr-update.log
|
StandardError=file:/var/log/omr-update.log
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue