Skip to content

Commit

Permalink
build wireguard module (after gpg check)
Browse files Browse the repository at this point in the history
  • Loading branch information
xaki23 committed May 29, 2019
1 parent ef094d5 commit 7906851
Show file tree
Hide file tree
Showing 3 changed files with 481 additions and 3 deletions.
25 changes: 22 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,38 @@ SIGN_FILE := linux-${VERSION}.tar.bz2.sign
endif
HASH_FILE :=${SRC_FILE}.sha1sum

WG_BASE_URL := https://git.zx2c4.com/WireGuard/snapshot
WG_SRC_FILE := WireGuard-0.0.20190406.tar.xz

WG_SRC_URL := $(WG_BASE_URL)/$(WG_SRC_FILE)
WG_SIG_FILE := $(shell echo $(WG_SRC_FILE) | sed 's/\.xz/.asc/')
WG_SIG_URL := $(WG_BASE_URL)/$(WG_SIG_FILE)

URL := $(SRC_BASEURL)/$(SRC_FILE)
URL_SIGN := $(SRC_BASEURL)/$(SIGN_FILE)

get-sources: $(SRC_FILE) $(SIGN_FILE)
get-sources: $(SRC_FILE) $(SIGN_FILE) $(WG_SRC_FILE) $(WG_SIG_FILE)

$(SRC_FILE):
@wget -q -N $(URL)

$(SIGN_FILE):
@wget -q -N $(URL_SIGN)

$(WG_SRC_FILE):
@wget -q -N $(WG_SRC_URL)

$(WG_SIG_FILE):
@wget -q -N $(WG_SIG_URL)

import-keys:
@if [ -n "$$GNUPGHOME" ]; then rm -f "$$GNUPGHOME/linux-kernel-trustedkeys.gpg"; fi
@gpg --no-auto-check-trustdb --no-default-keyring --keyring linux-kernel-trustedkeys.gpg -q --import *-key.asc
@gpg --no-auto-check-trustdb --no-default-keyring --keyring linux-kernel-trustedkeys.gpg -q --import kernel*-key.asc
@if [ -n "$$GNUPGHOME" ]; then rm -f "$$GNUPGHOME/wireguard-trustedkeys.gpg"; fi
@gpg --no-auto-check-trustdb --no-default-keyring --keyring wireguard-trustedkeys.gpg -q --import wireguard*-key.asc

verify-sources: import-keys
@xzcat $(WG_SRC_FILE) | gpgv --keyring wireguard-trustedkeys.gpg $(WG_SIG_FILE) - 2>/dev/null
ifeq ($(BUILD_FLAVOR),pvops)
@xzcat $(SRC_FILE) | gpgv --keyring linux-kernel-trustedkeys.gpg $(SIGN_FILE) - 2>/dev/null
else
Expand All @@ -76,7 +92,10 @@ endif
.PHONY: clean-sources
clean-sources:
ifneq ($(SRC_FILE), None)
-rm $(SRC_FILE)
-rm $(SRC_FILE) $(SIGN_FILE)
endif
ifneq ($(WG_SRC_FILE), None)
-rm $(WG_SRC_FILE) $(WG_SIG_FILE)
endif


Expand Down
13 changes: 13 additions & 0 deletions kernel.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-build
ExclusiveArch: x86_64

Source0: linux-%version.tar.xz
Source5: WireGuard-0.0.20190406.tar.xz
Source16: guards
Source17: apply-patches
Source33: check-for-config-changes
Expand Down Expand Up @@ -169,6 +170,11 @@ if [ -n "$u2mfn_ver" ]; then
cp -r /usr/src/u2mfn-$u2mfn_ver %_builddir/u2mfn
fi

rm -rf %_builddir/wireguard
tar x -C %_builddir -Jpf %{SOURCE5}
mv %_builddir/$(basename %{SOURCE5} .tar.xz) %_builddir/wireguard


%build

cd %kernel_build_dir
Expand All @@ -190,6 +196,10 @@ if [ -d "%_builddir/u2mfn" ]; then
make -C %kernel_build_dir M=%_builddir/u2mfn modules
fi

if [ -d "%_builddir/wireguard" ]; then
make -C %kernel_build_dir M=%_builddir/wireguard/src modules
fi

%install

# get rid of /usr/lib/rpm/brp-strip-debug
Expand Down Expand Up @@ -226,6 +236,9 @@ make modules_install $MAKE_ARGS INSTALL_MOD_PATH=%buildroot
if [ -d "%_builddir/u2mfn" ]; then
make modules_install $MAKE_ARGS INSTALL_MOD_PATH=%buildroot M=%_builddir/u2mfn
fi
if [ -d "%_builddir/wireguard" ]; then
make modules_install $MAKE_ARGS INSTALL_MOD_PATH=%buildroot M=%_builddir/wireguard/src
fi

mkdir -p %buildroot/%src_install_dir

Expand Down
Loading

0 comments on commit 7906851

Please sign in to comment.