summarylogtreecommitdiffstats
path: root/respect-my-internet.sh
blob: ea816e06e4f7d251db3882621bbf6022abd3eef3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# /bin/bash

SRCPATH="/tmp/respect-my-internet"
DESTPATH="/etc/opensnitchd"

echo "Blocklist update in progress"

if (ls /tmp | grep -i "respect-my-internet") > /dev/null ; then 
sudo rm -rf "$SRCPATH"
fi
if (ls /etc/opensnitchd/ | grep -i "rules") > /dev/null ; then echo "rule directory exist";
else sudo mkdir "$DESTPATH/rules"
fi
if (ls /etc/opensnitchd/ | grep -i "ip") > /dev/null ; then sudo rm -rf "$DESTPATH/ip/"
fi
if (ls /etc/opensnitchd/ | grep -i "blocklist") > /dev/null ; then echo "blocklist directory exist";
else sudo mkdir "$DESTPATH/blocklist/"
fi

git clone https://github.com/TheCyberArcher/Respect-My-Internet/ /tmp/respect-my-internet/
sudo mv "$SRCPATH/blocklist/respect-my-internet.txt" "$DESTPATH/blocklist/"
sudo mv "$SRCPATH/blocklist/ip/" "$DESTPATH"
sudo mv $SRCPATH/rules/* $DESTPATH/rules/

echo "Succes ! Updated from https://github.com/TheCyberArcher/Respect-My-Internet"

### Cleaning

echo "Cleaning"
sudo rm -rf "$SRCPATH"

### relaunch opensnitchd.service

sudo systemctl restart opensnitchd.service
echo "Opensnitch service restarted"