You are not logged in.

#1 2020-09-25 19:40:44

G3ro
Member
Registered: 2020-09-24
Posts: 26

[SOLVED] shiftfs dkms package

Hello,

I would like to contribute a package on AUR for a kernel module named "shiftfs".

shiftfs is a kernel filesystem that provides uid/gid shifting, which is used in software like LXD.
More information can be found here:
https://discuss.linuxcontainers.org/t/t … iftfs/5155

shiftfs is considered stable (link to comment), enabled by default in the Ubuntu kernel and maintained by experienced kernel maintainers.

I have a few questions/problems that I would like to discuss here, before I submit files to AUR.

You can find my draft here:
https://github.com/toby63/shiftfs-dkms/tree/aur

1. checksums:
The pkgbuild downloads the shiftfs.c-file from the Ubuntu Kernel repo (which is the most recent repo to take it from; the maintainers also work for ubuntu):
https://git.launchpad.net/~ubuntu-kerne … /shiftfs.c

Now I am stuck finding a good method for adding a checksum or disabling checksums.
Sry I have no experience in this, so I ask for help.

2. version:
Officially there are no versions, so right now I use my own versioning scheme:
pkgver=1.3

An alternative would be to use the date from the last update presented in the log:
https://git.launchpad.net/~ubuntu-kerne … /shiftfs.c

What would you recommend?

3. url:
There is also no real official url, so there are the following options:
a) The Ubuntu kernel repo: https://git.launchpad.net/~ubuntu-kerne … /shiftfs.c
b) LXD Forum post (nearest to an official description): https://discuss.linuxcontainers.org/t/t … iftfs/5155
c) Initial Bug report on Ubuntu about implementing shiftfs: https://bugs.launchpad.net/ubuntu/+sour … ug/1823186
d) my Github repo, which describes the details, but is of course completely unofficial as I am not the maintainer of the kernel module:
https://github.com/toby63/shiftfs-dkms/
e) I could ask the maintainers whether they would set up something more official.

What would you recommend?

4. Different versions:
As you can see the PKGBUILD file right now includes two packages, I assume I should seperate these into two different AUR packages, correct?

Thx in advance.

Greetings,
G3ro

Last edited by G3ro (2020-09-29 20:29:23)

Offline

#2 2020-09-25 20:19:32

loqs
Member
Registered: 2014-03-06
Posts: 11,869

Re: [SOLVED] shiftfs dkms package

It did not work for me in a clean chroot with a custom kernel outside the chroot due to the use of uname -r.
The following changes allowed it to build for the linux package as listed in the dependencies:
Allow KDIR specified in the Makefile to be overriden see https://www.kernel.org/doc/html/latest/ … dules.html
Drop the custom Make rule in dkms.conf as the default rule passes in KERNVER.

diff --git a/Makefile b/Makefile
index 8645be2..59ad447 100644
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@ modname := shiftfs
 obj-m := $(modname).o
 
 KVERSION := $(shell uname -r)
-KDIR := /lib/modules/$(KVERSION)/build
+KDIR ?= /lib/modules/`uname -r`/build
 PWD := "$$(pwd)"
 
 ifdef DEBUG
diff --git a/PKGBUILD b/PKGBUILD
index d97bade..f1a6bd6 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -11,10 +11,12 @@ makedepends=('linux-headers')
 source=("https://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/groovy/plain/fs/shiftfs.c"
 dkms.conf
 Makefile)
-sha512sums=('SKIP')
+sha512sums=('SKIP'
+            '186a0d0bb6f85db978636a9e8471865542aae8f2170b3d4bdd35952c9eaa73a055acb2d4bea6b5c62ca7732d3c5fb478a267f1f5d78b50a4ac3e095ba689833f'
+            '564fa7777089f16ca1522b1893d0e77ce34cd2b3632ff807c4a932eb29559053ad04a3d6a083c2b34e50864d72f6707c96a951aafca663fa67d483af04bcf0e9')
 
 build() {
-  make
+  make KDIR="/usr/lib/modules/$(</usr/src/linux/version)/build"
 }
 
 package_shiftfs() {
diff --git a/dkms.conf b/dkms.conf
index de08f93..8b6d92d 100644
--- a/dkms.conf
+++ b/dkms.conf
@@ -1,6 +1,5 @@
 PACKAGE_NAME="shiftfs"
 PACKAGE_VERSION="1.3"
-MAKE[0]="make KVERSION=$kernelver"
 CLEAN="make clean"
 BUILT_MODULE_NAME[0]="shiftfs"
 DEST_MODULE_LOCATION[0]="/kernel/fs/"

Last edited by loqs (2020-09-25 20:19:46)

Offline

#3 2020-09-26 13:32:38

G3ro
Member
Registered: 2020-09-24
Posts: 26

Re: [SOLVED] shiftfs dkms package

@loqs: Thx for the suggestions, I added the changes to the repo.

Offline

#4 2020-09-29 20:27:42

G3ro
Member
Registered: 2020-09-24
Posts: 26

Re: [SOLVED] shiftfs dkms package

I created two packages for shiftfs:
https://aur.archlinux.org/packages/?O=0&K=shiftfs

To give some answers to my own questions:

1. checksums:
It seems there are no checksums for single files in a git-repo.
Thus we skip the checksum.

2. version:
I decided to use a date format for versioning.

3. url:
I kept the url of the ubuntu repo, because that is the original source of the module after all.
I added additional links in a pinned comment.

4. different versions:
I seperated the packages, because obviously you should install only one of the packages anyway.
This should now also work for custom kernels and AUR helpers which automatically install packages.

Offline

Board footer

Powered by FluxBB