diff --git a/bin/bin/wire b/bin/bin/wire new file mode 100755 index 0000000..67101d7 --- /dev/null +++ b/bin/bin/wire @@ -0,0 +1,25 @@ +#!/bin/sh + +# determine networking device +if [[ "$1" == 'wired' ]]; then + device="$(ip link show | sed 's/^[0-9]*: //; s/:.*//' | grep '^e')" +elif [[ "$1" == 'wireless' ]]; then + device="$(ip link show | sed 's/^[0-9]*: //; s/:.*//' | grep '^w')" +else + echo "$0 " + exit 1 +fi + +# shut down networking processes +killall -9 dhcpcd +if [[ "$1" == 'wireless' ]]; then + killall -9 wpa_supplicant +fi +ip link set "$device" down + +# start up networking processes +ip link set "$device" up +if [[ "$1" == 'wireless' ]]; then + wpa_supplicant -Bi "$device" -c /root/wpa_supplicant.conf +fi +dhcpcd "$device" --debug --debug diff --git a/bin/bin/wired b/bin/bin/wired deleted file mode 100755 index d0d222d..0000000 --- a/bin/bin/wired +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -# find device -device="$(ip link show | sed 's/^[0-9]*: //; s/:.*//' | grep '^e')" - -# kill processes -killall -9 dhcpcd -ip link set "$device" down - -# restart processes -ip link set "$device" up && dhcpcd "$device" && dhcpcd "$device" --debug --debug diff --git a/bin/bin/wireless b/bin/bin/wireless deleted file mode 100755 index 2ff64c0..0000000 --- a/bin/bin/wireless +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -# find device -device="$(ip link show | sed 's/^[0-9]*: //; s/:.*//' | grep '^w')" - -# kill processes -killall -9 wpa_supplicant dhcpcd -ip link set "$device" down - -# restart processes -iwconfig "$device" channel auto -ip link set "$device" up && wpa_supplicant -Bi "$device" -c /root/wpa_supplicant.conf && dhcpcd "$device" --debug --debug