Fix static IP support on 64-bit Raspberry Pi OS.

This commit is contained in:
Orazio 2022-05-03 11:19:45 +02:00
parent c7bbb9fda2
commit bf7f3ae694

View file

@ -129,14 +129,15 @@ main(){
fi fi
chooseInterface chooseInterface
if [ "$PLAT" != "Raspbian" ]; then if checkStaticIpSupported; then
avoidStaticIPv4Ubuntu
else
getStaticIPv4Settings getStaticIPv4Settings
if [ -z "$dhcpReserv" ] || [ "$dhcpReserv" -ne 1 ]; then if [ -z "$dhcpReserv" ] || [ "$dhcpReserv" -ne 1 ]; then
setStaticIPv4 setStaticIPv4
fi fi
else
staticIpNotSupported
fi fi
chooseUser chooseUser
cloneOrUpdateRepos cloneOrUpdateRepos
# Install # Install
@ -453,8 +454,8 @@ preconfigurePackages(){
fi fi
fi fi
# We set static IP only on Raspbian # We set static IP only on Raspberry Pi OS
if [ "$PLAT" = "Raspbian" ]; then if checkStaticIpSupported; then
BASE_DEPS+=(dhcpcd5) BASE_DEPS+=(dhcpcd5)
fi fi
@ -724,14 +725,26 @@ if [ "$pivpnenableipv6" == "1" ]; then
fi fi
} }
avoidStaticIPv4Ubuntu() { checkStaticIpSupported(){
# Not really robust and correct, we should actually check for dhcpcd, not the distro, but works on Raspbian and Debian.
if [ "$PLAT" = "Raspbian" ]; then
return 0
# If we are on 'Debian' but the raspi.list file is present, then we actually are on 64-bit Raspberry Pi OS.
elif [ "$PLAT" = "Debian" ] && [ -s /etc/apt/sources.list.d/raspi.list ]; then
return 0
else
return 1
fi
}
staticIpNotSupported() {
if [ "${runUnattended}" = 'true' ]; then if [ "${runUnattended}" = 'true' ]; then
echo "::: Since we think you are not using Raspbian, we will not configure a static IP for you." echo "::: Since we think you are not using Raspberry Pi OS, we will not configure a static IP for you."
return return
fi fi
# If we are in Ubuntu then they need to have previously set their network, so just use what you have. # If we are in Ubuntu then they need to have previously set their network, so just use what you have.
whiptail --msgbox --backtitle "IP Information" --title "IP Information" "Since we think you are not using Raspbian, we will not configure a static IP for you. whiptail --msgbox --backtitle "IP Information" --title "IP Information" "Since we think you are not using Raspberry Pi OS, we will not configure a static IP for you.
If you are in Amazon then you can not configure a static IP anyway. Just ensure before this installer started you had set an elastic IP on your instance." ${r} ${c} If you are in Amazon then you can not configure a static IP anyway. Just ensure before this installer started you had set an elastic IP on your instance." ${r} ${c}
} }