Skip to content

Commit

Permalink
fix: fixes a race condition in the launcher scripts and enables MANU …
Browse files Browse the repository at this point in the history
…if eth0 is up (closes #365)
  • Loading branch information
evilsocket committed Oct 23, 2019
1 parent 3ad4269 commit a78a4b0
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions builder/pwnagotchi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@
# blink 10 times to signal ready state
/usr/bin/bootblink 10 &
# start a detached screen session with bettercap
if ifconfig | grep usb0 | grep RUNNING; then
if [[ ifconfig | grep usb0 | grep RUNNING ]] || [[ $(cat /sys/class/net/eth0/carrier) ]]; then
# if override file exists, go into auto mode
if [ -f /root/.pwnagotchi-auto ]; then
rm /root/.pwnagotchi-auto
Expand All @@ -322,13 +322,10 @@
mode: 0755
content: |
#!/usr/bin/env bash
# blink 10 times to signal ready state
/usr/bin/bootblink 10 &
/usr/bin/monstart
if ifconfig | grep usb0 | grep RUNNING; then
if [[ ifconfig | grep usb0 | grep RUNNING ]] || [[ $(cat /sys/class/net/eth0/carrier) ]]; then
# if override file exists, go into auto mode
if [ -f /root/.pwnagotchi-auto ]; then
rm /root/.pwnagotchi-auto
/usr/bin/bettercap -no-colors -caplet pwnagotchi-auto -iface mon0
else
/usr/bin/bettercap -no-colors -caplet pwnagotchi-manual -iface mon0
Expand Down

2 comments on commit a78a4b0

@ZerxXxes
Copy link

Choose a reason for hiding this comment

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

This IF-statement is only tested on RPi3, needs to be tested on RPi0W too so that my bash syntax is correct (first statement should check command exitcode, second checks file output)

@ZeroCool-Dade
Copy link

Choose a reason for hiding this comment

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

The cat command on carrier will always return a value (0-4), so always true.. you may want to add " | grep 1" that will return true if an ethernet connection is up.

Please sign in to comment.