mirror of
https://github.com/videah/kobo-tailscale
synced 2026-03-20 02:31:28 +11:00
confirm working on clara-bw as of fw 4.39.23027 / linux 4.9.77
This commit is contained in:
@@ -4,8 +4,8 @@ Install scripts for getting [Tailscale](https://tailscale.com) running on Kobo e
|
||||
## Supported devices
|
||||
- *Kobo Libra 2*
|
||||
- *Koba Libra Colour*/*Koba Libra Color*
|
||||
- *Kobo Clara BW*
|
||||
|
||||
Currently only the Libra 2 is supported as it is the only device I have access to.
|
||||
If you have another device and would like to contribute, please open a PR!
|
||||
|
||||
## Installation
|
||||
|
||||
13
clara-bw/README.md
Normal file
13
clara-bw/README.md
Normal 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.
|
||||
BIN
clara-bw/binaries/iptables/lib/libip4tc.so.0.1.0
Executable file
BIN
clara-bw/binaries/iptables/lib/libip4tc.so.0.1.0
Executable file
Binary file not shown.
BIN
clara-bw/binaries/iptables/lib/libip6tc.so.0.1.0
Executable file
BIN
clara-bw/binaries/iptables/lib/libip6tc.so.0.1.0
Executable file
Binary file not shown.
BIN
clara-bw/binaries/iptables/lib/libxtables.so.10.0.0
Executable file
BIN
clara-bw/binaries/iptables/lib/libxtables.so.10.0.0
Executable file
Binary file not shown.
BIN
clara-bw/binaries/iptables/sbin/xtables-multi
Executable file
BIN
clara-bw/binaries/iptables/sbin/xtables-multi
Executable file
Binary file not shown.
55
clara-bw/install-tailscale.sh
Executable file
55
clara-bw/install-tailscale.sh
Executable 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
|
||||
3
clara-bw/rules/98-tailscale.rules
Normal file
3
clara-bw/rules/98-tailscale.rules
Normal 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
10
clara-bw/scripts/boot.sh
Executable 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
23
clara-bw/scripts/on-boot.sh
Executable 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
|
||||
2
clara-bw/scripts/on-wlan-down.sh
Executable file
2
clara-bw/scripts/on-wlan-down.sh
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
tailscale down
|
||||
2
clara-bw/scripts/on-wlan-up.sh
Executable file
2
clara-bw/scripts/on-wlan-up.sh
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
tailscale up
|
||||
30
clara-bw/uninstall-tailscale.sh
Normal file
30
clara-bw/uninstall-tailscale.sh
Normal 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!"
|
||||
Reference in New Issue
Block a user