From b1e3ea44f81caa356bd8380c5c51e0fec280f3ca Mon Sep 17 00:00:00 2001 From: Quentin Duchemin Date: Wed, 1 May 2024 10:29:37 +0200 Subject: [PATCH] Switch from NM to netctl I did that in the good old days, and I switched to NM because I didn't know then the wifi-menu interface. But, for a sneaky bug I don't understand, all my wireless interfaces became "Unavailable" on all my computers. No matter if I uninstall, reset anything related to NM. So, back to netctl with a nice script to automate connections --- .config/bootstrap/config_common | 7 ++++--- .config/bootstrap/init_netctl.sh | 22 ++++++++++++++++++++++ .config/polybar/config.d/laptop | 2 +- .init_config.sh | 6 ++---- 4 files changed, 29 insertions(+), 8 deletions(-) create mode 100755 .config/bootstrap/init_netctl.sh diff --git a/.config/bootstrap/config_common b/.config/bootstrap/config_common index ee7f83a..4cb5be1 100644 --- a/.config/bootstrap/config_common +++ b/.config/bootstrap/config_common @@ -15,6 +15,7 @@ catppuccin-gtk-theme-macchiato chafa chromium cups +dhcpcd docker dosfstools dkms @@ -33,6 +34,7 @@ hplip htop i3-wm i3lock-color +ifplugd imagemagick jq kwayland5 @@ -49,10 +51,8 @@ mlocate nmap nemo neofetch +netctl neovim -network-manager-applet -networkmanager -nm-connection-editor noto-fonts-emoji numlockx obsidian @@ -99,6 +99,7 @@ vim vlc vscodium-bin wget +wpa_supplicant xautolock xclip xdg-user-dirs diff --git a/.config/bootstrap/init_netctl.sh b/.config/bootstrap/init_netctl.sh new file mode 100755 index 0000000..ed3295b --- /dev/null +++ b/.config/bootstrap/init_netctl.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash +echo -e "* Auto-create wired profil and autoconnect service for netctl..." +for i in `ip -br l | awk '$1 !~ "lo|vir|wl" { print $1}'`; do + echo -e "~ ${i}..." + cat <<- EOF | sudo tee /etc/netctl/${i} + Interface=${i} + Connection=ethernet + IP=dhcp + EOF + sudo systemctl enable --now netctl-ifplugd@${i} + # In case some old config stays.... + sudo systemctl restart netctl-ifplugd@${i} + +done +echo -e "* Autoconnect to wireless profiles..." +for i in `ip -br l | awk '$1 ~ "wl" { print $1}'`; do + sudo systemctl enable --now netctl-auto@${i} +done +# https://man.archlinux.org/man/netctl.special.7 +echo -e "* Ensure connections are back when PC is resumed..." +sudo systemctl enable netctl-sleep + \ No newline at end of file diff --git a/.config/polybar/config.d/laptop b/.config/polybar/config.d/laptop index 9f2cdca..073934a 100644 --- a/.config/polybar/config.d/laptop +++ b/.config/polybar/config.d/laptop @@ -6,7 +6,7 @@ top_center = player-mpris ;top_center = xwindow top_right = system-usb-udev backlight pulseaudio date bottom_left = i3 -bottom_center = updates-arch-combined wireless-network +bottom_center = updates-arch-combined wired-network wireless-network bottom_right = temperature cpu memory filesystem-custom [module/memory] diff --git a/.init_config.sh b/.init_config.sh index bb4f708..548b14c 100755 --- a/.init_config.sh +++ b/.init_config.sh @@ -94,15 +94,13 @@ function init_system() { # https://man.archlinux.org/man/rofi-dmenu.5 echo -e "* Symlink dmenu → rofi..." sudo ln -sf /usr/bin/rofi /usr/bin/dmenu - echo -e "* Enabling required systemd units..." - sudo systemctl enable --now NetworkManager + echo -e "* Enabling common systemd units..." sudo systemctl enable --now systemd-timesyncd sudo systemctl enable --now cups sudo systemctl enable --now bluetooth sudo systemctl enable --now bluetooth-autoconnect sudo systemctl enable --now updatedb.timer - # iwd will be used as a backend for NetworkManager - sudo systemctl disable wpa_supplicant + ./.config/init_netctl.sh echo -e "* Ensure hardware clock is up to date..." sudo hwclock --systohc # So that "Open in Terminal" works inc Nemo