Skip to contentSkip to conversation

add dkms configuration file dkms.conf

PATCH Superseded Christian Hesse 2 participants 8 messages Dec 3, 2016 – Dec 6, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 add dkms configuration file dkms.conf

From: Christian Hesse <[email protected]>

This add dkms configuration file dkms.conf and target in Makefile to update the version.

---
 src/Makefile  | 14 ++++++++++----
 src/dkms.conf | 11 +++++++++++
 2 files changed, 21 insertions(+), 4 deletions(-)
 create mode 100644 src/dkms.conf
src/Makefile +10 -4
index 20947ac..f5ab275 100644
@@ -6,11 +6,17 @@ debug: module-debug tools
 
 version.h:
 	@export GIT_CEILING_DIRECTORIES="$$(readlink -f ../..)" && \
-	ver="#define WIREGUARD_VERSION \"$$(git describe --dirty 2>/dev/null)\"" && \
-	[ "$$(cat version.h 2>/dev/null)" != "$$ver" ] && \
-	echo "$$ver" > version.h && \
+	ver="$$(git describe --dirty 2>/dev/null)" && \
+	[ "$$(cut -d\" -f2 version.h 2>/dev/null)" != "$$ver" ] && \
+	echo "#define WIREGUARD_VERSION \"$$ver\"" && \
 	git update-index --assume-unchanged version.h || true
 
+dkms.conf:
+	ver="$$(git describe --dirty 2>/dev/null)" && \
+	[ "$$(grep PACKAGE_VERSION dkms.conf | cut -d\" -f2)" != "$$ver" ] && \
+	sed -i "/PACKAGE_VERSION/c PACKAGE_VERSION=\"$$ver\"" dkms.conf && \
+	git update-index --assume-unchanged dkms.conf || true
+
 module: version.h
 	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
 
@@ -38,4 +44,4 @@ cloc: clean
 
 include tests/debug.mk
 
-.PHONY: all module module-debug tools install clean core-cloc check version.h
+.PHONY: all module module-debug tools install clean core-cloc check version.h dkms.conf
src/dkms.conf new file +11 -0
new file mode 100644
index 0000000..cef8e6d
@@ -0,0 +1,11 @@
+#
+# Linux DKMS config script for the WireGuard kernel module
+#
+
+PACKAGE_NAME="wireguard"
+PACKAGE_VERSION="experimental-0.0.20161129-3-g27f0e1e-dirty"
+AUTOINSTALL="yes"
+
+BUILT_MODULE_NAME="wireguard"
+DEST_MODULE_LOCATION="/kernel/net"
+
Signature · 1 line
2.10.2
#1 lore raw

PATCH v2 1/1 add dkms configuration file dkms.conf

From: Christian Hesse <[email protected]>

This add dkms configuration file dkms.conf and target in Makefile to update the version.

---
 src/Makefile  | 14 ++++++++++----
 src/dkms.conf | 11 +++++++++++
 2 files changed, 21 insertions(+), 4 deletions(-)
 create mode 100644 src/dkms.conf
src/Makefile +10 -4
index 20947ac..f5ab275 100644
@@ -6,11 +6,17 @@ debug: module-debug tools
 
 version.h:
 	@export GIT_CEILING_DIRECTORIES="$$(readlink -f ../..)" && \
-	ver="#define WIREGUARD_VERSION \"$$(git describe --dirty 2>/dev/null)\"" && \
-	[ "$$(cat version.h 2>/dev/null)" != "$$ver" ] && \
-	echo "$$ver" > version.h && \
+	ver="$$(git describe --dirty 2>/dev/null)" && \
+	[ "$$(cut -d\" -f2 version.h 2>/dev/null)" != "$$ver" ] && \
+	echo "#define WIREGUARD_VERSION \"$$ver\"" > version.h && \
 	git update-index --assume-unchanged version.h || true
 
+dkms.conf:
+	ver="$$(git describe --dirty 2>/dev/null)" && \
+	[ "$$(grep PACKAGE_VERSION dkms.conf | cut -d\" -f2)" != "$$ver" ] && \
+	sed -i "/PACKAGE_VERSION/c PACKAGE_VERSION=\"$$ver\"" dkms.conf && \
+	git update-index --assume-unchanged dkms.conf || true
+
 module: version.h
 	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
 
@@ -38,4 +44,4 @@ cloc: clean
 
 include tests/debug.mk
 
-.PHONY: all module module-debug tools install clean core-cloc check version.h
+.PHONY: all module module-debug tools install clean core-cloc check version.h dkms.conf
src/dkms.conf new file +11 -0
new file mode 100644
index 0000000..cef8e6d
@@ -0,0 +1,11 @@
+#
+# Linux DKMS config script for the WireGuard kernel module
+#
+
+PACKAGE_NAME="wireguard"
+PACKAGE_VERSION="experimental-0.0.20161129-3-g27f0e1e-dirty"
+AUTOINSTALL="yes"
+
+BUILT_MODULE_NAME="wireguard"
+DEST_MODULE_LOCATION="/kernel/net"
+
Signature · 1 line
2.10.2
#2 lore raw

I like the general idea here of including dkim in WireGuard now, since basically all distros use it and ship the exact same logic. By putting it in WireGuard itself, I can provide maintenance over the interworkings, which will be helpful for downstream.

