blob: b8a76d916bca52349016f07ca16396655f83b23c (
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
#!/bin/bash
#alpine arch and suse have packages
#need to build on fedora and deb*
ROOT=$(pwd)
if [ -f /usr/bin/apt ]; then
distro="deb"
elif [ -f /usr/bin/zypper ]; then
distro="suse"
elif [ -f /usr/bin/pacman ]; then
distro="arch"
elif [ -f /usr/bin/dnf ]; then
distro="fedora"
elif [ -f /usr/bin/apk ]; then
distro="alpine"
fi
if [ -f /usr/bin/sudo ]; then
privesc="sudo"
elif [ -f /usr/bin/doas ]; then
privesc="doas"
fi
if ! [ -f /usr/bin/keyd ]; then
# if keyd isnt installed
echo "Installing keyd dependencies"
case $distro in
deb)
$privesc apt install -y build-essential git
;;
arch)
$privesc pacman -S --noconfirm base-devel git
;;
fedora)
$privesc dnf groupinstall -y "Development Tools" "Development Libraries"
;;
esac
echo "Installing keyd"
case $distro in
suse)
$privesc zypper --non-interactive install keyd
;;
arch)
git clone https://aur.archlinux.org/keyd.git
cd keyd
makepkg -si --noconfirm
cd ..
;;
alpine)
$privesc apk add --no-interactive keyd
;;
*)
git clone https://github.com/rvaiya/keyd
cd keyd
make
$privesc make install
cd ..
;;
esac
fi
echo "Generating config"
python3 cros-keyboard-map.py
echo "Installing config"
$privesc mkdir -p /etc/keyd
$privesc cp cros.conf /etc/keyd
echo "Enabling keyd"
case $distro in
alpine)
$privesc rc-update add keyd
$privesc rc-service keyd restart
;;
*)
$privesc systemctl enable keyd
$privesc systemctl restart keyd
;;
esac
echo "Installing libinput configuration"
$privesc mkdir -p /etc/libinput
if [ -f /etc/libinput/local-overrides.quirks ]; then
cat $ROOT/local-overrides.quirks | $privesc tee -a /etc/libinput/local-overrides.quirks > /dev/null
else
$privesc cp $ROOT/local-overrides.quirks /etc/libinput/local-overrides.quirks
fi
echo "Done"
|