From: Christian Heller Date: Sun, 10 Sep 2017 18:36:09 +0000 (+0200) Subject: Fix keyboard config bug, add rump for new networking script. X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/decks/%7B%7Bdb.prefix%7D%7D/static/blog?a=commitdiff_plain;h=c483f0e1c35f408e70f31f8855fcd80abdbd963c;p=config Fix keyboard config bug, add rump for new networking script. --- diff --git a/ansible/files/console/___etc___default___keyboard b/ansible/files/console/___etc___default___keyboard index 25a46b7..7f08e30 100644 --- a/ansible/files/console/___etc___default___keyboard +++ b/ansible/files/console/___etc___default___keyboard @@ -1,2 +1,4 @@ -XKBMODEL="pc105" # questionable, but works fine as default +# setting XKBMODEL to the questionable default seems to be necessary and works nicely +# curiously, putting a comment on the same line as a variable setting seems to break things +XKBMODEL="pc105" XKBLAYOUT="de" diff --git a/bin/network.sh b/bin/network.sh new file mode 100755 index 0000000..cfaf39f --- /dev/null +++ b/bin/network.sh @@ -0,0 +1,70 @@ +#!/bin/sh + +eth_interface=enp0s25 +wifi_interface=wls1 + +ensure_wifi_on() { + if [ ! "$(wifi)" = "wifi = on" ]; then + wifi on + ip link set "$wifi_interface" up + fi +} + +print_usage() { + echo 'Available commands:' + echo ' eth_connect' + echo ' eth_disconnect' + echo ' wifi_scan' + echo ' wifi_connect_open SSID' + echo ' wifi_set_wpa SSID KEY' + echo ' wifi_connect_wep_ascii SSID KEY' + echo ' wifi_connect_wep_hex SSID KEY' + echo ' wifi_connect_wpa SSID KEY' + echo ' wifi_disconnect' +} + +if ! echo "${1}"; then + echo 'No command given.' + print_usage + exit 1 +elif [ "${1}" = 'eth_connect' ]; then + ip link set "$eth_interface" up + dhclient "$eth_interface" + +elif [ "${1}" = 'eth_disconnect' ]; then + ip link set "$eth_interface" down + +elif [ "${1}" = 'wifi_scan' ]; then + ensure_wifi_on + ip link set "$wifi_interface" up + iw dev "$wifi_interface" scan | grep SSID + +elif [ "${1}" = 'wifi_connect_open' ]; then + ensure_wifi_on + iw dev "$wifi_interface" connect "${2}" + #dhclient "$wifi_interface" + +elif [ "${1}" = 'wifi_connect_wep_ascii' ]; then + ensure_wifi_on + iw dev "$wifi_interface" connect "${2}" key 0:"${3}" + #dhclient "$wifi_interface" + +elif [ "${1}" = 'wifi_connect_wep_hex' ]; then + ensure_wifi_on + iw dev "$wifi_interface" connect "${2}" key d:0:"${3}" + #dhclient "$wifi_interface" + +elif [ "${1}" = 'wifi_connect_wpa' ]; then + ensure_wifi_on + wpa_passphrase "${2}" "${3}" > /tmp/wpa_supplicant.conf + wpa_supplicant -B -i "$wifi_interface" -c /tmp/wpa_supplicant.conf + dhclient "$wifi_interface" + +elif [ "${1}" = 'wifi_disconnect' ]; then + ip link set "$wifi_interface" down + +else + echo 'Unknown command.' + print_usage + exit 1 +fi