dotfiles/.config/bootstrap/init_netctl.sh

22 lines
715 B
Bash
Raw Normal View History

#!/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