gaenserich / hostsblock

an ad- and malware-blocking script for Linux
https://github.com/gaenserich/hostsblock
225 stars 28 forks source link

How do I installed it? #13

Closed pickfire closed 9 years ago

pickfire commented 9 years ago

I can't find a usage section in README.md. How do I use it?

Sadi58 commented 9 years ago

How about downloading and installing the DEB file for the "stable" version instead of the "pre-alpha" version files listed?

pickfire commented 9 years ago

I doesn't use debian-based system. Is there any install script? I tried running hostsblock.sh but it doesn't seem to change /etc/hosts

gaenserich commented 9 years ago

Check out the PKGBUILD document if you want to install the pre-alpha, which details where what files are installed and with which permissions under the "package" heading, e.g. hostsblock.sh goes to /usr/bin/hostsblock.

pickfire commented 9 years ago

Is there a way to run the script without installing in /etc or /usr?

gaenserich commented 9 years ago

You could manually install the requisite files into /usr/local/ and make sure you use the "-f" command-line option to point hostsblock to your hostsblock.conf file, whereever it may be (e.g. under /usr/local/etc/). Make sure hostsblock.conf's other entries also point to appropriate entries, e.g. /usr/local/etc/hostsblock/black.list, if that is where you put your blacklist.)

Jacob A. van der Kolk http://personal.psu.edu/jav209 Lecturer in German Ph.D. Candidate in German Literature and Culture, ABD Department of Germanic and Slavic Languages and Literatures The Pennsylvania State University jav209@psu.edu PGP Public Key http://www.personal.psu.edu/jav209/jvdk.gpg (plaintext http://www.personal.psu.edu/jav209/jvdk.asc)

2015-04-23 10:08 GMT-04:00 Ivan Tham notifications@github.com:

Is there a way to run the script without installing in /etc or /usr?

— Reply to this email directly or view it on GitHub https://github.com/gaenserich/hostsblock/issues/13#issuecomment-95598075 .

Sadi58 commented 9 years ago

This elementary script might do the installation in one easy step -- also creating a weekly cron job:

#!/bin/bash

USER="$(whoami)"
mkdir -p /home/"$USER"/.local/share/git/hostsblock
git clone https://github.com/gaenserich/hostsblock.git /home/"$USER"/.local/share/git/hostsblock

sudo ln -sf /home/"$USER"/.local/share/git/hostsblock/black.list /etc/hostsblock/black.list
sudo ln -sf /home/"$USER"/.local/share/git/hostsblock/hostsblock.conf /etc/hostsblock/hostsblock.conf
sudo ln -sf /home/"$USER"/.local/share/git/hostsblock/hostsblock.sh /etc/hostsblock/hostsblock
sudo ln -sf /home/"$USER"/.local/share/git/hostsblock/hostsblock-urlcheck.sh /etc/hostsblock/hostsblock-urlcheck
sudo ln -sf /home/"$USER"/.local/share/git/hostsblock/hosts.head /etc/hostsblock/hosts.head
sudo ln -sf /home/"$USER"/.local/share/git/hostsblock/white.list /etc/hostsblock/white.list

sudo ln -sf /home/"$USER"/.local/share/git/hostsblock/hostsblock-common.sh /usr/local/lib/hostsblock-common.sh
sudo ln -sf /home/"$USER"/.local/share/git/hostsblock/hostsblock-urlcheck.sh /usr/local/bin/hostsblock-urlcheck

cat <<EOF > /home/"$USER"/hostsblock
#!/bin/bash
/etc/hostsblock/hostsblock -v 3 &>/var/log/hostsblock.log
EOF
chmod +x /home/"$USER"/hostsblock
sudo mv  /home/"$USER"/hostsblock /usr/local/bin/hostsblock

sudo ln -sf /usr/local/bin/hostsblock /etc/cron.weekly/hostsblock

One can then simply update the local git directory from time to time... Perhaps a (possibly better written) script like this may also be added for new users?..

pickfire commented 9 years ago

I mean that just run git clone https://github.com/gaenserich/hostsblock && cd hostsblock && sudo ./hostsblock to install hostblock, update /etc/hosts and do almost everything so that there it is easier for those who just download and run or even just curl xxxxxxxxx/hostsblock.sh | sudo bash.

Make the application run using the KISS principle (Keep It Simple, Stupid).

gaenserich commented 9 years ago

KISS would be to use your distribution's package manager. That would also be much safer, too. In general, pre-alpha software isn't KISS to start with...it takes work to keep things KISS, as odd as that sounds.

pickfire commented 9 years ago

I don't think that this project is still alpha, as it does almost everything. And when will it become beta?

gaenserich commented 9 years ago

I will move it to beta once I get the man pages and systemd service and timer files all squared away (feel free to contribute!).

pickfire commented 9 years ago

I will contribute and try my best.