diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2026-06-11 08:39:29 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2026-06-11 08:39:29 +0200 |
| commit | 76c9d0aaa9bb734ad1ef32c1cd6a56461210010a (patch) | |
| tree | a25eeefdfaccd980ee82fb43c52f3b6737bc4ff6 | |
| parent | 39fb7962ef35aa152d412322fd210be6ae462382 (diff) | |
| download | config-76c9d0aaa9bb734ad1ef32c1cd6a56461210010a.tar.gz config-76c9d0aaa9bb734ad1ef32c1cd6a56461210010a.zip | |
Better network management
| -rw-r--r-- | .profile | 1 | ||||
| -rw-r--r-- | .xinitrc | 16 | ||||
| -rwxr-xr-x | scripts/setup-config-alpine | 3 | ||||
| -rwxr-xr-x | scripts/status-linux | 9 |
4 files changed, 15 insertions, 14 deletions
| @@ -30,6 +30,7 @@ alias o='open-file' | |||
| 30 | alias f='feed get && feed -m fzf menu' | 30 | alias f='feed get && feed -m fzf menu' |
| 31 | alias w='iwctl station wlan0 get-networks' | 31 | alias w='iwctl station wlan0 get-networks' |
| 32 | alias c='iwctl station wlan0 connect' | 32 | alias c='iwctl station wlan0 connect' |
| 33 | alias e='doas ip link set eth1 up && doas udhcpc -i eth1 -n' | ||
| 33 | alias d='iwctl station wlan0 disconnect' | 34 | alias d='iwctl station wlan0 disconnect' |
| 34 | 35 | ||
| 35 | alias bc='bc -q /home/sebastiano/box/bc.library' | 36 | alias bc='bc -q /home/sebastiano/box/bc.library' |
| @@ -1,3 +1,14 @@ | |||
| 1 | # Bring up ethernet and keep checking if available | ||
| 2 | doas ip link set eth1 up | ||
| 3 | while true; do | ||
| 4 | if [ "$(cat /sys/class/net/eth1/carrier)" = 1 ]; then | ||
| 5 | if ! doas ip -4 addr show eth1 | grep inet; then | ||
| 6 | doas udhcpc -i eth1 -n && iwctl station wlan0 disconnect | ||
| 7 | fi | ||
| 8 | fi | ||
| 9 | sleep 3 | ||
| 10 | done & | ||
| 11 | |||
| 1 | # Check every minute | 12 | # Check every minute |
| 2 | while true; do | 13 | while true; do |
| 3 | battery-checknow & | 14 | battery-checknow & |
| @@ -8,10 +19,6 @@ while true; do | |||
| 8 | done & | 19 | done & |
| 9 | sleep 0.01 & | 20 | sleep 0.01 & |
| 10 | 21 | ||
| 11 | if [ "$(cat /sys/class/net/eth0/carrier)" = 1 ]; then | ||
| 12 | iwctl station wlan0 disconnect | ||
| 13 | fi | ||
| 14 | |||
| 15 | xroot-update | 22 | xroot-update |
| 16 | 23 | ||
| 17 | sleep $((60 - $(date +%-S))) | 24 | sleep $((60 - $(date +%-S))) |
| @@ -36,4 +43,3 @@ xbanish & | |||
| 36 | Telegram & | 43 | Telegram & |
| 37 | #exec dwm | 44 | #exec dwm |
| 38 | exec dbus-launch --exit-with-session dwm | 45 | exec dbus-launch --exit-with-session dwm |
| 39 | rm .serverauth.* | ||
diff --git a/scripts/setup-config-alpine b/scripts/setup-config-alpine index 8ea2347..a013dcb 100755 --- a/scripts/setup-config-alpine +++ b/scripts/setup-config-alpine | |||
| @@ -62,7 +62,7 @@ doas mv "$tmp_xorg_file" /etc/X11/xorg.conf.d/40-libinput.conf | |||
| 62 | 62 | ||
| 63 | tmp_doas_file=$(mktemp) | 63 | tmp_doas_file=$(mktemp) |
| 64 | cp /etc/doas.d/20-wheel.conf "$tmp_doas_file" | 64 | cp /etc/doas.d/20-wheel.conf "$tmp_doas_file" |
| 65 | for c in poweroff reboot; do | 65 | for c in poweroff reboot ip udhcpc; do |
| 66 | printf 'permit nopass :wheel as root cmd %s\n' "$c" >> "$tmp_doas_file" | 66 | printf 'permit nopass :wheel as root cmd %s\n' "$c" >> "$tmp_doas_file" |
| 67 | done | 67 | done |
| 68 | doas cp "$tmp_doas_file" /etc/doas.d/20-wheel.conf | 68 | doas cp "$tmp_doas_file" /etc/doas.d/20-wheel.conf |
| @@ -116,6 +116,7 @@ NameResolvingService=resolvconf | |||
| 116 | EOF | 116 | EOF |
| 117 | 117 | ||
| 118 | doas mv "$tmp_iwd_file" /etc/iwd/main.conf | 118 | doas mv "$tmp_iwd_file" /etc/iwd/main.conf |
| 119 | doas cp /dev/null /etc/network/interfaces | ||
| 119 | 120 | ||
| 120 | doas rc-update add iwd boot | 121 | doas rc-update add iwd boot |
| 121 | doas rc-update del networking boot | 122 | doas rc-update del networking boot |
diff --git a/scripts/status-linux b/scripts/status-linux index a88649c..5fa4e13 100755 --- a/scripts/status-linux +++ b/scripts/status-linux | |||
| @@ -27,17 +27,10 @@ else | |||
| 27 | battery="No battery" | 27 | battery="No battery" |
| 28 | fi | 28 | fi |
| 29 | 29 | ||
| 30 | # NetworkManager has a dreadful command line interface | ||
| 31 | # It makes cry every time | ||
| 32 | # pls help | ||
| 33 | #nwline="$(nmcli device status | head -n 2 | tail -n 1)" | ||
| 34 | #nwclean="$(echo "$nwline" | sed 's/ *$//' | sed 's/.* //')" | ||
| 35 | #network="Network: $nwclean" | ||
| 36 | |||
| 37 | # Thank you iwctl for saving us from this dreadful existence | 30 | # Thank you iwctl for saving us from this dreadful existence |
| 38 | network="$(iwctl station wlan0 show | grep 'Connected network' | \ | 31 | network="$(iwctl station wlan0 show | grep 'Connected network' | \ |
| 39 | awk '{$1=$2=""; $0=$0; print}' | sed 's/^ .//')" | 32 | awk '{$1=$2=""; $0=$0; print}' | sed 's/^ .//')" |
| 40 | if [ "$(cat /sys/class/net/eth0/carrier 2>/dev/null)" = 1 ]; then | 33 | if [ "$(cat /sys/class/net/eth1/carrier 2>/dev/null)" = 1 ]; then |
| 41 | if [ -z "$network" ]; then | 34 | if [ -z "$network" ]; then |
| 42 | network="eth" | 35 | network="eth" |
| 43 | else | 36 | else |