Another thing I can do is handle the installation myself. make dkim will then copy all the paths and create the dkim.conf file, etc. First
question: is there a standard destination path to which files should be copied. Second question: what environment variable name do you think would be appropriate for representing the destination address (override)?

#3 lore raw

"Jason A. Donenfeld" <[email protected]> on Sat, 2016/12/03 23:21:

Quoted 1 line

I like the general idea here of including dkim in WireGuard now,

'dkim' is mail security... We have dkms. ;)

Quoted 9 lines

since
basically all distros use it and ship the exact same logic. By putting it in WireGuard itself, I can provide maintenance over the interworkings, which will be helpful for downstream.

Another thing I can do is handle the installation myself. make dkim will then copy all the paths and create the dkim.conf file, etc. First
question: is there a standard destination path to which files should be copied.

For Arch Linux we install dkms sources to /usr/src/$pkgname-$pkgver, so for wireguard we have: /usr/src/wireguard-0.0.20161129/

So directory content looks something like this:

/usr/src/wireguard-0.0.20161129/
/usr/src/wireguard-0.0.20161129/Kbuild
/usr/src/wireguard-0.0.20161129/Kconfig
/usr/src/wireguard-0.0.20161129/Makefile
/usr/src/wireguard-0.0.20161129/dkms.conf
/usr/src/wireguard-0.0.20161129/*.c
/usr/src/wireguard-0.0.20161129/*.h
/usr/src/wireguard-0.0.20161129/crypto/
/usr/src/wireguard-0.0.20161129/crypto/*.S
/usr/src/wireguard-0.0.20161129/crypto/*.c
/usr/src/wireguard-0.0.20161129/crypto/*.h
/usr/src/wireguard-0.0.20161129/selftest/
/usr/src/wireguard-0.0.20161129/selftest/*.h

Quoted 3 lines

Second question: what environment variable name do you think would be appropriate for representing the destination address (override)?

To have something like this would be great:

make DESTDIR="$pkgdir/" DKMSDIR="/usr/src/$pkgname-$pkgver" dkms

Signature · 3 lines
main(a){char*c=/*    Schoene Gruesse                         */"B?IJj;MEH"
"CX:;",b;for(a/*    Best regards             my address:    */=0;b=c[a++];)
putchar(b-1/(/*    Chris            cc -ox -xc - && ./x    */b/42*2-3)*42);}
#4 lore raw
Quoted 4 lines · Christian Hesse

"Jason A. Donenfeld" <[email protected]> on Sat, 2016/12/03 23:21:

Quoted 1 line

I like the general idea here of including dkim in WireGuard now,

'dkim' is mail security... We have dkms. ;)

Lol!

Quoted 4 lines

For Arch Linux we install dkms sources to /usr/src/$pkgname-$pkgver, so for wireguard we have: /usr/src/wireguard-0.0.20161129/
To have something like this would be great:
make DESTDIR="$pkgdir/" DKMSDIR="/usr/src/$pkgname-$pkgver" dkms

How does this look to you:
https://git.zx2c4.com/WireGuard/commit/?id=b70677fb8af28cbaec810146144858ad07a879ed

You can simply run:

make DESTDIR="$pkgdir/" DKMSDIR="/usr/src/$pkgname-$pkgver" dkms-install

You can also adjust SRCDIR or PREFIX, but I imagine you'll want to keep these as is. All variables are also inherited from the environment, so if the package manager sets these globally, things are even easier.

What do you think of that?

#6 lore raw
In reply to Jason A. Donenfeld

"Jason A. Donenfeld" <[email protected]> on Tue, 2016/12/06 19:14:

Quoted 18 lines · Christian Hesse
Quoted 4 lines

"Jason A. Donenfeld" <[email protected]> on Sat, 2016/12/03 23:21:

Quoted 1 line

I like the general idea here of including dkim in WireGuard now,

'dkim' is mail security... We have dkms. ;)

Lol!

Quoted 4 lines

For Arch Linux we install dkms sources to /usr/src/$pkgname-$pkgver, so for wireguard we have: /usr/src/wireguard-0.0.20161129/
To have something like this would be great:
make DESTDIR="$pkgdir/" DKMSDIR="/usr/src/$pkgname-$pkgver" dkms

How does this look to you:
https://git.zx2c4.com/WireGuard/commit/?id=b70677fb8af28cbaec810146144858ad07a879ed

You can simply run:

Quoted 8 lines

make DESTDIR="$pkgdir/" DKMSDIR="/usr/src/$pkgname-$pkgver" dkms-install

You can also adjust SRCDIR or PREFIX, but I imagine you'll want to keep these as is. All variables are also inherited from the environment, so if the package manager sets these globally, things are even easier.

What do you think of that?

Looks good!

Here are my changes for the git package:

https://aur.archlinux.org/cgit/aur.git/commit/?h=wireguard-git&id=dbb8a8cd7a98d3e5d338a4c1103eb7fae1b4c40c

Thanks a lot!

Signature · 3 lines
main(a){char*c=/*    Schoene Gruesse                         */"B?IJj;MEH"
"CX:;",b;for(a/*    Best regards             my address:    */=0;b=c[a++];)
putchar(b-1/(/*    Chris            cc -ox -xc - && ./x    */b/42*2-3)*42);}
#7 lore raw

Great -- good to hear it works well with the Arch package.

Daniel -- is this something you'll find similarly useful for the Debian package?