This commit is contained in:
2022-05-20 09:54:47 +02:00
commit e3da4320b1
10 changed files with 247 additions and 0 deletions

39
Linux/.hosts Executable file
View File

@@ -0,0 +1,39 @@
#The following lines block any spotify add
0.0.0.0 adclick.g.doublecklick.net
0.0.0.0 adeventtracker.spotify.com
0.0.0.0 ads-fa.spotify.com
0.0.0.0 analytics.spotify.com
0.0.0.0 audio2.spotify.com
0.0.0.0 b.scorecardresearch.com
0.0.0.0 bounceexchange.com
0.0.0.0 bs.serving-sys.com
0.0.0.0 content.bitsontherun.com
0.0.0.0 core.insightexpressai.com
0.0.0.0 crashdump.spotify.com
0.0.0.0 d2gi7ultltnc2u.cloudfront.net
0.0.0.0 d3rt1990lpmkn.cloudfront.net
0.0.0.0 desktop.spotify.com
0.0.0.0 doubleclick.net
0.0.0.0 ds.serving-sys.com
0.0.0.0 googleadservices.com
0.0.0.0 googleads.g.doubleclick.net
0.0.0.0 gtssl2-ocsp.geotrust.com
0.0.0.0 js.moatads.com
0.0.0.0 log.spotify.com
0.0.0.0 media-match.com
0.0.0.0 omaze.com
0.0.0.0 pagead46.l.doubleclick.net
0.0.0.0 pagead2.googlesyndication.com
0.0.0.0 partner.googleadservices.com
0.0.0.0 pubads.g.doubleclick.net
0.0.0.0 redirector.gvt1.com
0.0.0.0 s0.2mdn.net
0.0.0.0 securepubads.g.doubleclick.net
0.0.0.0 spclient.wg.spotify.com
0.0.0.0 tpc.googlesyndication.com
0.0.0.0 v.jwpcdn.com
0.0.0.0 video-ad-stats.googlesyndication.com
0.0.0.0 weblb-wg.gslb.spotify.com
0.0.0.0 www.googleadservices.com
0.0.0.0 www.googletagservices.com
0.0.0.0 www.omaze.com

View File

@@ -0,0 +1,7 @@
# Loopback entries; do not change.
# For historical reasons, localhost precedes localhost.localdomain:
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
# See hosts(5) for proper format and other examples:
# 192.168.1.10 foo.mydomain.org foo
# 192.168.1.13 bar.mydomain.org bar

1
Linux/.state Normal file
View File

@@ -0,0 +1 @@
fmarquet ecovh-mobile-hpb 0

65
Linux/install.sh Executable file
View File

@@ -0,0 +1,65 @@
#!/bin/bash
detect_distro() {
if [ -f /etc/os-release ]; then
# freedesktop.org and systemd
. /etc/os-release
OS=$(echo "$ID" | awk '{print tolower($0)}')
OS_VER=$VERSION_ID
elif type lsb_release >/dev/null 2>&1; then
# linuxbase.org
OS=$(lsb_release -si | awk '{print tolower($0)}')
OS_VER=$(lsb_release -sr)
elif [ -f /etc/lsb-release ]; then
# For some versions of Debian/Ubuntu without lsb_release command
. /etc/lsb-release
OS=$(echo "$DISTRIB_ID" | awk '{print tolower($0)}')
OS_VER=$DISTRIB_RELEASE
elif [ -f /etc/debian_version ]; then
# Older Debian/Ubuntu/etc.
OS="debian"
OS_VER=$(cat /etc/debian_version)
elif [ -f /etc/SuSe-release ]; then
# Older SuSE/etc.
OS="SuSE"
OS_VER="?"
elif [ -f /etc/redhat-release ]; then
# Older Red Hat, CentOS, etc.
OS="Red Hat/CentOS"
OS_VER="?"
else
# Fall back to uname, e.g. "Linux <version>", also works for BSD, etc.
OS=$(uname -s)
OS_VER=$(uname -r)
fi
OS=$(echo "$OS" | awk '{print tolower($0)}')
OS_VER_MAJOR=$(echo "$OS_VER" | cut -d. -f1)
}
detect_distro
state="$(head -n 1 .state)"
if [ "$EUID" -ne 0 ]
then
echo "Please run as superuser"
exit
fi
if [ "$state" == "$SUDO_USER $HOSTNAME 1" ]
then
echo "Service already installed, press any key to update it or ctrl-c to avoid installation"
read cap
echo "Service up to date!"
cp .hosts_original_${OS}.txt /etc/hosts
else
echo "Service is going to be installed, press any key to continue or ctrl-c to avoid installation"
read cap
echo "Service installed!"
echo "$SUDO_USER $HOSTNAME 1" > .state
cp /etc/hosts .hosts_original_${OS}.txt
fi
cat .hosts >> /etc/hosts

60
Linux/uninstall.sh Executable file
View File

@@ -0,0 +1,60 @@
#!/bin/bash
state="$(head -n 1 .state)"
detect_distro() {
if [ -f /etc/os-release ]; then
# freedesktop.org and systemd
. /etc/os-release
OS=$(echo "$ID" | awk '{print tolower($0)}')
OS_VER=$VERSION_ID
elif type lsb_release >/dev/null 2>&1; then
# linuxbase.org
OS=$(lsb_release -si | awk '{print tolower($0)}')
OS_VER=$(lsb_release -sr)
elif [ -f /etc/lsb-release ]; then
# For some versions of Debian/Ubuntu without lsb_release command
. /etc/lsb-release
OS=$(echo "$DISTRIB_ID" | awk '{print tolower($0)}')
OS_VER=$DISTRIB_RELEASE
elif [ -f /etc/debian_version ]; then
# Older Debian/Ubuntu/etc.
OS="debian"
OS_VER=$(cat /etc/debian_version)
elif [ -f /etc/SuSe-release ]; then
# Older SuSE/etc.
OS="SuSE"
OS_VER="?"
elif [ -f /etc/redhat-release ]; then
# Older Red Hat, CentOS, etc.
OS="Red Hat/CentOS"
OS_VER="?"
else
# Fall back to uname, e.g. "Linux <version>", also works for BSD, etc.
OS=$(uname -s)
OS_VER=$(uname -r)
fi
OS=$(echo "$OS" | awk '{print tolower($0)}')
OS_VER_MAJOR=$(echo "$OS_VER" | cut -d. -f1)
}
detect_distro
if [ "$EUID" -ne 0 ]
then
echo "Please run as root"
exit
fi
if [ "$state" == "$SUDO_USER $HOSTNAME 1" ]
then
echo "You are going to unninstall the service SpotifyAddBlock, press any key to continue or ctrl-c to avoid uninstallation"
read cap
echo "Service uninstalled!"
cp .hosts_original_${OS}.txt /etc/hosts
else
echo "The service is not installed on this machine"
fi
echo "$SUDO_USER $HOSTNAME 0" > .state