SailfishOS:Chum icon

SailfishOS:Chum

A Sailfish OS software repository by the community

App icon of Hosts-block

Hosts-block

Hosts-based adblock script

v0.0.9

Ad-blocking via /etc/hosts (primer)

After installation the script runs immediately, and then every week.

Your existing hosts file will be copied to hosts.head during installation. It is then used as the head of the new, ad-blocking hosts file. You can edit this file between updates. If you uninstall hosts-block, it will become your regular hosts file again.

By default only one or two lists are used, but you can add as many sources as you want - they'll be combined to create the ultimate ad-blocking hosts file.

3 formats are supported:

If you want stricter or less strict blocking, copy /usr/share/doc/hosts-block/cfg.sh to /home/defaultuser/.config/hosts-block/ and edit it to your liking.

You can whitelist sites by creating /home/defaultuser/.config/hosts-block/whitelist.txt - the format is much like hosts itself but without the numerical address, so just the [sub.]domain.tld, one per line (AFAIK no wildcards are supported). Same for blacklist.txt/blacklisting.

Please keep in mind that the www. subdomain has to be specified explicitely, if so desired. In other words, for most domains you'll probably want 2 lines:

domain.tld
www.domain.tld

The script is run once a week (currently hardcoded) through a systemd timer/service.

If one of the config files is edited, a new run is triggered.

You can regenerate the hosts manually file with devel-su systemctl start hosts-block.service

The script sends various graphical notifications when something important happens (good or bad).

Before installing the package

There is nothing to do if you haven't customized /etc/hosts. But if you want to preserve its content please move/copy it to /etc/hosts.head before installing this package. If /etc/hosts.head does not exist yet it will be created with sane default values, and from then on it will be used as the top of /etc/hosts unaltered.

It is, however, not a good idea to put to-be-blocked domains in /etc/hosts.head. Please use the blacklist feature for that (if you think these domains haven't been covered by one of the available blocklists already).

If you uninstall hosts-block /etc/hosts.head will become your regular hosts file again.

Source
Framagit.org
Notabug.org

Download

The easiest way to download and install this software is by the SailfishOS:Chum GUI app. If you wish to download the RPM file by yourself, please expand the section below.

Download links

Changelog

0.0.9-3 (2025-06-30)

- Removed "But there was no change" notification
  (the message is still logged)

Older changelogs

0.0.9-1 (2025-06-07)

- watch-config.sh now reacts correctly when *list.txt is removed
  It also now starts the systemd service instead of launching
  the script directly

0.0.8-5 (2025-06-05)

- fixing rpm specs for smooth upgrades

0.0.8-3 (2025-06-04)

- small fixes, version/release bump

0.0.7-0 (2025-03-10)

- another major overhaul to fix enable reload on filechange

0.0.6-0 (2025-03-04)

- major overhaul to enable reload on filechange

0.0.5-0 (2025-02-22)

- added icons and blacklist options
- now in chum:testing

0.0.4-1 (2025-02-15)

- added configuration and whitelist options

0.0.3-1 (2025-02-13)

- Script improvements
- Service & timer improvements
- Rework systemd commands in spec file to make sure the hosts file is updated immediately after installation

0.0.2-1 (2025-01-12)

- Send notification to restart browser after update

0.0.1-2 (2025-01-08)

- Initial rpm packaging

0.0.1 (2023-10-29)

- Development and announcement on forum.sailfishos.org

App information

Package name
hosts-block
Version
0.0.9+master.20250630100009.c2f2fa8-1.1.1.bso
Licence
GPLv3
Developer
Ohnonot
Packager
Vlad G., Ohnonot
Last updated
2026-01-06 19:39:54

Download size
58.7 KiB
Installed size
54.0 KiB
Checksum (sha256)
3a70a21a613a5e4d604fb95561d9f116691e9ed3bac397762902685e5c1f2dd8
Download size
34.8 KiB
Installed size
35.2 KiB
Checksum (sha256)
46ff70af365c624388a36c7b7d611b2aaf940fa539fa3443441c58fcd810aeae

Links