aboutsummaryrefslogtreecommitdiff
path: root/system/update-hosts
diff options
context:
space:
mode:
authorYaroslav de la Peña Smirnov <yps@yaroslavps.com>2021-10-07 14:43:37 +0300
committerYaroslav de la Peña Smirnov <yps@yaroslavps.com>2021-10-07 14:43:37 +0300
commit7ac60e4a99344d96239f2f4da63b6c9e190045f1 (patch)
tree3aa920bff8c0c18e79c420a630c5bd177b8d8cec /system/update-hosts
parent653da507074730db446bc54e8a1165c8f919d4bd (diff)
parent4213b8745e62801b9926c699edf7ad3ffd94f0b4 (diff)
downloadswayrice-7ac60e4a99344d96239f2f4da63b6c9e190045f1.tar.gz
swayrice-7ac60e4a99344d96239f2f4da63b6c9e190045f1.zip
Merge branch 'back-to-qute'
Diffstat (limited to 'system/update-hosts')
-rwxr-xr-xsystem/update-hosts9
1 files changed, 9 insertions, 0 deletions
diff --git a/system/update-hosts b/system/update-hosts
new file mode 100755
index 0000000..6725ce9
--- /dev/null
+++ b/system/update-hosts
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+# Check several times before giving up, useful when just waking up from sleep
+# since internet is usually not available right away
+wget -q --tries=3 --timeout=20 --spider 1.1.1.1 > /dev/null || exit
+
+curl "http://sbc.io/hosts/hosts" 2>/dev/null | \
+ grep -vE '^(\s*)[1-9a-f:]{1,4}.*' | \
+ cat /etc/hosts.head - > /etc/hosts