Some snap code

snap
Dennis Schwerdel 2021-02-09 16:24:02 +01:00
parent ad2e2014eb
commit f22f30d1ce
3 changed files with 55 additions and 11 deletions

21
assets/snapcraft.yaml Normal file
View File

@ -0,0 +1,21 @@
name: vpncloud
version: 2.1.0
summary: Peer-to-peer VPN
description: |
VpnCloud is a high performance peer-to-peer mesh VPN over UDP supporting strong encryption,
NAT traversal and a simple configuration. It establishes a fully-meshed self-healing VPN
network in a peer-to-peer manner with strong end-to-end encryption based on elliptic curve
keys and AES-256. VpnCloud creates a virtual network interface on the host and forwards all
received data via UDP to the destination. It can work on TUN devices (IP based) and TAP
devices (Ethernet based).
confinement: devmode
parts:
vpncloud:
plugin: dump
source: vpncloud_${SNAPCRAFT_PROJECT_VERSION}_amd64.deb
apps:
vpncloud:
command: usr/bin/vpncloud

3
builder/Dockerfile-snap Normal file
View File

@ -0,0 +1,3 @@
FROM snapcore/snapcraft:stable
RUN useradd -ms /bin/bash user

View File

@ -24,7 +24,7 @@ else
RPM_VERSION="$VERSION-1"
fi
mkdir -p cache/{rpm,deb}
mkdir -p cache/{rpm,deb,snap}
CACHE=$(pwd)/cache
mkdir -p ../dist
@ -32,24 +32,44 @@ mkdir -p ../dist
docker build --rm -f=Dockerfile-deb -t vpncloud-builder-deb .
# x86_64 deb
docker_cmd deb 'cd code && cargo deb'
cp $CACHE/deb/target/debian/vpncloud_${DEB_VERSION}_amd64.deb ../dist/vpncloud_${DEB_VERSION}_amd64.deb
if ! [ -f ../dist/vpncloud_${DEB_VERSION}_amd64.deb ]; then
docker_cmd deb 'cd code && cargo deb'
cp $CACHE/deb/target/debian/vpncloud_${DEB_VERSION}_amd64.deb ../dist/vpncloud_${DEB_VERSION}_amd64.deb
fi
# i386 deb
docker_cmd deb 'cd code && cargo deb --target i686-unknown-linux-gnu'
cp $CACHE/deb/target/i686-unknown-linux-gnu/debian/vpncloud_${DEB_VERSION}_i386.deb ../dist/vpncloud_${DEB_VERSION}_i386.deb
if ! [ -f ../dist/vpncloud_${DEB_VERSION}_i386.deb ]; then
docker_cmd deb 'cd code && cargo deb --target i686-unknown-linux-gnu'
cp $CACHE/deb/target/i686-unknown-linux-gnu/debian/vpncloud_${DEB_VERSION}_i386.deb ../dist/vpncloud_${DEB_VERSION}_i386.deb
fi
# arm7hf deb
docker_cmd deb 'cd code && cargo deb --target armv7-unknown-linux-gnueabihf'
cp $CACHE/deb/target/armv7-unknown-linux-gnueabihf/debian/vpncloud_${DEB_VERSION}_armhf.deb ../dist/vpncloud_${DEB_VERSION}_armhf.deb
if ! [ -f ../dist/vpncloud_${DEB_VERSION}_armhf.deb ]; then
docker_cmd deb 'cd code && cargo deb --target armv7-unknown-linux-gnueabihf'
cp $CACHE/deb/target/armv7-unknown-linux-gnueabihf/debian/vpncloud_${DEB_VERSION}_armhf.deb ../dist/vpncloud_${DEB_VERSION}_armhf.deb
fi
# aarch64 deb
docker_cmd deb 'cd code && cargo deb --target aarch64-unknown-linux-gnu'
cp $CACHE/deb/target/aarch64-unknown-linux-gnu/debian/vpncloud_${DEB_VERSION}_arm64.deb ../dist/vpncloud_${DEB_VERSION}_arm64.deb
if ! [ -f ../dist/vpncloud_${DEB_VERSION}_arm64.deb ]; then
docker_cmd deb 'cd code && cargo deb --target aarch64-unknown-linux-gnu'
cp $CACHE/deb/target/aarch64-unknown-linux-gnu/debian/vpncloud_${DEB_VERSION}_arm64.deb ../dist/vpncloud_${DEB_VERSION}_arm64.deb
fi
docker build --rm -f=Dockerfile-rpm -t vpncloud-builder-rpm .
# x86_64 rpm
docker_cmd rpm 'cd code && cargo rpm build'
cp $CACHE/rpm/target/release/rpmbuild/RPMS/x86_64/vpncloud-${RPM_VERSION}.x86_64.rpm ../dist/vpncloud_${RPM_VERSION}.x86_64.rpm
if ! [ -f ../dist/vpncloud_${RPM_VERSION}.x86_64.rpm ]; then
docker_cmd rpm 'cd code && cargo rpm build'
cp $CACHE/rpm/target/release/rpmbuild/RPMS/x86_64/vpncloud-${RPM_VERSION}.x86_64.rpm ../dist/vpncloud_${RPM_VERSION}.x86_64.rpm
fi
docker build --rm -f=Dockerfile-snap -t vpncloud-builder-snap .
# x86_64 snap
if ! [ -f ../dist/vpncloud_${DEB_VERSION}_amd64.snap ]; then
cp ../assets/snapcraft.yaml ../dist/vpncloud_${DEB_VERSION}_amd64.deb $CACHE/snap
docker run -v "$CACHE/snap":/build -w /build vpncloud-builder-snap bash -c 'snapcraft; chown -R user: *'
cp $CACHE/snap/vpncloud_${DEB_VERSION}_amd64.snap ../dist/vpncloud_${DEB_VERSION}_amd64.snap
fi