Skip to content

Commit

Permalink
[bin] merge wired and wireless scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
justinnhli committed Apr 29, 2023
1 parent 4637134 commit 0f71421
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 23 deletions.
25 changes: 25 additions & 0 deletions bin/bin/wire
Original file line number Diff line number Diff line change
@@ -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 <wired|wireless>"
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
11 changes: 0 additions & 11 deletions bin/bin/wired

This file was deleted.

12 changes: 0 additions & 12 deletions bin/bin/wireless

This file was deleted.

0 comments on commit 0f71421

Please sign in to comment.