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
24
installer.sh
Normal file → Executable file
24
installer.sh
Normal file → Executable file
|
@ -95,25 +95,41 @@ if [[ "$(sysctl --values kernel.dmesg_restrict)" != "0" ]]; then
|
|||
fi
|
||||
|
||||
# Create config for NetworkManager
|
||||
tmp=$(mktemp)
|
||||
curl -sL "${URL_NM_CONF}" -o ${tmp}
|
||||
if [ $(diff ${tmp} ${FILE_NM_CONF} | wc -c) -gt 0 ]; then
|
||||
info "Creating NetworkManager configuration"
|
||||
curl -sL "${URL_NM_CONF}" > "${FILE_NM_CONF}"
|
||||
mv -f ${tmp} "${FILE_NM_CONF}"
|
||||
if [ ! -f "$FILE_NM_CONNECTION" ]; then
|
||||
curl -sL "${URL_NM_CONNECTION}" > "${FILE_NM_CONNECTION}"
|
||||
fi
|
||||
nmrestart='true'
|
||||
fi
|
||||
rm -f ${tmp}
|
||||
|
||||
tmp=$(mktemp)
|
||||
curl -sL "${URL_INTERFACES}" -o ${tmp}
|
||||
if [ $(diff ${tmp} ${FILE_INTERFACES} | wc -c) -gt 0 ]; then
|
||||
warn "Changes are 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 overwriting the /etc/network/interfaces file? [N/y] "
|
||||
info "Do you want to proceed with that? [N/y] "
|
||||
read answer < /dev/tty
|
||||
|
||||
if [[ "$answer" =~ "y" ]] || [[ "$answer" =~ "Y" ]]; then
|
||||
info "Replacing /etc/network/interfaces"
|
||||
curl -sL "${URL_INTERFACES}" > "${FILE_INTERFACES}";
|
||||
mv -f ${tmp} "${FILE_INTERFACES}"
|
||||
nmrestart='true'
|
||||
fi
|
||||
fi
|
||||
rm -f ${tmp}
|
||||
|
||||
if [ "${nmrestart:-false}" = 'true' ]; then
|
||||
info "Restarting NetworkManager"
|
||||
systemctl restart "${SERVICE_NM}"
|
||||
info "Sleeping for five (5) seconds"
|
||||
sleep 5
|
||||
fi
|
||||
|
||||
# Parse command line parameters
|
||||
while [[ $# -gt 0 ]]; do
|
||||
|
@ -193,7 +209,7 @@ if [ ! -d "$DATA_SHARE" ]; then
|
|||
fi
|
||||
|
||||
# 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
|
||||
|
|
Loading…
Reference in a new issue