mirror of
https://github.com/bol-van/zapret.git
synced 2024-11-30 05:50:53 +03:00
Compare commits
3 Commits
a9f27896d3
...
3160bd5f79
Author | SHA1 | Date | |
---|---|---|---|
|
3160bd5f79 | ||
|
1616c59303 | ||
|
f2dcc57711 |
@ -452,7 +452,7 @@ curl_with_dig()
|
|||||||
# $2 - domain name
|
# $2 - domain name
|
||||||
# $3 - port
|
# $3 - port
|
||||||
# $4+ - curl params
|
# $4+ - curl params
|
||||||
local connect_to=$(curl_connect_to $1 $2 $3)
|
local connect_to="$(curl_connect_to $1 $2 $3)"
|
||||||
[ -n "$connect_to" ] || {
|
[ -n "$connect_to" ] || {
|
||||||
echo "could not resolve ipv$1 $2"
|
echo "could not resolve ipv$1 $2"
|
||||||
return 6
|
return 6
|
||||||
|
@ -60,7 +60,7 @@ find_str_in_list()
|
|||||||
}
|
}
|
||||||
end_with_newline()
|
end_with_newline()
|
||||||
{
|
{
|
||||||
local c=$(tail -c 1)
|
local c="$(tail -c 1)"
|
||||||
[ "$c" = "" ]
|
[ "$c" = "" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,7 +140,7 @@ linux_min_version()
|
|||||||
}
|
}
|
||||||
linux_get_subsys()
|
linux_get_subsys()
|
||||||
{
|
{
|
||||||
local INIT=$(sed 's/\x0/\n/g' /proc/1/cmdline | head -n 1)
|
local INIT="$(sed 's/\x0/\n/g' /proc/1/cmdline | head -n 1)"
|
||||||
|
|
||||||
[ -L "$INIT" ] && INIT=$(readlink "$INIT")
|
[ -L "$INIT" ] && INIT=$(readlink "$INIT")
|
||||||
INIT=$(basename "$INIT")
|
INIT=$(basename "$INIT")
|
||||||
@ -213,7 +213,7 @@ fsleep_setup()
|
|||||||
elif busybox usleep 1 2>/dev/null; then
|
elif busybox usleep 1 2>/dev/null; then
|
||||||
FSLEEP=2
|
FSLEEP=2
|
||||||
else
|
else
|
||||||
local errtext=$(read -t 0.001 2>&1)
|
local errtext="$(read -t 0.001 2>&1)"
|
||||||
if [ -z "$errtext" ]; then
|
if [ -z "$errtext" ]; then
|
||||||
FSLEEP=3
|
FSLEEP=3
|
||||||
# newer openwrt has ucode with system function that supports timeout in ms
|
# newer openwrt has ucode with system function that supports timeout in ms
|
||||||
|
@ -76,7 +76,8 @@ check_system()
|
|||||||
|
|
||||||
echo \* checking system
|
echo \* checking system
|
||||||
|
|
||||||
SYSTEM=""
|
SYSTEM=
|
||||||
|
SUBSYS=
|
||||||
SYSTEMCTL=$(whichq systemctl)
|
SYSTEMCTL=$(whichq systemctl)
|
||||||
|
|
||||||
get_fwtype
|
get_fwtype
|
||||||
@ -86,7 +87,7 @@ check_system()
|
|||||||
UNAME=$(uname)
|
UNAME=$(uname)
|
||||||
if [ "$UNAME" = "Linux" ]; then
|
if [ "$UNAME" = "Linux" ]; then
|
||||||
# do not use 'exe' because it requires root
|
# do not use 'exe' because it requires root
|
||||||
local INIT=$(sed 's/\x0/\n/g' /proc/1/cmdline | head -n 1)
|
local INIT="$(sed 's/\x0/\n/g' /proc/1/cmdline | head -n 1)"
|
||||||
[ -L "$INIT" ] && INIT=$(readlink "$INIT")
|
[ -L "$INIT" ] && INIT=$(readlink "$INIT")
|
||||||
INIT=$(basename "$INIT")
|
INIT=$(basename "$INIT")
|
||||||
# some distros include systemctl without systemd
|
# some distros include systemctl without systemd
|
||||||
@ -119,13 +120,13 @@ check_system()
|
|||||||
exitp 5
|
exitp 5
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
linux_get_subsys
|
||||||
elif [ "$UNAME" = "Darwin" ]; then
|
elif [ "$UNAME" = "Darwin" ]; then
|
||||||
SYSTEM=macos
|
SYSTEM=macos
|
||||||
else
|
else
|
||||||
echo easy installer only supports Linux and MacOS. check readme.txt for supported systems and manual setup info.
|
echo easy installer only supports Linux and MacOS. check readme.txt for supported systems and manual setup info.
|
||||||
exitp 5
|
exitp 5
|
||||||
fi
|
fi
|
||||||
linux_get_subsys
|
|
||||||
echo system is based on $SYSTEM
|
echo system is based on $SYSTEM
|
||||||
[ -n "$info" ] && echo $info
|
[ -n "$info" ] && echo $info
|
||||||
}
|
}
|
||||||
@ -316,7 +317,7 @@ check_package_exists_openwrt()
|
|||||||
check_package_openwrt()
|
check_package_openwrt()
|
||||||
{
|
{
|
||||||
[ -n "$(opkg list-installed $1)" ] && return 0
|
[ -n "$(opkg list-installed $1)" ] && return 0
|
||||||
local what=$(opkg whatprovides $1 | tail -n +2 | head -n 1)
|
local what="$(opkg whatprovides $1 | tail -n +2 | head -n 1)"
|
||||||
[ -n "$what" ] || return 1
|
[ -n "$what" ] || return 1
|
||||||
[ -n "$(opkg list-installed $what)" ]
|
[ -n "$(opkg list-installed $what)" ]
|
||||||
}
|
}
|
||||||
@ -361,7 +362,7 @@ openwrt_fw_section_del()
|
|||||||
{
|
{
|
||||||
# $1 - fw include postfix
|
# $1 - fw include postfix
|
||||||
|
|
||||||
local id=$(openwrt_fw_section_find $1)
|
local id="$(openwrt_fw_section_find $1)"
|
||||||
[ -n "$id" ] && {
|
[ -n "$id" ] && {
|
||||||
uci delete firewall.@include[$id] && uci commit firewall
|
uci delete firewall.@include[$id] && uci commit firewall
|
||||||
rm -f "$OPENWRT_FW_INCLUDE$1"
|
rm -f "$OPENWRT_FW_INCLUDE$1"
|
||||||
@ -377,7 +378,7 @@ openwrt_fw_section_add()
|
|||||||
}
|
}
|
||||||
openwrt_fw_section_configure()
|
openwrt_fw_section_configure()
|
||||||
{
|
{
|
||||||
local id=$(openwrt_fw_section_add $1)
|
local id="$(openwrt_fw_section_add $1)"
|
||||||
[ -z "$id" ] ||
|
[ -z "$id" ] ||
|
||||||
! uci set firewall.@include[$id].path="$OPENWRT_FW_INCLUDE" ||
|
! uci set firewall.@include[$id].path="$OPENWRT_FW_INCLUDE" ||
|
||||||
! uci set firewall.@include[$id].reload="1" ||
|
! uci set firewall.@include[$id].reload="1" ||
|
||||||
|
@ -24,7 +24,7 @@ get_virt()
|
|||||||
check_virt()
|
check_virt()
|
||||||
{
|
{
|
||||||
echo \* checking virtualization
|
echo \* checking virtualization
|
||||||
local vm=$(get_virt)
|
local vm="$(get_virt)"
|
||||||
if [ -n "$vm" ]; then
|
if [ -n "$vm" ]; then
|
||||||
if [ "$vm" = "none" ]; then
|
if [ "$vm" = "none" ]; then
|
||||||
echo running on bare metal
|
echo running on bare metal
|
||||||
|
@ -25,7 +25,7 @@ run_daemon()
|
|||||||
# $2 - daemon
|
# $2 - daemon
|
||||||
# $3 - daemon args
|
# $3 - daemon args
|
||||||
# use $PIDDIR/$DAEMONBASE$1.pid as pidfile
|
# use $PIDDIR/$DAEMONBASE$1.pid as pidfile
|
||||||
local DAEMONBASE="$(basename $2)"
|
local DAEMONBASE="$(basename "$2")"
|
||||||
local PIDFILE="$PIDDIR/$DAEMONBASE$1.pid"
|
local PIDFILE="$PIDDIR/$DAEMONBASE$1.pid"
|
||||||
local ARGS="--daemon --pidfile=$PIDFILE $3"
|
local ARGS="--daemon --pidfile=$PIDFILE $3"
|
||||||
[ -f "$PIDFILE" ] && pgrep -qF "$PIDFILE" && {
|
[ -f "$PIDFILE" ] && pgrep -qF "$PIDFILE" && {
|
||||||
@ -42,7 +42,7 @@ stop_daemon()
|
|||||||
# use $PIDDIR/$DAEMONBASE$1.pid as pidfile
|
# use $PIDDIR/$DAEMONBASE$1.pid as pidfile
|
||||||
|
|
||||||
local PID
|
local PID
|
||||||
local DAEMONBASE="$(basename $2)"
|
local DAEMONBASE="$(basename "$2")"
|
||||||
local PIDFILE="$PIDDIR/$DAEMONBASE$1.pid"
|
local PIDFILE="$PIDDIR/$DAEMONBASE$1.pid"
|
||||||
[ -f "$PIDFILE" ] && read PID <"$PIDFILE"
|
[ -f "$PIDFILE" ] && read PID <"$PIDFILE"
|
||||||
[ -n "$PID" ] && {
|
[ -n "$PID" ] && {
|
||||||
|
@ -56,7 +56,7 @@ run_daemon()
|
|||||||
# $2 - daemon
|
# $2 - daemon
|
||||||
# $3 - daemon args
|
# $3 - daemon args
|
||||||
# use $PIDDIR/$DAEMONBASE$1.pid as pidfile
|
# use $PIDDIR/$DAEMONBASE$1.pid as pidfile
|
||||||
local DAEMONBASE=$(basename $2)
|
local DAEMONBASE="$(basename "$2")"
|
||||||
echo "Starting daemon $1: $2 $3"
|
echo "Starting daemon $1: $2 $3"
|
||||||
procd_open_instance
|
procd_open_instance
|
||||||
procd_set_param command $2 $3
|
procd_set_param command $2 $3
|
||||||
|
@ -166,7 +166,7 @@ run_daemon()
|
|||||||
# $3 - daemon args
|
# $3 - daemon args
|
||||||
# use $PIDDIR/$DAEMONBASE$1.pid as pidfile
|
# use $PIDDIR/$DAEMONBASE$1.pid as pidfile
|
||||||
|
|
||||||
local DAEMONBASE=$(basename $2)
|
local DAEMONBASE="$(basename "$2")"
|
||||||
local PIDFILE=$PIDDIR/$DAEMONBASE$1.pid
|
local PIDFILE=$PIDDIR/$DAEMONBASE$1.pid
|
||||||
echo "Starting daemon $1: $2 $3"
|
echo "Starting daemon $1: $2 $3"
|
||||||
if exists start-stop-daemon ; then
|
if exists start-stop-daemon ; then
|
||||||
@ -191,7 +191,7 @@ stop_daemon()
|
|||||||
# $1 - daemon number : 1,2,3,...
|
# $1 - daemon number : 1,2,3,...
|
||||||
# $2 - daemon
|
# $2 - daemon
|
||||||
# use $PIDDIR/$DAEMONBASE$1.pid as pidfile
|
# use $PIDDIR/$DAEMONBASE$1.pid as pidfile
|
||||||
local DAEMONBASE=$(basename $2)
|
local DAEMONBASE="$(basename "$2")"
|
||||||
local PIDFILE=$PIDDIR/$DAEMONBASE$1.pid
|
local PIDFILE=$PIDDIR/$DAEMONBASE$1.pid
|
||||||
echo "Stopping daemon $1: $2"
|
echo "Stopping daemon $1: $2"
|
||||||
if exists start-stop-daemon ; then
|
if exists start-stop-daemon ; then
|
||||||
|
@ -52,7 +52,7 @@ check_bins()
|
|||||||
echo \* checking executables
|
echo \* checking executables
|
||||||
|
|
||||||
fix_perms_bin_test "$EXEDIR"
|
fix_perms_bin_test "$EXEDIR"
|
||||||
local arch=$(get_bin_arch)
|
local arch="$(get_bin_arch)"
|
||||||
local make_target
|
local make_target
|
||||||
[ "$FORCE_BUILD" = "1" ] && {
|
[ "$FORCE_BUILD" = "1" ] && {
|
||||||
echo forced build mode
|
echo forced build mode
|
||||||
@ -385,7 +385,7 @@ copy_all()
|
|||||||
}
|
}
|
||||||
copy_openwrt()
|
copy_openwrt()
|
||||||
{
|
{
|
||||||
local ARCH=$(get_bin_arch)
|
local ARCH="$(get_bin_arch)"
|
||||||
local BINDIR="$1/binaries/$ARCH"
|
local BINDIR="$1/binaries/$ARCH"
|
||||||
|
|
||||||
[ -d "$2" ] || mkdir -p "$2"
|
[ -d "$2" ] || mkdir -p "$2"
|
||||||
@ -500,7 +500,7 @@ check_location()
|
|||||||
exitp 3
|
exitp 3
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
local B=$(dirname "$ZAPRET_TARGET")
|
local B="$(dirname "$ZAPRET_TARGET")"
|
||||||
[ -d "$B" ] || mkdir -p "$B"
|
[ -d "$B" ] || mkdir -p "$B"
|
||||||
$1 "$EXEDIR" "$ZAPRET_TARGET"
|
$1 "$EXEDIR" "$ZAPRET_TARGET"
|
||||||
fix_perms "$ZAPRET_TARGET"
|
fix_perms "$ZAPRET_TARGET"
|
||||||
|
Loading…
Reference in New Issue
Block a user