-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathinstall.sh
executable file
·72 lines (59 loc) · 2.09 KB
/
install.sh
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/bash
read -n 1 -p "Backslash fix (y/N)?" choice
echo
case "$choice" in
y|Y ) BKSL='BKSLFIX=y';;
* ) BKSL='BKSLFIX=n';;
esac
if [[ $1 != 'dkms' ]]; then
echo '## Making package ##'
make ${BKSL}
echo '## Installing package ##'
make install
else
echo '## Installing package with DKMS ##'
sed -ie '/MAKE\[0\]/d' dkms.conf
sed -ie "$ a\\MAKE\[0\]=\"make ${BKSL}\"" dkms.conf
make ${BKSL} dkms
fi
quirk='0x0c45:0x7603:0x0007'
modquirk="options usbhid quirks=$quirk"
grubquirk="usbhid.quirks=$quirk"
if (lsmod | grep 'usbhid'); then
echo '## usbhid is module ##'
# Making sure the quirk does not get added multiple times
if ! (cat /etc/modprobe.d/usbhid.conf | grep "$modquirk"); then
echo '## Writing to /etc/modprobe.d/usbhid.conf ##'
echo $modquirk >> /etc/modprobe.d/usbhid.conf
if [[ $1 != 'dkms' ]]; then sudo echo 'aziokbd' >> /etc/modules; fi
else
echo 'NOTICE - modprobe config files have already been updated'
fi
echo '## Starting module ##'
modprobe aziokbd
# Note: this line may fail if you have other drivers loaded that depend
# on usbhid. For example, your mouse driver. In that case you would have
# to remove those drivers first, then load them again.
echo '## Attempting to reload usbhid module ##'
rmmod usbhid && modprobe usbhid quirks=$quirk
else
echo '## usbhid is compiled into kernel ##'
# Making sure the quirk does not get added multiple times
if ! (cat /etc/default/grub.d/aziokbd.conf | grep "$grubquirk"); then
echo '## Writing to /etc/default/grub.d/aziokbd.conf ##'
echo $grubquirk >> /etc/default/grub.d/aziokbd.conf
$distro = $(lsb_release -si)
if ($distro | grep 'Ubuntu'); then
update-grub
fi
if [ -f "/etc/arch-release" ]; then
update-grub
fi
if [ -f "/etc/fedora-release" ]; then
grub2-mkconfig -o /boot/grub2/grub.cfg
fi
else
echo 'NOTICE - grub config file has already been updated'
fi
echo '## You must reboot to load the module ##'
fi