From a6c2da4807daae9712c6652f463cf4541724fdf5 Mon Sep 17 00:00:00 2001 From: Brandon Smith Date: Tue, 11 Aug 2020 10:37:04 -0500 Subject: [PATCH] added install-wol.sh (still a work in progress) --- install-wol.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 install-wol.sh diff --git a/install-wol.sh b/install-wol.sh new file mode 100755 index 0000000..4e769fb --- /dev/null +++ b/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?"