Skip to content

hostsblock failed if white.list or black.list file doesn't exist #99

@jmbIFR

Description

@jmbIFR

At first run, after install, the grep command in hostsblock.sh failled because the white.list doesn't exist

the log (in french) give

  Extracting blocklists...
grep: /var/lib/hostsblock/white.list: Aucun fichier ou dossier de ce type
grep: erreur d'écriture: Relais brisé (pipe)
sort: échec d'écriture: 'sortie standard': Relais brisé (pipe)
sort: erreur d'écriture
FAILED TO COMPILE BLOCK/REDIRECT ENTRIES FROM URLS IN /var/lib/hostsblock/block.urls INTO /var/lib/hostsblock/hosts.block. EXITING

If $blacklist file doesn't exist, the input redirection form $blacklist fail (show log below) and In the end the hosts.block is not created

while read _blacklistline; do
    grep -Fqx "$redirecturl $_blacklistline" "$hostsfile".new || \
      printf %s\\n "$redirecturl $_blacklistline" >> "$hostsfile".new
done < "$blacklist" && \
mv $_v -- "$hostsfile".new "$hostsfile" && \ ICIC
chmod 644 "$hostsfile"
/usr/lib/hostsblock.sh: 680: /usr/lib/hostsblock.sh: cannot open /var/lib/hostsblock/black.list: No such file

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions