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

optionally run iiab-network when wifi is present #175

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions iiab
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,11 @@ fi

touch $FLAGDIR/iiab-complete

if ! [[ $(ls -la /sys/class/net/*/phy80211 | awk -F / '{print $5}' | wc ) == 0 ]]; then
Copy link
Member

@holta holta Jul 26, 2021

Choose a reason for hiding this comment

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

Does the suggestion (further below) also work?

If so, it suppresses this error on non-WiFi systems:

root@box:~# ls -la /sys/class/net/*/phy80211 | awk -F / '{print $5}' | wc
ls: cannot access '/sys/class/net/*/phy80211': No such file or directory
      0       0       0
root@box:~# ls -la /sys/class/net/*/phy80211
ls: cannot access '/sys/class/net/*/phy80211': No such file or directory

FWIW 2>/dev/null would also work below, if preserving STDOUT is desired:

Suggested change
if ! [[ $(ls -la /sys/class/net/*/phy80211 | awk -F / '{print $5}' | wc ) == 0 ]]; then
if ls /sys/class/net/*/phy80211 &>/dev/null; then

Copy link
Contributor Author

Choose a reason for hiding this comment

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

might be useful to know why iiab-network is not being run, lack of phy80211 in any of the interfaces...

Copy link
Member

Choose a reason for hiding this comment

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

Currently this PR does not display STDOUT e.g. network devices like ap0 and wlan0.

If you want to display both STDOUT and STDERR, here's one rudimentary (bare bones) option:

if ls -d1 /sys/class/net/*/phy80211; then

When run, it shows stuff like...

root@box:~# if ls -d1 /sys/class/net/*/phy80211; then :; fi
/sys/class/net/ap0/phy80211
/sys/class/net/wlan0/phy80211
root@box:~# if ls -d1 /sys/class/net/*/phy80211; then :; fi
ls: cannot access '/sys/class/net/*/phy80211': No such file or directory

Copy link
Member

@holta holta Jul 26, 2021

Choose a reason for hiding this comment

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

Just a note that this PR's original if statement always returns True.
That aspect can be fixed with wc -l instead of wc.

However that's not a comprehensive fix, as it still does not display STDOUT.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't really care what the syntax you decide to push is just make it happen so users that use the 'iiab' script outside of the intended target of supporting offline wifi serving of web content can continue to muck around without bothering to read any of the docs, reducing frivolous requests for support of their local network layout.

cd /opt/iiab/iiab
./iiab-network
fi

# M. Educate Implementers prior to rebooting!
echo -e "\n\n ┌───────────────────────────────────────────────────────────┐"
echo -e " │ │"
Expand Down