confirm working on clara-bw as of fw 4.39.23027 / linux 4.9.77

This commit is contained in:
Thea Heinen
2024-08-25 11:01:01 -04:00
parent cb779cbcfd
commit 2509983817
13 changed files with 139 additions and 1 deletions

13
clara-bw/README.md Normal file
View File

@@ -0,0 +1,13 @@
# Kobo Libra Color
## Modules
Tailscale requires the TUN/TAP device driver to be loaded to function.
This is included in the Libra Color kernel though
# iptables
Tailscale requires the `iptables` binary and shared libraries to be present on the device to function.
These are not included in the stock Kobo Libra Color image so this repo provides it as
pre-built binaries/libraries in the `binaries` directory.
This was pulled from the [July 5th 2017 build of Raspbian](http://downloads.raspberrypi.org/raspbian/images/raspbian-2017-07-05)
which also bundles the source code. This was done to match the glibc version used in the Libra Color image.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

55
clara-bw/install-tailscale.sh Executable file
View File

@@ -0,0 +1,55 @@
#!/bin/sh
set -e
# Set what version of tailscale you would like to install here.
# You can find the latest version at https://pkgs.tailscale.com/stable/#static
export TAILSCALE_VERSION=1.72.1
echo
echo "Installing tailscale ${TAILSCALE_VERSION} for Kobo Clara BW!"
uname -a
echo
echo "Installing iptables into /sbin and /lib ..."
cp binaries/iptables/sbin/* /sbin
cp binaries/iptables/lib/* /lib
ln -sf /sbin/xtables-multi /sbin/iptables
ln -sf /lib/libxtables.so.10.0.0 /lib/libxtables.so.10
ln -sf /lib/libip4tc.so.0.1.0 /lib/libip4tc.so.0
ln -sf /lib/libip6tc.so.0.1.0 /lib/libip6tc.so.0
echo "Downloading tailscale_${TAILSCALE_VERSION}_arm.tgz from pkgs.tailscale.com ..."
wget https://pkgs.tailscale.com/stable/tailscale_${TAILSCALE_VERSION}_arm.tgz
tar -xvf tailscale_${TAILSCALE_VERSION}_arm.tgz
echo "Installing tailscale binaries into /mnt/onboard/tailscale and symlinking them into /usr/bin ..."
mkdir -p /mnt/onboard/tailscale
mv tailscale_${TAILSCALE_VERSION}_arm/tailscale /mnt/onboard/tailscale
mv tailscale_${TAILSCALE_VERSION}_arm/tailscaled /mnt/onboard/tailscale
# Symlink tailscale binaries to /usr/bin
ln -sf /mnt/onboard/tailscale/tailscale /usr/bin/tailscale
ln -sf /mnt/onboard/tailscale/tailscaled /usr/bin/tailscaled
echo "Cleaning up tarball ..."
rm -rf tailscale_${TAILSCALE_VERSION}_arm
rm -rf tailscale_${TAILSCALE_VERSION}_arm.tgz
echo "Installing tailscale boot and load scripts into /usr/local/tailscale ..."
mkdir -p /usr/local/tailscale
cp scripts/* /usr/local/tailscale
echo "Installing tailscale udev rule into /etc/udev/rules.d ..."
cp rules/* /etc/udev/rules.d
echo
echo "Installation complete! Attempting to boot tailscale daemon ..."
/usr/local/tailscale/boot.sh
echo
echo "If no errors were reported, tailscale should be installed!"
echo "You can now configure tailscale by running 'tailscale up' and following the instructions."
echo "The tailscale binaries are located in /mnt/onboard/tailscale."
echo

View File

@@ -0,0 +1,3 @@
KERNEL=="loop0", RUN+="/bin/sh -c '/usr/local/tailscale/boot.sh'"
KERNEL=="wlan*", ACTION=="add", RUN+="/bin/sh -c '/usr/local/tailscale/on-wlan-up.sh'"
KERNEL=="wlan*", ACTION=="remove", RUN+="/bin/sh -c '/usr/local/tailscale/on-wlan-down.sh'"

10
clara-bw/scripts/boot.sh Executable file
View File

@@ -0,0 +1,10 @@
#!/bin/sh
# Start by renicing ourselves to a neutral value, to avoid any mishap...
renice 0 -p $$
# Launch in the background, with a clean env, after a setsid call to make very very sure udev won't kill us ;).
env -i -- setsid /usr/local/tailscale/on-boot.sh &
# Done :)
exit 0

23
clara-bw/scripts/on-boot.sh Executable file
View File

@@ -0,0 +1,23 @@
#!/bin/sh
# Make sure to load the TUN kernel module and create the /dev/net/tun device
if [ ! -c /dev/net/tun ]; then
mkdir -p /dev/net
mknod /dev/net/tun c 10 200
fi
# Make absolutely sure that iptables is in the PATH
export PATH=/usr/sbin:/usr/bin:$PATH
# Make sure /mnt/onboard is mounted
timeout 5 sh -c "while ! grep -q /mnt/onboard /proc/mounts; do sleep 0.1; done"
if [[ $? -eq 143 ]]; then
exit 1
fi
case "$(pidof tailscaled | wc -w)" in
0) tailscaled --statedir=/mnt/onboard/tailscale &> /tailscaled.log &
;;
esac
exit 0

View File

@@ -0,0 +1,2 @@
#!/bin/sh
tailscale down

2
clara-bw/scripts/on-wlan-up.sh Executable file
View File

@@ -0,0 +1,2 @@
#!/bin/sh
tailscale up

View File

@@ -0,0 +1,30 @@
#!/bin/sh
echo "Uninstalling tailscale..."
pid=$(pgrep tailscaled)
if [ -n "$pid" ]; then
echo "Terminating tailscale daemon with PID $pid ..."
kill -15 "$pid"
# Wait a little bit for the daemon to terminate cleanly.
sleep 3
echo "Tailscale daemon terminated successfully."
fi
echo "Removing iptables binaries from /sbin and /lib ..."
rm -f /sbin/xtables-multi /sbin/iptables
rm -f /lib/libxtables.so.10 /lib/libip4tc.so.0 /lib/libip6tc.so.0
echo "Removing tailscale binaries from /mnt/onboard/tailscale and /usr/bin ..."
rm -rf /mnt/onboard/tailscale
rm -f /usr/bin/tailscale /usr/bin/tailscaled
echo "Removing tailscale boot and load scripts from /usr/local/tailscale ..."
rm -rf /usr/local/tailscale
echo "Removing tailscale udev rule from /etc/udev/rules.d ..."
rm -f /etc/udev/rules.d/99-tailscale.rules
echo "Uninstallation complete!"