Skip to content

Commit

Permalink
Merge revamped linux pkgs from portmaster-linux-pkgs repo
Browse files Browse the repository at this point in the history
  • Loading branch information
dhaavi committed Dec 7, 2021
1 parent 0274bc7 commit b64735e
Show file tree
Hide file tree
Showing 48 changed files with 1,744 additions and 1,057 deletions.
22 changes: 0 additions & 22 deletions .github/workflows/linux-arch.yml

This file was deleted.

69 changes: 0 additions & 69 deletions .github/workflows/linux-deb.yml

This file was deleted.

190 changes: 190 additions & 0 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
name: Build, Lint and Test
on: push

jobs:
shellcheck:
name: Shellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
with:
ignore: templates tests

build:
name: Build artifacts
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Install nfpm@latest
run: curl -o /tmp/nfpm.tar.gz -sSL https://github.com/goreleaser/nfpm/releases/download/v2.7.1/nfpm_2.7.1_Linux_x86_64.tar.gz && cd /tmp && tar xf /tmp/nfpm.tar.gz && sudo mv nfpm /usr/local/bin && sudo chmod a+x /usr/local/bin/nfpm

- name: Install gomplate
run: sudo curl -o /usr/local/bin/gomplate -sSL https://github.com/hairyhenderson/gomplate/releases/download/v3.10.0/gomplate_linux-amd64 && sudo chmod +x /usr/local/bin/gomplate

- name: Build packages
run: make all

- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: portmaster-current
path: dist/*

- name: Build with next pkgrev
run: make clean && make increase-pkgrev && make all

- name: Upload artifacts with next pkgrev
uses: actions/upload-artifact@v2
with:
name: portmaster-next
path: dist/*

test-ubuntu:
name: Test DEB package (ubuntu VM)
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/download-artifact@v2
with:
name: portmaster-current

- name: Install tooling
run: sudo bash -c "apt-get update && apt-get install -y systemd desktop-file-utils"
env:
DEBIAN_FRONTEND: noninteractive

- name: Install dependencies
run: sudo apt-get install -y libnetfilter-queue1 ca-certificates
env:
DEBIAN_FRONTEND: noninteractive

- name: Install deb package
run: yes | sudo dpkg -i ./portmaster_*.deb

- uses: actions/checkout@v2
- name: Verify installation
run: ./tests/test-install.sh

- uses: actions/download-artifact@v2
with:
name: portmaster-next
path: ./next

- name: "Upgrade to next pkgrev"
run: yes | sudo dpkg -i ./next/portmaster_*.deb || ls -R

- name: Verify upgrade
run: ./tests/test-upgrade.sh

- name: Uninstall portmaster
run: sudo apt-get remove -y portmaster

- name: Verify uninstallation
run: ./tests/test-uninstall.sh

test-deb:
name: Test DEB package
runs-on: ubuntu-latest
strategy:
matrix:
container:
- hugojosefson/popos
- ubuntu:latest
- ubuntu:rolling
- ubuntu:xenial
- debian:stable
- debian:unstable
- debian:oldstable
- debian:testing
- linuxmintd/mint20-amd64
- linuxmintd/mint19-amd64
needs: build
steps:
- uses: actions/download-artifact@v2
with:
name: portmaster-current

- name: Install tooling
run: sudo bash -c "apt-get update && apt-get install -y systemd desktop-file-utils"
env:
DEBIAN_FRONTEND: noninteractive

- name: Install dependencies
run: sudo apt-get install -y libnetfilter-queue1 ca-certificates
env:
DEBIAN_FRONTEND: noninteractive

- name: Install deb package
run: yes | sudo dpkg -i ./portmaster_*.deb

- uses: actions/checkout@v2
- name: Verify installation
run: sudo ./tests/test-install.sh

- uses: actions/download-artifact@v2
with:
name: portmaster-next
path: ./next

- name: "Upgrade to next pkgrev"
run: yes | sudo dpkg -i ./next/portmaster_*.deb

- name: Verify upgrade
run: ./tests/test-upgrade.sh

- name: Uninstall portmaster
run: sudo apt-get remove -y portmaster

- name: Verify uninstallation
run: ./tests/test-uninstall.sh

test-rpm:
name: Test RPM package
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
container:
- fedora:32
- fedora:33
- fedora:34
- centos:7
- centos:8
container: ${{ matrix.container }}
steps:
- uses: actions/download-artifact@v2
with:
name: portmaster-current

- name: Install tooling
run: yum install -y systemd desktop-file-utils procps-ng

# we use yum localinstall instead of dnf install because
# not all tested distro versions have dnf available and those
# that have dnf have it aliased as yum.
- name: Install package
run: yum localinstall -y ./portmaster-*.rpm

- uses: actions/checkout@v2
- name: Verify installation
run: ./tests/test-install.sh

- uses: actions/download-artifact@v2
with:
name: portmaster-next
path: ./next

- name: "Upgrade to next pkgrev"
run: yum localinstall -y ./next/portmaster-*.rpm

- name: Verify upgrade
run: ./tests/test-upgrade.sh

- name: Uninstall portmaster
run: yum remove -y portmaster

- name: Verify uninstallation
run: ./tests/test-uninstall.sh
7 changes: 7 additions & 0 deletions linux/.chglog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
conventional-commits: false
deb:
distribution: []
urgency: ""
debug: false
owner: "Safing ICS Technologies GmbH"
package-name: "portmaster"
8 changes: 4 additions & 4 deletions linux/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/src
/portmaster.service
/pkg
/portmaster-*-x86_64.pkg.tar.xz
/portmaster-start
/scripts
/icons
/nfpm.yaml
/dist
59 changes: 59 additions & 0 deletions linux/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/usr/bin/make -f
STARTURL ?= https://updates.safing.io/latest/linux_amd64/start/portmaster-start\?CI
NFPM ?= nfpm

.PHONY: icons test-debian test-ubuntu nfpm.yaml

all: deb rpm

nfpm.yaml: portmaster-start
sed -e "s/^version:.*$$/version: v$(shell ./portmaster-start version --short)-$(shell cat ./pkgrev)/g" ./nfpm.yaml.template > ./nfpm.yaml

build: icons nfpm.yaml gen-scripts gen-pkgbuild

icons:
for res in 16 32 48 96 128 ; do \
mkdir -p icons/$${res}x$${res} ; \
convert ./portmaster_logo.png -resize "$${res}x$${res}" "icons/$${res}x$${res}/portmaster.png" ; \
done

portmaster-start:
curl --fail --user-agent GitHub -o portmaster-start $(STARTURL)
chmod +x ./portmaster-start

deb: distdir build
$(NFPM) package --packager deb -t dist

rpm: distdir build
$(NFPM) package --packager rpm -t dist

distdir:
mkdir -p ./dist

clean:
rm -r ./portmaster-start ./scripts ./dist icons/ PKGBUILD arch.install nfpm.yaml src pkg portmaster-bin-*.pkg.tar.xz|| true

test-debian: build deb
docker run -ti --rm -v $(shell pwd)/dist:/work -w /work debian:latest bash -c 'apt update && apt install -y ca-certificates && dpkg -i /work/portmaster*.deb ; bash'

test-ubuntu: build deb
docker run -ti --rm -v $(shell pwd)/dist:/work -w /work ubuntu:latest bash -c 'apt update && apt install -y ca-certificates && dpkg -i /work/portmaster*.deb ; bash'

increase-pkgrev:
bash -c 'rev=$$(cat pkgrev) ; ((rev++)) ; echo $${rev} > ./pkgrev'

reset-pkgrev:
echo 1 > ./pkgrev

gen-scripts:
mkdir -p ./scripts
for file in "rules" "preinstall.sh" "postinstall.sh" "preremove.sh" "postremove.sh"; do \
gomplate -f "templates/$${file}" > "./scripts/$${file}" ; \
done;

gen-pkgbuild: nfpm.yaml
gomplate -d "nfpm=./nfpm.yaml" -f templates/arch.install > arch.install
gomplate -d "nfpm=./nfpm.yaml" -f templates/PKGBUILD > PKGBUILD

lint:
shellcheck ./scripts/* ./arch.install
Loading

0 comments on commit b64735e

Please sign in to comment.