summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO14
-rw-r--r--.gitignore3
-rw-r--r--PKGBUILD28
-rw-r--r--README.md16
-rw-r--r--fetch-hosts.service11
-rw-r--r--fetch-hosts.timer9
6 files changed, 81 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 00000000000..61588cc1abc
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,14 @@
+pkgbase = fetch-hosts
+ pkgdesc = Fetch new adware and malware blocking hosts file from Steven Black's GitHub repo.
+ pkgver = 1
+ pkgrel = 1
+ arch = any
+ license = GPL
+ depends = curl
+ source = fetch-hosts.service
+ source = fetch-hosts.timer
+ md5sums = c18dc82875f0c74cdc0c419d4cdc68c2
+ md5sums = fee12eb2cc54311af21e2f6be740895a
+
+pkgname = fetch-hosts
+
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000000..a5401c5d685
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+pkg/
+src/
+*.pkg.tar.xz
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 00000000000..1457251054c
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,28 @@
+# Maintainer: Mike Mogenson <michael.mogenson@gmail.com>
+pkgname=fetch-hosts
+pkgver=1
+pkgrel=1
+pkgdesc="Fetch new adware and malware blocking hosts file from Steven Black's GitHub repo."
+arch=('any')
+depends=('curl')
+license=('GPL')
+source=('fetch-hosts.service' 'fetch-hosts.timer')
+md5sums=('c18dc82875f0c74cdc0c419d4cdc68c2' 'fee12eb2cc54311af21e2f6be740895a')
+
+package() {
+ cd "$srcdir"
+
+ SYSD="$pkgdir/usr/lib/systemd/system" # systemd services directory
+ install -dm755 "$SYSD"
+ install -m644 "fetch-hosts.service" "$SYSD"
+ install -m644 "fetch-hosts.timer" "$SYSD"
+
+ # heads up to enable systemd service
+ echo -e "\e[32m" # green text
+ echo "------------------------------------------------------------"
+ echo "Run 'systemctl enable fetch-hosts.timer' to enable timer"
+ echo "Enable either 'NetworkManager-wait-online.service' or"
+ echo " 'systemd-networkd-wait-online.service' for timer to work"
+ echo "------------------------------------------------------------"
+ echo -e "\e[0m" # normal text
+}
diff --git a/README.md b/README.md
new file mode 100644
index 00000000000..9c7d8c9026d
--- /dev/null
+++ b/README.md
@@ -0,0 +1,16 @@
+# systemd timer and service to fetch adware and malware blocking hosts file
+
+Fetch a hosts file from https://github.com/StevenBlack/hosts/ and overwrite `/etc/hosts` via a systemd timer and service.
+
+Install with the `PKGBUILD` or by copying `fetch-hosts.timer` and `fetch-hosts.server` to `/etc/systemd/system`.
+
+Enable the timer to fetch new hosts files:
+```
+$ systemctl enable fetch-hosts.timer
+$ systemctl enable fetch-hosts.service
+```
+Enable only one of the following:
+```
+$ systemctl enable NetworkManager-wait-online.service
+$ systemctl enable systemd-networkd-wait-online.service
+```
diff --git a/fetch-hosts.service b/fetch-hosts.service
new file mode 100644
index 00000000000..d831017828f
--- /dev/null
+++ b/fetch-hosts.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Fetch hosts file from Steven Black's GitHub repo
+After=network-online.target
+Wants=network-online.target
+
+[Service]
+Type=simple
+ExecStart=/usr/bin/curl https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts -o /etc/hosts
+
+[Install]
+WantedBy=multi-user.target
diff --git a/fetch-hosts.timer b/fetch-hosts.timer
new file mode 100644
index 00000000000..63ec7c2dd68
--- /dev/null
+++ b/fetch-hosts.timer
@@ -0,0 +1,9 @@
+[Unit]
+Description=Fetch new hosts file via fetch-hosts.service
+
+[Timer]
+OnCalendar=weekly
+Persistent=true
+
+[Install]
+WantedBy=timers.target