From 5722b29988255aea03715ff24b0d1a9688e3db37 Mon Sep 17 00:00:00 2001
From: Andri Joos <andri@joos.io>
Date: Fri, 13 Sep 2024 20:41:37 +0200
Subject: [PATCH] add protonvpn

---
 install.sh           |  4 ++++
 install_functions.sh | 13 +++++++++++++
 options.sh           |  3 +++
 3 files changed, 20 insertions(+)

diff --git a/install.sh b/install.sh
index 199e418..0c22e41 100644
--- a/install.sh
+++ b/install.sh
@@ -46,6 +46,7 @@ $dconf_editor_key "$dconf_editor_label" $dconf_editor_enabled \
 $openssh_server_key "$openssh_server_label" $openssh_server_enabled \
 $openconnect_key "$openconnect_label" $openconnect_enabled \
 $swap_key "$swap_label" $swap_enabled \
+$protonvpn_key "$protonvpn_label" $protonvpn_enabled \
 3>&1 1>&2 2>&3)
 IFS=' ' read -a selected_options <<< $selected_tags
 
@@ -171,6 +172,9 @@ do
     elif [ $option = $openconnect_key ]
     then
         install_openconnect
+    elif [ $option = $protonvpn_key ]
+    then
+        install_protonvpn
     elif [ $option = $swap_key ]
     then
         setup_swap
diff --git a/install_functions.sh b/install_functions.sh
index aa50d84..00159f6 100644
--- a/install_functions.sh
+++ b/install_functions.sh
@@ -332,3 +332,16 @@ install_openssh_server() {
 install_openconnect() {
     $apt_install_cmd openconnect network-manager-openconnect network-manager-openconnect-gnome
 }
+
+install_protonvpn() {
+    firefox --new-window https://protonvpn.com/support/official-linux-vpn-ubuntu
+    read -p "latest repo version (e.g. 1.0.4) " proton_repo_version
+    repo_installer_file="$downloads_path/proton_repo.deb"
+    wget https://repo.protonvpn.com/debian/dists/stable/main/binary-all/protonvpn-stable-release_${proton_repo_version}_all.deb -O $repo_installer_file
+    sudo dpkg -i $repo_installer_file
+
+    $apt_update_cmd
+    $apt_install_cmd proton-vpn-gnome-desktop
+
+    make_autostart_entry proton-vpn "proton vpn" "protonvpn-app"
+}
diff --git a/options.sh b/options.sh
index a2bf19d..cc4e2d4 100644
--- a/options.sh
+++ b/options.sh
@@ -42,6 +42,7 @@ element_desktop_enabled=$checkbox_unchecked
 dconf_editor_enabled=$checkbox_unchecked
 openssh_server_enabled=$checkbox_unchecked
 openconnect_enabled=$checkbox_unchecked
+protonvpn_enabled=$checkbox_unchecked
 swap_enabled=$checkbox_unchecked
 
 # labels
@@ -84,6 +85,7 @@ element_desktop_key="element_desktop"
 dconf_editor_key="dconf_editor"
 openssh_server_key="openssh_server"
 openconnect_key="openconnect"
+protonvpn_key="proton_vpn"
 swap_key="swap"
 
 # show text
@@ -126,4 +128,5 @@ element_desktop_label="element desktop"
 dconf_editor_label="dconf-editor"
 openssh_server_label="openssh-server"
 openconnect_label="openconnect"
+protonvpn_label="proton-vpn"
 swap_label="swap"
-- 
GitLab