Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix dependency issue with install and other misc. fixes #84

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

MrCowKing
Copy link

Fixes the install script checking for dependencies and certain expressions always returning true.

Added safeguards around expressions in the hostsblock script to prevent them from executing for some reason.

@@ -8,7 +8,7 @@ if [ "$(whoami)" != "root" ]; then
fi

for dep in getent grep useradd groupadd gpasswd cut ps chmod chown; do
if $(which $dep) &>/dev/null; then
if which $dep &>/dev/null; then
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better to use command -v to check for dependency.

@@ -19,7 +19,7 @@ done
DESTDIR="/usr/bin/"
echo "Destination directory for hostsblock is $DESTDIR. Enter a new path or press Enter to keep as is."
read -p "$DESTDIR " d
if [ "$d" != "" ] || [ -n $d ]; then
if [ "$d" != "" ] || [[ -n $d ]]; then
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about using [ -n "$d" ] instead, [[ ]] in too bashism.

@@ -46,8 +46,8 @@ fi
gpasswd -a hostsblock hostsblock
gpasswd -A hostsblock hostsblock

if ps aux | grep [d]nsmasq | tr -s ' ' | cut -d' ' -f 11- | grep -q [d]nsmasq; then
dnsmasq_user=$(ps aux | grep [d]nsmasq | tr -s ' ' | cut -d' ' -f 1)
if ps aux | grep '[d]nsmasq' | tr -s ' ' | cut -d' ' -f 11- | grep -q '[d]nsmasq'; then
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can use ps -o user= -p $(sudo dnsmasq)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants