Remove kernel version check on Raspbian

- Raspbian images have been shipping with kernel 5.10.17 since March 4.
    This kernel version has the WireGuard module built in which means we
    don't need to check if the user has updated, neither to install the
    module via DKMS.
This commit is contained in:
Orazio 2021-05-11 13:38:55 +02:00
parent 4a5804a24c
commit 82677135f8

View file

@ -1242,53 +1242,6 @@ installWireGuard(){
if [ "$PLAT" = "Raspbian" ]; then if [ "$PLAT" = "Raspbian" ]; then
# If the running kernel is older than the kernel from the repo, dkms will
# install the module for the newer kernel therefore WireGuard will not start.
# Telling the user to update the whole system is probably the easiest way to
# handle this situation.
# This issue is very common for users that flash Raspbian and install PiVPN
# straight, so it's also a good suggestion in such case because they will have
# a lot of outdated packages.
INSTALLED_KERNEL="$(apt-cache policy raspberrypi-kernel | grep -m1 'Installed: ' | grep -v '(none)' | awk '{print $2}')"
CANDIDATE_KERNEL="$(apt-cache policy raspberrypi-kernel | grep -m1 'Candidate: ' | grep -v '(none)' | awk '{print $2}')"
if dpkg --compare-versions "${CANDIDATE_KERNEL}" gt "${INSTALLED_KERNEL}"; then
if [ "${runUnattended}" = 'true' ]; then
echo "::: Installing WireGuard requires the latest kernel. Please upgrade all packages, reboot and run the script again."
echo "::: Commands:"
echo "::: sudo apt-get upgrade -y"
echo "::: sudo shutdown -r now"
echo "::: curl -L https://install.pivpn.io | bash"
exit 1
else
if (whiptail --title "Install WireGuard" --yesno "Your Raspberry Pi is running kernel package ${INSTALLED_KERNEL}, however the latest version is ${CANDIDATE_KERNEL}.\n\nInstalling WireGuard requires the latest kernel, so to continue, first you need to upgrade all packages, then reboot, and then run the script again.\n\nProceed to the upgrade?" ${r} ${c}); then
if [ "${runUnattended}" = 'true' ]; then
$SUDO ${PKG_MANAGER} upgrade -y
else
if command -v debconf-apt-progress &> /dev/null; then
# shellcheck disable=SC2086
$SUDO debconf-apt-progress -- ${PKG_MANAGER} upgrade -y
else
$SUDO ${PKG_MANAGER} upgrade -y
fi
fi
if (whiptail --title "Reboot" --yesno "You need to reboot after upgrading to run the new kernel.\n\nWould you like to reboot now?" ${r} ${c}); then
whiptail --title "Rebooting" --msgbox "The system will now reboot.\n\nWhen you come back, just run the installation command again:\n\n curl -L https://install.pivpn.io | bash" ${r} ${c}
printf "\\nRebooting system...\\n"
$SUDO sleep 3
$SUDO shutdown -r now
else
exit 1
fi
else
echo "::: Can't continue without upgrading the system first, exiting..."
exit 1
fi
fi
fi
echo "::: Installing WireGuard from Debian package... " echo "::: Installing WireGuard from Debian package... "
if [ -z "$AVAILABLE_WIREGUARD" ]; then if [ -z "$AVAILABLE_WIREGUARD" ]; then
@ -1306,11 +1259,6 @@ installWireGuard(){
# qrencode is used to generate qrcodes from config file, for use with mobile clients # qrencode is used to generate qrcodes from config file, for use with mobile clients
PIVPN_DEPS=(wireguard-tools qrencode) PIVPN_DEPS=(wireguard-tools qrencode)
if [ "$WIREGUARD_BUILTIN" -eq 0 ]; then
# Explicitly install the module if not built-in
PIVPN_DEPS+=(raspberrypi-kernel-headers wireguard-dkms)
fi
installDependentPackages PIVPN_DEPS[@] installDependentPackages PIVPN_DEPS[@]
elif [ "$PLAT" = "Debian" ]; then elif [ "$PLAT" = "Debian" ]; then