Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calculate value from within dkms.conf #48

Closed
ev-mp opened this issue Feb 19, 2018 · 4 comments
Closed

Calculate value from within dkms.conf #48

ev-mp opened this issue Feb 19, 2018 · 4 comments
Labels

Comments

@ev-mp
Copy link

ev-mp commented Feb 19, 2018

Hello all,
I'm trying to build debian dkms for several in-tree modules that require patches.
I'm looking to a way to do the following in DKMS.conf :

SELECTED_KERNEL=$kernelver | cut -d- -f1

In order to use it later as

BUILT_MODULE_LOCATION[0]="$SELECTED_KERNEL/drivers/media/..."

So for instance with $kernelver=4.4.0-112_generic I would get SELECTED_KERNEL=4.4.0
I tried to change the DKMS.conf to bash script by adding '#!/bin/sh' and chmoding accordingly, but still, the new variable is not being calculated.

Any comments will be helpful

@ev-mp
Copy link
Author

ev-mp commented Feb 19, 2018

One more thing, according to DKMS manual the file DKMS.conf is a shell-script:

Note that the dkms.conf is really only a shell-script of variable definitions which are then sourced in by the dkms executable

So at least in theory there are provisions for this trick to work

@superm1
Copy link
Contributor

superm1 commented Feb 19, 2018

SELECTED_KERNEL=$kernelver | cut -d- -f1

I'd think you want it something like this:

SELECTED_KERNEL=$(echo $kernelver | cut -d- -f1)

@ev-mp
Copy link
Author

ev-mp commented Feb 20, 2018

Thanks for suggestion, I was interrupted to another task, but will return, check and update.

@ev-mp
Copy link
Author

ev-mp commented Feb 27, 2018

Hello, I want to update and confirm that the above syntax works!
thanks for the great advice - it just saved me a copy-paste of three sections

@ev-mp ev-mp closed this as completed Feb 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants