test for existing prior to restarting NetworkManager; include sleep after restart for devices which reset WiFi connection on restart
This commit is contained in:
parent
e2a66e35d3
commit
845b533ed5
1 changed files with 29 additions and 13 deletions
42
installer.sh
Normal file → Executable file
42
installer.sh
Normal file → Executable file
|
@ -95,25 +95,41 @@ if [[ "$(sysctl --values kernel.dmesg_restrict)" != "0" ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create config for NetworkManager
|
# Create config for NetworkManager
|
||||||
info "Creating NetworkManager configuration"
|
tmp=$(mktemp)
|
||||||
curl -sL "${URL_NM_CONF}" > "${FILE_NM_CONF}"
|
curl -sL "${URL_NM_CONF}" -o ${tmp}
|
||||||
if [ ! -f "$FILE_NM_CONNECTION" ]; then
|
if [ $(diff ${tmp} ${FILE_NM_CONF} | wc -c) -gt 0 ]; then
|
||||||
|
info "Creating NetworkManager configuration"
|
||||||
|
mv -f ${tmp} "${FILE_NM_CONF}"
|
||||||
|
if [ ! -f "$FILE_NM_CONNECTION" ]; then
|
||||||
curl -sL "${URL_NM_CONNECTION}" > "${FILE_NM_CONNECTION}"
|
curl -sL "${URL_NM_CONNECTION}" > "${FILE_NM_CONNECTION}"
|
||||||
|
fi
|
||||||
|
nmrestart='true'
|
||||||
fi
|
fi
|
||||||
|
rm -f ${tmp}
|
||||||
|
|
||||||
warn "Changes are needed to the /etc/network/interfaces file"
|
tmp=$(mktemp)
|
||||||
info "If you have modified the network on the host manualy, those can now be overwritten"
|
curl -sL "${URL_INTERFACES}" -o ${tmp}
|
||||||
info "If you do not overwrite this now you need to manually adjust it later"
|
if [ $(diff ${tmp} ${FILE_INTERFACES} | wc -c) -gt 0 ]; then
|
||||||
info "Do you want to proceed with overwriting the /etc/network/interfaces file? [N/y] "
|
warn "Changes are needed to the /etc/network/interfaces file"
|
||||||
read answer < /dev/tty
|
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 < /dev/tty
|
||||||
|
|
||||||
if [[ "$answer" =~ "y" ]] || [[ "$answer" =~ "Y" ]]; then
|
if [[ "$answer" =~ "y" ]] || [[ "$answer" =~ "Y" ]]; then
|
||||||
info "Replacing /etc/network/interfaces"
|
info "Replacing /etc/network/interfaces"
|
||||||
curl -sL "${URL_INTERFACES}" > "${FILE_INTERFACES}";
|
mv -f ${tmp} "${FILE_INTERFACES}"
|
||||||
|
nmrestart='true'
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
rm -f ${tmp}
|
||||||
|
|
||||||
info "Restarting NetworkManager"
|
if [ "${nmrestart:-false}" = 'true' ]; then
|
||||||
systemctl restart "${SERVICE_NM}"
|
info "Restarting NetworkManager"
|
||||||
|
systemctl restart "${SERVICE_NM}"
|
||||||
|
info "Sleeping for five (5) seconds"
|
||||||
|
sleep 5
|
||||||
|
fi
|
||||||
|
|
||||||
# Parse command line parameters
|
# Parse command line parameters
|
||||||
while [[ $# -gt 0 ]]; do
|
while [[ $# -gt 0 ]]; do
|
||||||
|
@ -193,7 +209,7 @@ if [ ! -d "$DATA_SHARE" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Read infos from web
|
# Read infos from web
|
||||||
HASSIO_VERSION=$(curl -s $URL_VERSION | jq -e -r '.supervisor')
|
HASSIO_VERSION=$(curl -sL $URL_VERSION | jq -e -r '.supervisor')
|
||||||
|
|
||||||
##
|
##
|
||||||
# Write configuration
|
# Write configuration
|
||||||
|
|
Loading…
Reference in a new issue