Skip to content

Commit

Permalink
Fix reading in old_hostname in update_hostname function (dale3h#10)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
marduv authored and dale3h committed May 28, 2018
1 parent bc4d4fa commit 1945719
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion hassio_rpi3bp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
# ------------------------------------------------------------------------------
Expand All @@ -88,6 +100,7 @@ main() {
# Install ALL THE THINGS!
update_hostname
install_requirements
config_network_manager
install_docker
install_hassio

Expand Down

0 comments on commit 1945719

Please sign in to comment.