-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathinstall.sh
executable file
·38 lines (33 loc) · 1.71 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
#!/bin/bash
echo "This script will install a library that will intercept pen events and smooth them."
echo
echo "If you haven't set up public key authentication on your remarkable yet, now would"
echo "be a good time to do so (otherwise you'll have to type your password multiple"
echo "times)."
echo
echo "Either way, make sure you have your remarkable password written down somewhere, you"
echo "might otherwise risk to lock yourself out if the GUI does not start up anymore."
echo
read -p "Enter the hostname or IP address of your remarkable device [remarkable]:" remarkable
remarkable=${remarkable:-remarkable}
echo
echo "Chose the amount of smoothing you want to apply to pen events. Larger values will"
echo "smooth more, but will also lead to larger perceived latencies."
echo
echo "Entering 0 will uninstall the library."
echo
read -p "Amount of smoothing (value between 2 and 32, or 0) [8]:" ring_size
ring_size=${ring_size:-8}
if [ "${ring_size}" -eq "0" ]
then \
echo "Uninstalling ReCept..."
ssh root@$remarkable "grep -qxF 'Environment=LD_PRELOAD=/usr/lib/librecept.so' /lib/systemd/system/xochitl.service && sed -i '/Environment=LD_PRELOAD=\/usr\/lib\/librecept.so/d' /lib/systemd/system/xochitl.service"
else \
echo "Installing ReCept with ring size ${ring_size}..."
scp ./precompiled/librecept_rs${ring_size}.so root@$remarkable:/usr/lib/librecept.so
ssh root@$remarkable "grep -qxF 'Environment=LD_PRELOAD=/usr/lib/librecept.so' /lib/systemd/system/xochitl.service || sed -i 's#\[Service\]#[Service]\nEnvironment=LD_PRELOAD=/usr/lib/librecept.so#' /lib/systemd/system/xochitl.service"
fi
echo "...done."
echo "Restarting xochitl..."
ssh root@$remarkable "systemctl daemon-reload; systemctl restart xochitl"
echo "...done."