Skip to content

Commit

Permalink
Add installer for Mullvad VPN
Browse files Browse the repository at this point in the history
  • Loading branch information
iainelder committed Apr 19, 2024
1 parent 0bd34f5 commit 0f5ad32
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/mullvad-vpn.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Mullvad VPN
on:
push:
paths:
- programs/mullvad-vpn/install.bash
- .github/workflows/Mullvad VPN.yml
schedule:
# Not at the start of an hour or a day to decreate the chance of delay.
# See schedule documentation.
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule
- cron: "17 5 * * *"

workflow_dispatch:

jobs:
test_idempotent_installation:

strategy:
fail-fast: false
matrix:
os:
- "ubuntu:20.04"
- "ubuntu:22.04"

runs-on: ubuntu-latest
container:
image: "${{ matrix.os }}"

steps:

- name: Check out code
uses: actions/checkout@v4

- name: Prepare Docker
run: ./scripts/prepare_docker.bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Install Mullvad VPN
shell: su norm --command "bash --login {0}"
run: programs/mullvad-vpn/install.bash

- name: Install Mullvad VPN again (test idempotency)
shell: su norm --command "bash --login {0}"
run: programs/mullvad-vpn/install.bash
30 changes: 30 additions & 0 deletions programs/mullvad-vpn/install.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

# Name: Mullvad VPN
# https://mullvad.net/en/download/vpn/linux

set -euxo pipefail

cd "$(mktemp --dir)"

sudo apt-get update

# Installer dependencies
sudo apt-get --assume-yes install \
curl \
lsb-release

# Download the Mullvad signing key
sudo curl -fsSLo /usr/share/keyrings/mullvad-keyring.asc https://repository.mullvad.net/deb/mullvad-keyring.asc

arch=$( dpkg --print-architecture )
release=$(lsb_release -cs)

# Add the Mullvad repository server to apt
echo "deb [signed-by=/usr/share/keyrings/mullvad-keyring.asc arch=${arch}] https://repository.mullvad.net/deb/stable ${release} main" | sudo tee /etc/apt/sources.list.d/mullvad.list

# Install the package
sudo apt update
sudo apt install --assume-yes mullvad-vpn

mullvad --version

0 comments on commit 0f5ad32

Please sign in to comment.