Skip to content

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.


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.

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.


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