Skip to content

Commit

Permalink
Fix snapcraft to build for multiarch
Browse files Browse the repository at this point in the history
Signed-off-by: keliramu <ramunas.keliuotis@nordsec.com>
  • Loading branch information
keliramu committed May 13, 2024
1 parent 43ade03 commit dea760e
Show file tree
Hide file tree
Showing 5 changed files with 826 additions and 8 deletions.
22 changes: 14 additions & 8 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
name: nordvpn
title: NordVPN
base: core22
# NOTE: Snapcraft doesn't support armel.
architectures:
- build-on: [amd64]
build-for: [amd64]
- build-on: [amd64]
build-for: [arm64]
- build-on: [amd64]
build-for: [i386]
- build-on: [amd64]
build-for: [armhf]

website: https://nordvpn.com
license: GPL-3.0
Expand Down Expand Up @@ -105,9 +115,8 @@ parts:
source:
- on i386: ./bin/i386
- on amd64: ./bin/amd64
- on armel: ./bin/armel
- on armhf: ./bin/armhf
- on aarch64: ./bin/aarch64
- on arm64: ./bin/aarch64
stage-packages:
- wireguard-tools
- libxml2
Expand All @@ -125,9 +134,8 @@ parts:
source:
- on i386: ./bin/i386
- on amd64: ./bin/amd64
- on armel: ./bin/armel
- on armhf: ./bin/armhf
- on aarch64: ./bin/aarch64
- on arm64: ./bin/aarch64
organize:
nordfileshare: usr/bin/nordfileshare
stage:
Expand All @@ -139,9 +147,8 @@ parts:
source:
- on i386: ./bin/i386
- on amd64: ./bin/amd64
- on armel: ./bin/armel
- on armhf: ./bin/armhf
- on aarch64: ./bin/aarch64
- on arm64: ./bin/aarch64
organize:
norduserd: usr/bin/norduserd
stage:
Expand All @@ -153,9 +160,8 @@ parts:
source:
- on i386: ./bin/deps/openvpn/i386/latest/
- on amd64: ./bin/deps/openvpn/amd64/latest/
- on armel: ./bin/deps/openvpn/armel/latest/
- on armhf: ./bin/deps/openvpn/armhf/latest/
- on aarch64: ./bin/deps/openvpn/aarch64/latest/
- on arm64: ./bin/deps/openvpn/aarch64/latest/
organize:
openvpn: var/lib/nordvpn/openvpn
stage:
Expand Down
203 changes: 203 additions & 0 deletions snap/snapcraft.yaml.amd64
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
name: nordvpn
title: NordVPN
base: core22
# NOTE: Snapcraft doesn't support armel.
architectures:
- build-on: [amd64]
build-for: [amd64]

website: https://nordvpn.com
license: GPL-3.0
contact: support@nordvpn.com
source-code: https://github.com/NordSecurity/nordvpn-linux

icon: assets/icon.svg
summary: Shield your online activity and browse privately with the world's leading VPN
description: |
Take your online security to the next level with one of the fastest VPNs for Linux. Whether
you're working from home or browsing over your hotel's Wi-Fi, explore the internet with peace of
mind.

* **Secure connection.** Without encryption, your online traffic is vulnerable. NordVPN encrypts
your connection to stop malicious actors from potentially stealing data.
* **URL scanner.** Never visit dangerous sites by accident (such as through phishing links). Once
turned on, Threat Protection Lite will block access to known malicious pages.
* **Kill Switch.** Prevent leaks when you unexpectedly lose connection to NordVPN. Kill Switch
automatically cuts off online access until your VPN connection is restored.
* **Specialty servers.** Get even more security from our Double VPN servers. Access the Tor
network without the Tor browser thanks to Onion Over VPN.

**More privacy**

* **Private online activity.** Unencrypted online traffic may be observed by others, including
your ISP. Using NordVPN shields your online activity from prying eyes.
* **New virtual location.** Connect to a VPN server to use its IP address — and thus virtual
location. NordVPN offers 6,000+ VPN servers in over 90 locations.
* **Censorship bypass.** Connecting to NordVPN servers lets you avoid many common censorship
measures. Privately experience the internet as it was meant to be.
* **Privacy-friendly practices.** NordVPN operates under a strict no-logs policy. Our practices
have been independently audited four times — we do not log your activity.

**More convenience**

* **SmartPlay.** Safely stream your favorite content from home with no extra steps. Thanks to
NordVPN's SmartPlay, simply connect to a VPN server in your country and enjoy.
* **Ad blocker.** Browse the web without ads getting in your way. Turn on our Threat Protection
Lite feature for Linux to block ads before they load.
* **Meshnet.** Join up to 60 devices together to create an encrypted private network for secure
file sharing, project collaboration, and LAN gaming.
* **Optimized for speed.** All VPNs slow you down — but with NordVPN's infrastructure and
revolutionary NordLynx protocol (based on WireGuard), you won't notice it.
* **24/7 support.** Our friendly customer support team is ready to help you at any time. We also
have detailed guides covering every NordVPN function in our Help Center.

