From 1945719f86928ddcce147d26f0f25e2d8dc40e26 Mon Sep 17 00:00:00 2001 From: Marius Duvsethe Date: Mon, 28 May 2018 05:38:40 +0200 Subject: [PATCH] Fix reading in old_hostname in update_hostname function (#10) * Fix reading in old_hostname in update_hostname function * Added network-manager config to disable random MAC-address on WiFi connection * Use just one redirects to update network-manager config --- hassio_rpi3bp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/hassio_rpi3bp b/hassio_rpi3bp index dcbd6a1..297ba29 100644 --- a/hassio_rpi3bp +++ b/hassio_rpi3bp @@ -37,7 +37,7 @@ readonly REQUIREMENTS=( # Ensures the hostname of the Pi is correct. # ------------------------------------------------------------------------------ update_hostname() { - old_hostname=<(/etc/hostname) + old_hostname=$(< /etc/hostname) if [[ "${old_hostname}" != "${HOSTNAME}" ]]; then sed -i "s/${old_hostname}/${HOSTNAME}/g" /etc/hostname sed -i "s/${old_hostname}/${HOSTNAME}/g" /etc/hosts @@ -73,6 +73,18 @@ install_hassio() { curl -sL "${HASSIO_INSTALLER}" | bash -s -- -m raspberrypi3 } +# ------------------------------------------------------------------------------ +# Configure network-manager to disable random MAC-address on Wi-Fi +# ------------------------------------------------------------------------------ +config_network_manager() { + { + echo -e "\n[device]"; + echo "wifi.scan-rand-mac-address=no"; + echo -e "\n[connection]"; + echo "wifi.clone-mac-address=preserve"; + } >> "/etc/NetworkManager/NetworkManager.conf" +} + # ============================================================================== # RUN LOGIC # ------------------------------------------------------------------------------ @@ -88,6 +100,7 @@ main() { # Install ALL THE THINGS! update_hostname install_requirements + config_network_manager install_docker install_hassio