Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added install-wol.sh (still a work in progress)
- Loading branch information
1 parent
cf1ac7c
commit a6c2da4
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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?" |