Adds a default interfaces file

This commit is contained in:
Ludeeus 2020-10-13 17:21:39 +02:00
parent 08c17c3e93
commit 46626d95fa
2 changed files with 22 additions and 5 deletions

4
files/interfaces Normal file
View file

@ -0,0 +1,4 @@
source /etc/network/interfaces.d/*
auto lo
iface lo inet loopback

View file

@ -29,19 +29,21 @@ SERVICE_DOCKER="docker.service"
SERVICE_NM="NetworkManager.service"
FILE_DOCKER_CONF="/etc/docker/daemon.json"
FILE_INTERFACES="/etc/network/interfaces"
FILE_NM_CONF="/etc/NetworkManager/NetworkManager.conf"
FILE_NM_CONNECTION="/etc/NetworkManager/system-connections/default"
URL_RAW_BASE="https://raw.githubusercontent.com/home-assistant/supervised-installer/master/files"
URL_VERSION="https://version.home-assistant.io/stable.json"
URL_BIN_APPARMOR="${URL_RAW_BASE}/hassio-apparmor"
URL_BIN_HASSIO="${URL_RAW_BASE}/hassio-supervisor"
URL_DOCKER_DAEMON="${URL_RAW_BASE}/docker_daemon.json"
URL_HA="${URL_RAW_BASE}/ha"
URL_INTERFACES="${URL_RAW_BASE}/interfaces"
URL_NM_CONF="${URL_RAW_BASE}/NetworkManager.conf"
URL_NM_CONNECTION="${URL_RAW_BASE}/system-connection-default"
URL_HA="${URL_RAW_BASE}/ha"
URL_BIN_HASSIO="${URL_RAW_BASE}/hassio-supervisor"
URL_BIN_APPARMOR="${URL_RAW_BASE}/hassio-apparmor"
URL_SERVICE_HASSIO="${URL_RAW_BASE}/hassio-supervisor.service"
URL_SERVICE_APPARMOR="${URL_RAW_BASE}/hassio-apparmor.service"
URL_SERVICE_HASSIO="${URL_RAW_BASE}/hassio-supervisor.service"
URL_APPARMOR_PROFILE="https://version.home-assistant.io/apparmor.txt"
# Check env
@ -95,11 +97,22 @@ fi
# Create config for NetworkManager
info "Creating NetworkManager configuration"
rm -f /etc/network/interfaces
curl -sL "${URL_NM_CONF}" > "${FILE_NM_CONF}"
if [ ! -f "$FILE_NM_CONNECTION" ]; then
curl -sL "${URL_NM_CONNECTION}" > "${FILE_NM_CONNECTION}"
fi
warn "Changes is needed to the /etc/network/interfaces file"
info "If you have modified the network on the host manualy, those can now be overwritten"
info "If you do not overwrite this now you need to manually adjust it later"
info "Do you want to proceed with that? [N/y] "
read answer
if [[ "$answer" =~ "y" ]] || [[ "$answer" =~ "Y" ]]; then
info "Replacing /etc/network/interfaces"
curl -sL "${URL_INTERFACES}" > "${FILE_INTERFACES}";
fi
info "Restarting NetworkManager"
systemctl restart "${SERVICE_NM}"