Skip to content

Commit

Permalink
xpadneo, installer: Fix some general issues with the scripts
Browse files Browse the repository at this point in the history
Signed-off-by: Kai Krakow <[email protected]>
  • Loading branch information
kakra committed Dec 12, 2024
1 parent ed56962 commit 57ffde2
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 16 deletions.
1 change: 1 addition & 0 deletions .shellcheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
external-sources=true
11 changes: 9 additions & 2 deletions hid-xpadneo/dkms.conf.in
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
# vim:syntax=bash

PACKAGE_NAME="hid-xpadneo"
PACKAGE_VERSION="@DO_NOT_CHANGE@"

BUILT_MODULE_NAME[0]="hid-xpadneo"
BUILT_MODULE_LOCATION[0]="src"
DEST_MODULE_LOCATION[0]="/kernel/drivers/hid"

MAKE[0]="make -C '${kernel_source_dir}' M='${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build/src' VERSION='${PACKAGE_VERSION}' modules"
CLEAN="make -C '${kernel_source_dir}' M='${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build/src' clean"

BUILD_EXCLUSIVE_CONFIG="CONFIG_HID CONFIG_INPUT_FF_MEMLESS CONFIG_POWER_SUPPLY"
MAKE[0]="make -C $kernel_source_dir M=$dkms_tree/$PACKAGE_NAME/$PACKAGE_VERSION/build/src VERSION=$PACKAGE_VERSION modules"
CLEAN="make -C $kernel_source_dir M=$dkms_tree/$PACKAGE_NAME/$PACKAGE_VERSION/build/src clean"

AUTOINSTALL="Y"

POST_INSTALL="dkms.post_install"
POST_REMOVE="dkms.post_remove"
2 changes: 1 addition & 1 deletion hid-xpadneo/dkms.post_install
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
ERTM_OVERRIDE="/etc/modprobe.d/99-xpadneo-bluetooth.conf"
DISABLE_ERTM="/sys/module/bluetooth/parameters/disable_ertm"

if [ `uname -r | awk -F. '{ printf "%03d%03d",$1,$2 }'` -ge 005012 ]; then
if [ "$(uname -r | awk -F. '{ printf "%03d%03d",$1,$2 }')" -ge 005012 ]; then
echo "Not disabling ERTM, kernel version doesn't require it..."
elif [ "$(readlink "${ERTM_OVERRIDE}" 2>/dev/null)" = "/dev/null" ]; then
echo "Not disabling ERTM, local override in place..."
Expand Down
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash -e
#!/bin/bash

cd "$(dirname "$0")" || exit 1
source "lib/verbose.sh"
Expand Down
6 changes: 2 additions & 4 deletions lib/installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ DKMS_BIN=$(type -p dkms)
: ${DKMS_BIN:?Please install dkms to continue}

get_dkms_versions_installed() {
${DKMS_BIN} status | tr -s ':,/ ' ' ' | awk -- '$1 == "hid-xpadneo" { print $2 }' | sort -nu
${DKMS_BIN} status 2>/dev/null | tr -s ':,/ ' ' ' | awk -- '$1 == "hid-xpadneo" { print $2 }' | sort -nu
}

get_upstream_version_latest() {
Expand All @@ -49,6 +49,4 @@ cat_dkms_make_log() {
}

# shellcheck disable=SC2034
INSTALLED=(
$(get_dkms_versions_installed)
)
mapfile -t INSTALLED < <(get_dkms_versions_installed)
15 changes: 7 additions & 8 deletions uninstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@ modprobe -r hid_xpadneo || true
echo "* looking for registered instances"
echo "found ${#INSTALLED[@]} registered instance(s) on your system"

for instance in "${INSTALLED[@]}"
do
echo "* $instance"
set -e

set -e
for VERSION in "${INSTALLED[@]}"; do
echo "* ${VERSION}"

echo " * uninstalling and removing $instance from DKMS"
dkms remove "${V[*]}" "hid-xpadneo/${instance}" --all
echo " * uninstalling and removing ${VERSION}"
dkms remove "${V[*]}" "hid-xpadneo/${VERSION}" --all

echo " * removing $instance folder from /usr/src"
rm --recursive "${V[@]}" "/usr/src/hid-xpadneo-$instance/"
echo " * removing ${VERSION} folder from /usr/src"
rm --recursive "${V[@]}" "/usr/src/hid-xpadneo-${VERSION}/"
done

0 comments on commit 57ffde2

Please sign in to comment.