summaryrefslogtreecommitdiffstats
path: root/config/chroot_local-hooks/12-generate-ublock-origin-filter
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2017-02-07 01:46:02 +0000
committerintrigeri <intrigeri@boum.org>2017-02-07 01:46:02 +0000
commita125665e9ca875c16465f014c3cafe002eef1572 (patch)
tree375e19d545131856a70684c5fce29bb415eb299b /config/chroot_local-hooks/12-generate-ublock-origin-filter
parent0bab7e30681f7b481f5967d38686770460533b4c (diff)
parent4bb09f3837bd8864afd085e69654cd497690fe70 (diff)
Merge remote-tracking branch 'origin/devel' into feature/tor-nightly-master
Diffstat (limited to 'config/chroot_local-hooks/12-generate-ublock-origin-filter')
-rwxr-xr-xconfig/chroot_local-hooks/12-generate-ublock-origin-filter22
1 files changed, 22 insertions, 0 deletions
diff --git a/config/chroot_local-hooks/12-generate-ublock-origin-filter b/config/chroot_local-hooks/12-generate-ublock-origin-filter
new file mode 100755
index 0000000..bfb85a1
--- /dev/null
+++ b/config/chroot_local-hooks/12-generate-ublock-origin-filter
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+set -e
+
+echo "Converting uBlock database dump into sqlite blob"
+
+apt-get install --yes sqlite3
+
+DUMP="/usr/share/tails/ublock-origin/ublock0.dump"
+DATABASE="/etc/tor-browser/profile/extension-data/ublock0.sqlite"
+
+mkdir -p "$(dirname "${DATABASE}")"
+
+# The sed expression simply means: remove all CRLF ("\r\n"). The use
+# of labels is simply to make this able to remove multiple CRLF to
+# create a single (long) line. In the end, this restores the
+# diff-friendly dump to the original sqlite dump.
+sed ':a;N;$!ba;s_\r\n__g' "${DUMP}" | sqlite3 "${DATABASE}"
+
+echo "Created uBlock sqlite blob successfully"
+
+apt-get purge --yes sqlite3