Skip to content

Commit

Permalink
added install-wol.sh (still a work in progress)
Browse files Browse the repository at this point in the history
  • Loading branch information
VectorCell committed Aug 11, 2020
1 parent cf1ac7c commit a6c2da4
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions install-wol.sh
@@ -0,0 +1,24 @@
#!/bin/bash

ATTEMPTS=0
while [ -z "$(which ethtool)" ]; do
if [ $ATTEMPTS == 0 ]; then
echo "WARNING: Unable to find ethtool. Attempting to install ..."
sudo apt update
sudo apt install -y ethtool
ATTEMPTS=1
elif [ $ATTEMPTS == 1 ]; then
echo "ERROR: Unable to install ethtool. Aborting!"
exit 1
fi
done

INTERFACE=$(ip r | grep ^default | awk '{print $5}')
if [ -z "$INTERFACE" ]; then
echo "ERROR: unable to find default network interface"
echo "Do you not have a default route? Here is the output of \"ip r\":"
ip r
exit 1
fi

echo "Enable WOL on interface $INTERFACE?"

0 comments on commit a6c2da4

Please sign in to comment.