Merge branch 'ZpmFred-master'

This commit is contained in:
Dennis Schwerdel 2019-03-02 01:13:08 +01:00
commit aa715b8c1d
5 changed files with 94 additions and 0 deletions

44
.rpm/vpncloud.spec Normal file
View File

@ -0,0 +1,44 @@
%define __spec_install_post %{nil}
%define __os_install_post %{_dbpath}/brp-compress
%define debug_package %{nil}
Name: vpncloud
Summary: Peer-to-peer VPN
Version: @@VERSION@@
Release: 1
License: GPL-3.0
Group: Applications/System
Source0: %{name}-%{version}.tar.gz
URL: https://vpncloud.ddswd.de
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
%description
%{summary}
%prep
%setup -q
%install
rm -rf %{buildroot}
mkdir -p %{buildroot}
mkdir -p %{buildroot}/etc/vpncloud
mkdir -p %{buildroot}/lib/systemd/system
mkdir -p %{buildroot}/usr/share/man/man1
cp %{buildroot}/../../../../../assets/example.net.disabled %{buildroot}/etc/vpncloud/example.net.disabled
cp %{buildroot}/../../../../../assets/vpncloud@.service %{buildroot}/lib/systemd/system/vpncloud@.service
cp %{buildroot}/../../../../../target/vpncloud.1.gz %{buildroot}/usr/share/man/man1/vpncloud.1.gz
cp -a * %{buildroot}
%clean
rm -rf %{buildroot}
%files
/etc/vpncloud
/etc/vpncloud/example.net.disabled
/usr/bin/vpncloud
/lib/systemd/system/vpncloud@.service
/usr/share/man/man1/vpncloud.1.gz
%defattr(-,root,root,-)
%{_bindir}/*

View File

@ -66,3 +66,9 @@ assets = [
["assets/vpncloud@.service", "/lib/systemd/system/vpncloud@.service", "644"], ["assets/vpncloud@.service", "/lib/systemd/system/vpncloud@.service", "644"],
["target/vpncloud.1.gz", "/usr/share/man/man1/vpncloud.1.gz", "644"] ["target/vpncloud.1.gz", "/usr/share/man/man1/vpncloud.1.gz", "644"]
] ]
[package.metadata.rpm.cargo]
buildflags = ["--release"]
[package.metadata.rpm.targets]
vpncloud = { path = "/usr/bin/vpncloud" }

View File

@ -74,6 +74,19 @@ Debian packages can be built using [cargo-deb](https://github.com/mmstick/cargo-
There is a [VpnCloud package for Arch Linux](https://aur.archlinux.org/packages/vpncloud/) There is a [VpnCloud package for Arch Linux](https://aur.archlinux.org/packages/vpncloud/)
thanks to Oscar Rainford (fourbytes). thanks to Oscar Rainford (fourbytes).
#### CentOS 7 (maybe other RPM based)
CentOS 7 .rpm package can be built using [cargo-rpm](https://github.com/RustRPM/cargo-rpm): ``cargo rpm``
On an CentOS 7:
1. Install the required build environment (on CentOS 7)
$> yum groupinstall -y 'Development Tools'
2. Build the software
$> cargo rpm build
rpm will be situated in `target/release/rpmbuild/RPMS/`
### Contributions welcome ### Contributions welcome
There are several areas in which still some work has to be done and where There are several areas in which still some work has to be done and where

24
builder/Dockerfile-rpm Normal file
View File

@ -0,0 +1,24 @@
FROM centos:latest
RUN yum groupinstall -y 'Development Tools'
RUN useradd -ms /bin/bash user
USER user
WORKDIR /home/user
ENV RUST=1.33.0
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain ${RUST}
ENV PATH=/home/user/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
RUN rustup target add i686-unknown-linux-gnu \
&& rustup target add armv7-unknown-linux-gnueabihf
RUN cargo install cargo-rpm \
&& rm -rf /home/user/.cargo/{git,tmp,registry}
VOLUME /home/user/.cargo/tmp
VOLUME /home/user/.cargo/git
VOLUME /home/user/.cargo/registry

View File

@ -30,3 +30,10 @@ cp ../target/debian/vpncloud_${VERSION}_amd64.deb ../dist/vpncloud_${VERSION}_am
# arm7hf deb # arm7hf deb
docker_cmd deb 'cd code && cargo deb --target armv7-unknown-linux-gnueabihf' docker_cmd deb 'cd code && cargo deb --target armv7-unknown-linux-gnueabihf'
cp ../target/armv7-unknown-linux-gnueabihf/debian/vpncloud_${VERSION}_armhf.deb ../dist/vpncloud_${VERSION}_armhf.deb cp ../target/armv7-unknown-linux-gnueabihf/debian/vpncloud_${VERSION}_armhf.deb ../dist/vpncloud_${VERSION}_armhf.deb
docker build --rm -f=Dockerfile-rpm -t vpncloud-builder-rpm .
# x86_64 rpm
docker_cmd rpm 'cd code && cargo rpm build'
cp ../target/release/rpmbuild/RPMS/x86_64/vpncloud-${VERSION}-1.x86_64.rpm ../dist/vpncloud_${VERSION}.x86_64.rpm