commit 76c9d0aaa9bb734ad1ef32c1cd6a56461210010a
parent 39fb7962ef35aa152d412322fd210be6ae462382
Author: Sebastiano Tronto <sebastiano@tronto.net>
Date: Thu, 11 Jun 2026 08:39:29 +0200
Better network management
Diffstat:
4 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/.profile b/.profile
@@ -30,6 +30,7 @@ alias o='open-file'
alias f='feed get && feed -m fzf menu'
alias w='iwctl station wlan0 get-networks'
alias c='iwctl station wlan0 connect'
+alias e='doas ip link set eth1 up && doas udhcpc -i eth1 -n'
alias d='iwctl station wlan0 disconnect'
alias bc='bc -q /home/sebastiano/box/bc.library'
diff --git a/.xinitrc b/.xinitrc
@@ -1,3 +1,14 @@
+# Bring up ethernet and keep checking if available
+doas ip link set eth1 up
+while true; do
+ if [ "$(cat /sys/class/net/eth1/carrier)" = 1 ]; then
+ if ! doas ip -4 addr show eth1 | grep inet; then
+ doas udhcpc -i eth1 -n && iwctl station wlan0 disconnect
+ fi
+ fi
+ sleep 3
+done &
+
# Check every minute
while true; do
battery-checknow &
@@ -8,10 +19,6 @@ while true; do
done &
sleep 0.01 &
- if [ "$(cat /sys/class/net/eth0/carrier)" = 1 ]; then
- iwctl station wlan0 disconnect
- fi
-
xroot-update
sleep $((60 - $(date +%-S)))
@@ -36,4 +43,3 @@ xbanish &
Telegram &
#exec dwm
exec dbus-launch --exit-with-session dwm
-rm .serverauth.*
diff --git 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
tmp_doas_file=$(mktemp)
cp /etc/doas.d/20-wheel.conf "$tmp_doas_file"
-for c in poweroff reboot; do
+for c in poweroff reboot ip udhcpc; do
printf 'permit nopass :wheel as root cmd %s\n' "$c" >> "$tmp_doas_file"
done
doas cp "$tmp_doas_file" /etc/doas.d/20-wheel.conf
@@ -116,6 +116,7 @@ NameResolvingService=resolvconf
EOF
doas mv "$tmp_iwd_file" /etc/iwd/main.conf
+doas cp /dev/null /etc/network/interfaces
doas rc-update add iwd boot
doas rc-update del networking boot
diff --git a/scripts/status-linux b/scripts/status-linux
@@ -27,17 +27,10 @@ else
battery="No battery"
fi
-# NetworkManager has a dreadful command line interface
-# It makes cry every time
-# pls help
-#nwline="$(nmcli device status | head -n 2 | tail -n 1)"
-#nwclean="$(echo "$nwline" | sed 's/ *$//' | sed 's/.* //')"
-#network="Network: $nwclean"
-
# Thank you iwctl for saving us from this dreadful existence
network="$(iwctl station wlan0 show | grep 'Connected network' | \
awk '{$1=$2=""; $0=$0; print}' | sed 's/^ .//')"
-if [ "$(cat /sys/class/net/eth0/carrier 2>/dev/null)" = 1 ]; then
+if [ "$(cat /sys/class/net/eth1/carrier 2>/dev/null)" = 1 ]; then
if [ -z "$network" ]; then
network="eth"
else