| 1 | #!/bin/sh |
| 2 | # SPDX-License-Identifier: GPL-2.0-only |
| 3 | # |
| 4 | # Script to generate the module version header |
| 5 | # |
| 6 | |
| 7 | if command -v git >/dev/null 2>&1 && [ -d .git ]; then |
| 8 | GIT_COMMIT=$(git describe HEAD | tail -c 9) |
| 9 | else |
| 10 | GIT_COMMIT="$(grep PACKAGE_VERSION dkms.conf | cut -d '"' -f2)?" |
| 11 | fi |
| 12 | |
| 13 | printf '#define GIT_COMMIT\t"%s"\n' "$GIT_COMMIT" > version.h |