about summary refs log tree commit diff
path: root/install.sh
diff options
context:
space:
mode:
authorWeirdTreeThing <bradyn127@protonmail.com>2023-08-28 19:20:58 -0400
committerWeirdTreeThing <bradyn127@protonmail.com>2023-08-28 19:20:58 -0400
commitca0683a5370b4c00ad35be9c900d7fafc01a6b5e (patch)
tree8636dfbb403dbf4f248498d4108508b661141d6a /install.sh
Initial commit
Diffstat (limited to 'install.sh')
-rwxr-xr-xinstall.sh72
1 files changed, 72 insertions, 0 deletions
diff --git a/install.sh b/install.sh
new file mode 100755
index 0000000..21a65c9
--- /dev/null
+++ b/install.sh
@@ -0,0 +1,72 @@
+#!/bin/bash
+
+#alpine arch and suse have packages
+#need to build on fedora and deb*
+
+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
+
+echo "Installing keyd dependencies"
+case $distro in
+    deb)
+        sudo apt install -y build-essential git
+	;;
+    arch)
+	sudo pacman -S --noconfirm base-devel git
+	;;
+    fedora)
+	sudo dnf groupinstall -y "Development Tools" "Development Libraries"
+	;;
+esac
+
+echo "Installing keyd"
+case $distro in
+    suse)
+	sudo zypper --non-interactive install keyd
+	;;
+    arch)
+	git clone https://aur.archlinux.org/keyd.git
+	cd keyd
+	makepkg -si --noconfirm
+	;;
+    alpine)
+	doas apk add --no-interactive keyd
+	;;
+    *)
+        git clone https://github.com/rvaiya/keyd
+	cd keyd
+	make
+	sudo make install
+	cd ..
+        ;;
+esac
+
+echo "Generating config"
+python3 cros-keyboard-map.py
+
+echo "Installing config"
+sudo mkdir -p /etc/keyd
+sudo cp cros.conf /etc/keyd
+
+echo "Enabling keyd"
+case $distro in
+    alpine)
+        doas rc-update add keyd
+        doas rc-service keyd restart
+	;;
+    *)
+        sudo systemctl enable keyd
+	sudo systemctl restart keyd
+	;;
+esac
+
+echo "Done"