adopt-info: nordvpn
confinement: strict

apps:
nordvpn:
command: bin/nordvpn
autostart: nordvpn.desktop
environment:
PREFIX_COMMON: $SNAP_COMMON
PREFIX_DATA: $SNAP_DATA
PREFIX_STATIC: $SNAP
plugs:
- home
- network
- network-bind
- desktop-legacy
- desktop
completer: usr/share/bash-completion/completions/nordvpn
# Snap does not support zsh autocompletions. In order to enable them, after installing snap,
# execute:
#
# sudo ln -s /snap/nordvpn/current/usr/share/zsh/functions/Completion/Unix/_nordvpn_auto_complete /usr/share/zsh/functions/Completion/Unix/_nordvpn_auto_complete
# compinit
#
desktop: usr/share/applications/nordvpn.desktop
nordvpnd:
command: bin/nordvpnd
daemon: simple
environment:
PREFIX_COMMON: $SNAP_COMMON
PREFIX_DATA: $SNAP_DATA
PREFIX_STATIC: $SNAP
plugs:
- network
- network-bind
- network-control
- network-observe
- firewall-control
parts:
nordvpn:
plugin: nil
source-type: local
source: .
override-build: |
# When it is executed in git submodule and contents of `.` are copied to
# `./parts/nordvpn/build`, .git file points to the invalid host repository
sed -i 's/\.\./..\/..\/..\/../g' .git || true
WORKDIR=$(pwd) source ./ci/env.sh
sed -i 's\VERSION\'"${VERSION}"'\g' contrib/snap/appdata.xml
cp contrib/snap/appdata.xml ${SNAPCRAFT_PART_BUILD}/com.nordsec.nordvpn.appdata.xml
parse-info: [com.nordsec.nordvpn.appdata.xml]

nordvpn-bin:
plugin: dump
source-type: local
source: ./bin/amd64
stage-packages:
- wireguard-tools
- libxml2
- e2fsprogs
organize:
nordvpn: bin/nordvpn
nordvpnd: bin/nordvpnd
stage:
- bin/*
- usr/*

nordfileshare:
plugin: dump
source-type: local
source: ./bin/amd64
organize:
nordfileshare: usr/bin/nordfileshare
stage:
- usr/bin/nordfileshare

norduser:
plugin: dump
source-type: local
source: ./bin/amd64
organize:
norduserd: usr/bin/norduserd
stage:
- usr/bin/norduserd

openvpn-bin:
plugin: dump
source-type: local
source: ./bin/deps/openvpn/amd64/latest/
organize:
openvpn: var/lib/nordvpn/openvpn
stage:
- var/lib/nordvpn/openvpn

autocomplete:
plugin: dump
source-type: local
source: dist/autocomplete
organize:
bash_autocomplete: usr/share/bash-completion/completions/nordvpn
zsh_autocomplete: usr/share/zsh/functions/Completion/Unix/_nordvpn_auto_complete

data:
plugin: dump
source-type: local
source: dist/data
organize:
countries.dat: var/lib/nordvpn/data/countries.dat
ovpn_template.xslt: var/lib/nordvpn/data/ovpn_template.xslt
ovpn_xor_template.xslt: var/lib/nordvpn/data/ovpn_xor_template.xslt
servers.dat: var/lib/nordvpn/data/servers.dat
stage:
- var/lib/nordvpn/data/*

desktop:
plugin: dump
source-type: local
source: contrib/desktop
override-build: |
sed -i 's\Icon=nordvpn\Icon=${SNAP}/meta/icon.svg\g' nordvpn.desktop
cp nordvpn.desktop ${SNAPCRAFT_PART_INSTALL}/nordvpn.desktop
organize:
nordvpn.desktop: usr/share/applications/nordvpn.desktop

# Contents of this part are not affecting the functionality in any way but they are here for
# convenience
dist:
plugin: dump
source-type: local
source: dist
organize:
THIRD-PARTY-NOTICES.md: usr/share/licenses/nordvpn/THIRD-PARTY-NOTICES.md
# Snap does not support manpages. In order to enable them, after installing snap, execute:
#
# sudo ln -s /snap/nordvpn/current/usr/share/man/man1/nordvpn.1.gz /usr/share/man/man1/nordvpn.1.gz
#
nordvpn.1.gz: usr/share/man/man1/nordvpn.1.gz
changelog.yml: usr/share/doc/nordvpn/changelog.yml
stage:
- usr/share/*

assets:
plugin: dump
source-type: local
source: assets
organize:
icon.svg: usr/share/icons/hicolor/scalable/apps/nordvpn.svg
tray-blue.svg: usr/share/icons/hicolor/scalable/apps/nordvpn-tray-blue.svg
tray-black.svg: usr/share/icons/hicolor/scalable/apps/nordvpn-tray-black.svg
tray-white.svg: usr/share/icons/hicolor/scalable/apps/nordvpn-tray-white.svg

0 comments on commit dea760e

Please sign in to comment.