From 0e69615135244378ade7063ea6da76c7d68474ba Mon Sep 17 00:00:00 2001 From: Andreas Beckmann 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