summaryrefslogtreecommitdiffstats
path: root/debian/patches/1001-do-not-perform-rpm-queries-on-Debian-Ubuntu-Arch-bas.patch
blob: 40242ac22259088171f459094a5bf8fc25daefa5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
From 0e69615135244378ade7063ea6da76c7d68474ba Mon Sep 17 00:00:00 2001
From: Andreas Beckmann <anbe@debian.org>
Date: Wed, 19 Apr 2023 17:37:54 +0200
Subject: [PATCH] do not perform rpm queries on Debian/Ubuntu/Arch based
 distributions

Closes #329
---
 dkms.in | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/dkms.in b/dkms.in
index 55eced3..5abb8eb 100644
--- a/dkms.in
+++ b/dkms.in
@@ -296,6 +296,11 @@ setup_kernels_arches()
             kernelver[0]=$(uname -r)
         fi
         if [[ ! $arch ]]; then
+            case "$running_distribution" in
+                debian* | ubuntu* | arch*)
+                    arch[0]=$(uname -m)
+                    ;;
+                *)
             kernelver_rpm=$(rpm -qf "$install_tree/$kernelver" 2>/dev/null | \
             grep -v "not owned by any package" | grep kernel | head -n 1)
             if ! arch[0]=$(rpm -q --queryformat "%{ARCH}" "$kernelver_rpm" 2>/dev/null); then
@@ -304,6 +309,8 @@ setup_kernels_arches()
                     arch[0]="ia32e"
                 fi
             fi
+                ;;
+            esac
         fi
         if [[ ! $arch ]]; then
             die 12 $"Could not determine architecture."
@@ -1579,7 +1586,15 @@ do_uninstall()
                 while [[ ${dir_to_remove} != ${dir_to_remove#/} ]]; do
                     dir_to_remove="${dir_to_remove#/}"
                 done
+
+                case "$running_distribution" in
+                    debian* | ubuntu* | arch*)
+                        (if cd "$install_tree/$1"; then rmdir -p --ignore-fail-on-non-empty "${dir_to_remove}"; fi || true)
+                        ;;
+                    *)
                 (if cd "$install_tree/$1"; then rpm -qf "${dir_to_remove}" >/dev/null 2>&1 || rmdir -p --ignore-fail-on-non-empty "${dir_to_remove}"; fi || true)
+                    ;;
+                esac
             else
                 echo $"   - Module was not found within $install_tree/$1/"
             fi
-- 
2.20.1