From 3302190bd7994433ad2cde758de920a418f5c75a Mon Sep 17 00:00:00 2001 From: Wessel klein Snakenborg <100232604+wessel-novacustom@users.noreply.github.com> Date: Sat, 16 Sep 2023 17:04:37 +0200 Subject: [PATCH] Add files via upload --- kb.sh | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/kb.sh b/kb.sh index 7d628d9..01dda12 100644 --- a/kb.sh +++ b/kb.sh @@ -1,12 +1,17 @@ #!/bin/bash +if [ "$EUID" -ne 0 ]; then + echo "This script requires root rights. Execute it with sudo." + exit 1 +fi apt install -y git dkms build-essential linux-headers-$(uname -r) rm -rf ~/clevo-keyboard rmmod clevo_acpi rmmod clevo_wmi rmmod tuxedo_io rmmod tuxedo_keyboard -sudo pacman -S base-devel -sudo pacman -S dkms +rm /etc/modprobe.d/tuxedo_keyboard.conf +pacman -S base-devel +pacman -S dkms pamac install $(pamac list --quiet --installed | grep "^linux[0-9]*[-rt]*$" | awk '{print $1"-headers"}' ORS=' ') dnf -y group install "C Development Tools and Libraries" dnf -y group install "Development Tools" @@ -17,7 +22,18 @@ dnf -y install kernel-devel git clone https://github.com/wessel-novacustom/clevo-keyboard cd clevo-keyboard/ make clean -sudo make dkmsinstall +cd src +file="tuxedo_keyboard.c" +output=$(dmidecode | grep Manufacturer) +sysvendor=$(echo "$output" | awk -F 'Manufacturer: ' 'NR==1{print $2}') +boardvendor=$(echo "$output" | awk -F 'Manufacturer: ' 'NR==2{print $2}') +chassisvendor=$(echo "$output" | awk -F 'Manufacturer: ' 'NR==3{print $2}') +sed -i "s/DMI_MATCH(DMI_SYS_VENDOR, .*)/DMI_MATCH(DMI_SYS_VENDOR, \"$sysvendor\")/g" "$file" +sed -i "s/DMI_MATCH(DMI_BOARD_VENDOR, .*)/DMI_MATCH(DMI_BOARD_VENDOR, \"$boardvendor\")/g" "$file" +sed -i "s/DMI_MATCH(DMI_CHASSIS_VENDOR, .*)/DMI_MATCH(DMI_CHASSIS_VENDOR, \"$chassisvendor\")/g" "$file" +cat $file +cd .. +make dkmsinstall echo tuxedo_keyboard >> /etc/modules modprobe tuxedo_keyboard echo "options tuxedo_keyboard color=WHITE" > /etc/modprobe.d/tuxedo_keyboard.conf