-
Notifications
You must be signed in to change notification settings - Fork 28
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
base: master
Are you sure you want to change the base?
Conversation
…mmands and fix misc. globbing issues
@@ -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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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)
?
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.