diff --git a/installers/common.sh b/installers/common.sh index 238c3bf4..fe36303a 100755 --- a/installers/common.sh +++ b/installers/common.sh @@ -350,27 +350,15 @@ function _prompt_install_wireguard() { # Install Wireguard from the Debian unstable distro function _install_wireguard() { _install_log "Configure WireGuard support" - if [ "$OS" == "Raspbian" ]; then - echo "Installing raspberrypi-kernel-headers" - sudo apt-get install $apt_option raspberrypi-kernel-headers || _install_status 1 "Unable to install raspberrypi-kernel-headers" + if [ "$OS" == "Debian" ]; then + echo 'deb http://ftp.debian.org/debian buster-backports main' | sudo tee /etc/apt/sources.list.d/buster-backports.list || _install_status 1 "Unable to add Debian backports repo" fi - echo "Installing WireGuard from Debian unstable distro" - echo "Adding Debian distro" - echo "deb http://deb.debian.org/debian/ unstable main" | sudo tee --append /etc/apt/sources.list.d/unstable.list || _install_status 1 "Unable to append to sources.list" - sudo apt-get install dirmngr || _install_status 1 "Unable to install dirmngr" - echo "Adding Debian distro keys" - sudo wget -q -O - https://ftp-master.debian.org/keys/archive-key-$(lsb_release -sr).asc | sudo apt-key add - || _install_status 1 "Unable to add keys" - printf 'Package: *\nPin: release a=unstable\nPin-Priority: 150\n' | sudo tee --append /etc/apt/preferences.d/limit-unstable || _install_status 1 "Unable to append to preferences.d" - echo "Installing WireGuard" + echo "Installing wireguard from apt" sudo apt-get update && sudo apt-get install $apt_option wireguard || _install_status 1 "Unable to install wireguard" echo "Enabling wg-quick@wg0" sudo systemctl enable wg-quick@wg0 || _install_status 1 "Failed to enable wg-quick service" echo "Enabling WireGuard management option" - if grep -q 'RASPI_WIREGUARD_ENABLED' "$webroot_dir/includes/config.php"; then - sudo sed -i "s/\('RASPI_WIREGUARD_ENABLED', \)false/\1true/g" "$webroot_dir/includes/config.php" || _install_status 1 "Unable to modify config.php" - else - sudo sed -i "/define('RASPI_OPENVPN_ENABLED', true);/a define('RASPI_WIREGUARD_ENABLED', true);" "$webroot_dir/includes/config.php" || _install_status 1 "Unable to modify config.php" - fi + sudo sed -i "s/\('RASPI_WIREGUARD_ENABLED', \)false/\1true/g" "$webroot_dir/includes/config.php" || _install_status 1 "Unable to modify config.php" _install_status 0 }