commit e0c7ce3fca20ea9a9280c73c158488fb7ba18a30 Author: Alexandre CATTEAU Date: Mon May 29 19:51:46 2023 +0200 Intial commit diff --git a/README.md b/README.md new file mode 100644 index 0000000..721d388 --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +# LibreELEC setup + +This repository contains setup or configuration files for [LibreELEC](https://libreelec.tv/) after installation. + +### WireGuard VPN setup +* copy `~/.config/wireguard/wireguard.config.sample` to a new file, and adjust the parameters (see +https://wiki.libreelec.tv/configuration/wireguard for reference) +* `set-resolv-conf.sh` moves last DNS entry up in `/etc/resolv.conf` (is called after VPN initialization) +* TOFINISH diff --git a/set-ip-routes.service b/set-ip-routes.service new file mode 100644 index 0000000..01748dc --- /dev/null +++ b/set-ip-routes.service @@ -0,0 +1,9 @@ +[Unit] +Description=Update IP routes after connecting to VPN + +[Service] +Type=oneshot +ExecStart=/usr/sbin/ip route del default dev wg0 +ExecStart=/usr/sbin/ip route add 192.168.0.63 dev wg0 +ExecStart=/usr/sbin/ip route add 192.168.3.0/24 dev wg0 +ExecStart=/storage/libreelec-conf/set-resolv-conf.sh diff --git a/set-resolv-conf.sh b/set-resolv-conf.sh new file mode 100755 index 0000000..3629522 --- /dev/null +++ b/set-resolv-conf.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +# count lines in resolv.conf +lines=$(cat /run/libreelec/resolv.conf | wc -l) +# count number of 'nameserver' entries +count=$(grep -c 'nameserver' /run/libreelec/resolv.conf) + +# move last entry to top +i=$((0)) +while [ $((count)) -gt 1 ]; do + sed -i -n "$((lines - i - 1)){h;n;G};p" /run/libreelec/resolv.conf + count=$((count - 1)) + i=$((i + 1)) +done + +exit 0