Intial commit

This commit is contained in:
Alexandre CATTEAU 2023-05-29 19:51:46 +02:00
commit e0c7ce3fca
3 changed files with 34 additions and 0 deletions

9
README.md Normal file
View File

@ -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

9
set-ip-routes.service Normal file
View File

@ -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

16
set-resolv-conf.sh Executable file
View File

@ -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