Skip to content

Commit

Permalink
Create nym-repo-setup debian package and nym-vpn meta package (#4837)
Browse files Browse the repository at this point in the history
* Create nym-repo-setup

* update

* Add postrm

* Add README

* Add Makefile

* Move to subdir

* Bundle the list file instead

* Create nym-vpn metapackage

* Rename top-level dir

* Set version of meta package to 0.1

* Add dpkg-name

* Create workflow for creating the debs

* Restrict to amd64 only

* Rename to build-deb-meta.yml

* name to upload-artifact

* Set names

* typo

* Extend version and set amd64 only

* Bump to 1.0.1
  • Loading branch information
octol authored Sep 9, 2024
1 parent f884331 commit dd70192
Show file tree
Hide file tree
Showing 9 changed files with 109 additions and 1 deletion.
32 changes: 31 additions & 1 deletion .github/workflows/build-deb-meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,35 @@ on:

jobs:
build:
runs-on: arc-ubuntu-22.04

steps:
run: "echo hello"
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up Build Environment
run: sudo apt-get update && sudo apt-get install -y make dpkg-dev

- name: Build Debian Packages
working-directory: ppa/packages
run: make

- name: Find .deb files
working-directory: ppa/packages
run: |
echo "file1=$(ls nym-repo-setup*.deb)" >> $GITHUB_ENV
echo "file2=$(ls nym-vpn*.deb)" >> $GITHUB_ENV
- name: Upload nym-repo-setup
uses: actions/upload-artifact@v4
with:
name: ${{ env.file1 }}
path: ppa/packages/nym-repo-setup*.deb
retention-days: 10

- name: Upload nym-vpn
uses: actions/upload-artifact@v4
with:
name: ${{ env.file2 }}
path: ppa/packages/nym-vpn*.deb
retention-days: 10
22 changes: 22 additions & 0 deletions ppa/packages/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
all: deb

REPO_DEB=nym-repo-setup.deb
REPO_SRC=nym-repo-setup

META_DEB=nym-vpn.deb
META_SRC=nym-vpn

ALL_DEB=$(REPO_DEB) $(META_DEB)

deb: $(ALL_DEB)

$(REPO_DEB):
dpkg-deb --build $(REPO_SRC) $(REPO_DEB)
dpkg-name -o $(REPO_DEB)

$(META_DEB):
dpkg-deb --build $(META_SRC) $(META_DEB)
dpkg-name -o $(META_DEB)

clean:
rm $(ALL_DEB)
13 changes: 13 additions & 0 deletions ppa/packages/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Nym deb meta packages

## Nymtech repo setup

`nym-repo-setup.deb` is a debian package that sets up the nymtech debian repo by copying the keyring file and adding `nymtech.list` to `/etc/apt/sources.list.d`.

## Nym VPN meta package

A basic meta package which only purpose is to depend on the daemon and UI.

# Build

They can all be built by running `make`.
9 changes: 9 additions & 0 deletions ppa/packages/nym-repo-setup/DEBIAN/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Package: nym-repo-setup
Version: 1.0.1
Section: base
Priority: optional
Architecture: amd64
Depends: apt (>= 1.0.0)
Maintainer: Nym Technologies SA <[email protected]>
Description: Setup script to add the Nym repository
This package adds the Nym repository and installs the GPG key for verifying package signatures.
4 changes: 4 additions & 0 deletions ppa/packages/nym-repo-setup/DEBIAN/postinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

# Updating package list
apt-get update
18 changes: 18 additions & 0 deletions ppa/packages/nym-repo-setup/DEBIAN/preinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

# Path to the repository list file
REPO_LIST_FILE="/etc/apt/sources.list.d/nymtech.list"

# Check if the repository list file already exists
if [ -f "$REPO_LIST_FILE" ]; then
# Generate a backup file name with a timestamp
TIMESTAMP=$(date +%Y%m%d%H%M%S)
BACKUP_FILE="/etc/apt/sources.list.d/nymtech.list.${TIMESTAMP}.bak"

# Rename the existing list file to the backup file
echo "Backing up existing nymtech.list to $BACKUP_FILE"
mv "$REPO_LIST_FILE" "$BACKUP_FILE"
fi

# Continue with the installation
exit 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# This file is provided by the nym-repo-setup package

deb [arch=amd64 signed-by=/usr/share/keyrings/nymtech.gpg] https://apt.nymtech.net/ jammy main
Binary file not shown.
9 changes: 9 additions & 0 deletions ppa/packages/nym-vpn/DEBIAN/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Package: nym-vpn
Version: 0.1.0
Section: metapackages
Priority: optional
Architecture: amd64
Depends: nym-vpnd, nymvpn-x
Maintainer: Nym Technologies SA <[email protected]>
Description: Nym Metapackage
This is a metapackage that depends on nym-vpnd and nymvpn-x. Installing this package will also install both nym-vpnd and nymvpn-x.

0 comments on commit dd70192

Please sign in to comment.