-
Notifications
You must be signed in to change notification settings - Fork 2
/
install.sh
executable file
·30 lines (26 loc) · 1.22 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
#!/bin/bash
. /etc/os-release
if [ "$ID" == "fedora" ] || [ "$ID_LIKE" == "fedora" ] || [ "$ID_LIKE" == "rhel fedora" ]; then
echo "Installing dependencies..."
sudo dnf install cargo libevdev-devel -y
elif [ "$ID" == "ubuntu" ] || [ "$ID" == "debian" ] || [ "$ID_LIKE" == "debian" ] || [ "$ID_LIKE" == "ubuntu" ]; then
echo "Installing dependendies..."
sudo apt install cargo libevdev-dev -y
else
echo "You have to install the packages cargo and libevdev-dev/libevdev-devel to use this program. Please do that before continuing"
read -p "Press Enter to continue" </dev/tty
fi
cargo build --release
sudo killall surface-pen-button
sudo install -Dm=rwrr ./etc/remap.conf /etc/surface-pen-button/remap.conf
sudo install -m=rwxrxrx ./target/release/surface-pen-button /usr/bin/surface-pen-button
printf 'Do you want to install the systemd service (y/n)? '
read answer
if [ "$answer" != "${answer#[Yy]}" ]; then
sudo install -m=rwrr surface-pen-button.service /etc/systemd/system/surface-pen-button.service
sudo systemctl daemon-reload
sudo systemctl enable --now surface-pen-button.service
echo "Systemd service is installed, enabled and started!"
else
echo "Systemd service is not installed! Run this tool via 'sudo surface-pen-button'"
fi