Merge pull request #22619 from stangri/master-adblock-fast
adblock-fast: update to 1.0.1-1
This commit is contained in:
commit
6b4a197c8c
3 changed files with 435 additions and 392 deletions
|
@ -1,12 +1,12 @@
|
||||||
# Copyright 2023 Stan Grishin (stangri@melmac.ca)
|
# Copyright 2023 MOSSDeF, Stan Grishin (stangri@melmac.ca)
|
||||||
# TLD optimization written by Dirk Brenken (dev@brenken.org)
|
# TLD optimization written by Dirk Brenken (dev@brenken.org)
|
||||||
# This is free software, licensed under the GNU General Public License v3.
|
# This is free software, licensed under the GNU General Public License v3.
|
||||||
|
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=adblock-fast
|
PKG_NAME:=adblock-fast
|
||||||
PKG_VERSION:=1.0.0
|
PKG_VERSION:=1.0.1
|
||||||
PKG_RELEASE:=7
|
PKG_RELEASE:=1
|
||||||
PKG_MAINTAINER:=Stan Grishin <stangri@melmac.ca>
|
PKG_MAINTAINER:=Stan Grishin <stangri@melmac.ca>
|
||||||
PKG_LICENSE:=GPL-3.0-or-later
|
PKG_LICENSE:=GPL-3.0-or-later
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,51 +1,14 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# Copyright 2023 MOSSDeF, Stan Grishin (stangri@melmac.ca)
|
# Copyright 2023 MOSSDeF, Stan Grishin (stangri@melmac.ca)
|
||||||
# shellcheck disable=SC1091,SC2015,SC3037,SC3043,SC2317,SC3060
|
# shellcheck disable=SC2015,SC3043,SC3060
|
||||||
|
|
||||||
readonly packageName='adblock-fast'
|
readonly adbFunctionsFile='/etc/init.d/adblock-fast'
|
||||||
readonly _OK_='\033[0;32m\xe2\x9c\x93\033[0m'
|
if [ -s "$adbFunctionsFile" ]; then
|
||||||
readonly _FAIL_='\033[0;31m\xe2\x9c\x97\033[0m'
|
# shellcheck source=../../etc/init.d/adblock-fast
|
||||||
readonly __OK__='\033[0;32m[\xe2\x9c\x93]\033[0m'
|
. "$adbFunctionsFile"
|
||||||
readonly __FAIL__='\033[0;31m[\xe2\x9c\x97]\033[0m'
|
else
|
||||||
readonly _ERROR_='\033[0;31mERROR\033[0m'
|
printf "%b: adblock-fast init.d file (%s) not found! \n" '\033[0;31mERROR\033[0m' "$adbFunctionsFile"
|
||||||
readonly _WARNING_='\033[0;33mWARNING\033[0m'
|
fi
|
||||||
output() {
|
|
||||||
# Can take a single parameter (text) to be output at any verbosity
|
|
||||||
# Or target verbosity level and text to be output at specifc verbosity
|
|
||||||
local msg memmsg logmsg
|
|
||||||
local sharedMemoryOutput="/dev/shm/$packageName-output"
|
|
||||||
verbosity="${verbosity:-2}"
|
|
||||||
if [ "$#" -ne 1 ]; then
|
|
||||||
if [ $((verbosity & $1)) -gt 0 ] || [ "$verbosity" = "$1" ]; then
|
|
||||||
shift
|
|
||||||
else
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
[ -t 1 ] && printf "%b" "$1"
|
|
||||||
msg="$1";
|
|
||||||
if [ "$(printf "%b" "$msg" | wc -l)" -gt 0 ]; then
|
|
||||||
[ -s "$sharedMemoryOutput" ] && memmsg="$(cat "$sharedMemoryOutput")"
|
|
||||||
logmsg="$(printf "%b" "${memmsg}${msg}" | sed 's/\x1b\[[0-9;]*m//g')"
|
|
||||||
logger -t "${packageName:-service}" "$(printf "%b" "$logmsg")"
|
|
||||||
rm -f "$sharedMemoryOutput"
|
|
||||||
else
|
|
||||||
printf "%b" "$msg" >> "$sharedMemoryOutput"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
output_ok() { output 1 "$_OK_"; output 2 "$__OK__\\n"; }
|
|
||||||
output_okn() { output 1 "$_OK_\\n"; output 2 "$__OK__\\n"; }
|
|
||||||
output_fail() { output 1 "$_FAIL_"; output 2 "$__FAIL__\\n"; }
|
|
||||||
output_failn() { output 1 "$_FAIL_\\n"; output 2 "$__FAIL__\\n"; }
|
|
||||||
is_present() { command -v "$1" >/dev/null 2>&1; }
|
|
||||||
get_url_filesize() {
|
|
||||||
local url="$1" size size_command
|
|
||||||
[ -n "$1" ] || return 0
|
|
||||||
is_present 'curl' || return 0
|
|
||||||
size_command='curl --silent --insecure --fail --head --request GET'
|
|
||||||
size="$($size_command "$url" | grep -Po '^[cC]ontent-[lL]ength: \K\w+')"
|
|
||||||
echo -en "$size"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Transition from simple-adblock
|
# Transition from simple-adblock
|
||||||
_enable_url() {
|
_enable_url() {
|
||||||
|
|
Loading…
Reference in a new issue