* Complete SyncThing integration.

* Switch on in ES under Network Settings.
  * Connect via browser to http://device:8384.
  * Username: root, Password: System Settings Menu
* A bit of startup optimization.
This commit is contained in:
fewtarius 2023-02-09 19:17:29 -05:00
parent 08b636a24d
commit c83cd844b1
No known key found for this signature in database
GPG key ID: F4AE55305D1B8C1A
34 changed files with 73 additions and 418 deletions

View file

@ -1,36 +0,0 @@
#!/bin/sh
#
# Sample user config script to setup Cirrus Logic Audio Card
# load helper functions and definitions
. /usr/lib/alsa/rpi-cirrus-functions.sh
# enable output to S/PDIF, line out and headset out
playback_to_spdif
playback_to_lineout
playback_to_headset
# disable noise gate - this can cut off the first few ms of playback
mixer 'Noise Gate Switch' off
# Uncomment this line to enable output to speakers
# playback_to_speakers
# example: mix line in and headset in into line out using a high-pass filter
# - line in gain is set to +8dB
# - headset in gain is set to +20dB
# - line in and headset in are mixed together in the filter, each using
# a gain of -3dB (volume 29). line in uses input 1, headset in input 2
# - first input of line out is connected to audio signal from RPi/Kodi,
# using a -3dB gain
# - second input of line out is connected to output of the filter
#
# mixer "${line_out} Digital Switch" off # mute output
# setup_line_in 8
# setup_headset_in 20
# setup_filter "High-Pass" "240,3"
# set_mixer $filter_signals $line_in_signals 29 1
# set_mixer $filter_signals $headset_in_signals 29 2
# set_mixer $line_out_signals $rpi_out_signals 29 1
# set_mixer $line_out_signals $filter_signals 29 2
# mixer "${line_out} Digital Switch" on # unmute output

View file

@ -14,7 +14,7 @@ PKG_BUILD_FLAGS="+pic"
PKG_MESON_OPTS_TARGET="-Ddeprecated=false \
-Ddocs=false \
-Ddefault_library=static"
-Ddefault_library=shared"
post_makeinstall_target() {
mkdir -p ${SYSROOT_PREFIX}/usr/bin

View file

@ -161,6 +161,7 @@ ssh.enabled=0
supergrafx.integerscale=0
supergrafx.ratio=4/3
supervision.integerscale=0
syncthing.enabled=0
system.autohotkeys=1
system.automount=1
system.cpugovernor=schedutil

View file

@ -42,7 +42,7 @@ case "${DEVICE}" in
;;
esac
PKG_TOOLS="i2c-tools syncthing rclone jslisten evtest tailscale pygobject mesa-demos"
PKG_TOOLS="i2c-tools synctools jslisten evtest tailscale pygobject mesa-demos"
### Project specific variables
case "${PROJECT}" in

View file

@ -171,5 +171,12 @@ then
set_setting ipv6.enabled 0
fi
SYNCTHING=$(get_setting syncthing.enabled)
if [ -z "${SYNCTHING}" ]
then
echo "Set syncthing default" >>${LOG}
set_setting syncthing.enabled=0
fi
### Force everyone to the stable repo
set_setting updates.branch stable

View file

@ -18,5 +18,8 @@ sed -i "s#root:${CURRENT}:${LPC}::::::#root:${NEW}:${LPC}::::::#g" /storage/.cac
# Create a root user and set the password.
echo -ne "${ROOTPASS}\n${ROOTPASS}\n" | smbpasswd -sa root 2>/dev/null
# Set the root user and password for SyncThing
syncthing generate --gui-user "root" --gui-password "${ROOTPASS}"
# Save the password so we can display it in ES
set_setting root.password "${ROOTPASS}"

View file

@ -1 +0,0 @@
initial release

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

View file

@ -1,25 +1,18 @@
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv)
# Copyright (C) 2023-present Fewtarius
PKG_NAME="syncthing"
PKG_VERSION="1.22.2"
PKG_SHA256="211704904788808ef2818994fb36e33c3e33ed1b52267f7adbf1411fa5ee2d2f"
PKG_REV="1"
PKG_VERSION="1.23.1"
PKG_ARCH="any"
PKG_LICENSE="MPLv2"
PKG_SITE="https://syncthing.net/"
PKG_URL="https://github.com/syncthing/syncthing/releases/download/v${PKG_VERSION}/syncthing-source-v${PKG_VERSION}.tar.gz"
PKG_DEPENDS_TARGET="toolchain go:host"
PKG_SECTION="service/system"
PKG_SHORTDESC="Syncthing: open source continuous file synchronization"
PKG_LONGDESC="Syncthing (${PKG_VERSION}) replaces proprietary sync and cloud services with something open, trustworthy and decentralized. Your data is your data alone and you deserve to choose where it is stored, if it is shared with some third party and how it's transmitted over the Internet."
PKG_TOOLCHAIN="manual"
PKG_IS_ADDON="yes"
PKG_ADDON_NAME="Syncthing"
PKG_ADDON_TYPE="xbmc.service"
PKG_MAINTAINER="Anton Voyl (awiouy)"
configure_target() {
go_configure
export LDFLAGS="-w -linkmode external -extldflags -Wl,--unresolved-symbols=ignore-in-shared-libs -extld ${CC} \
@ -30,8 +23,9 @@ make_target() {
HOME=${ROOT} ${GOLANG} build -a -ldflags "${LDFLAGS}" -o bin/syncthing -v ./cmd/syncthing
}
addon() {
mkdir -p ${ADDON_BUILD}/${PKG_ADDON_ID}/bin
cp -P ${PKG_BUILD}/bin/syncthing \
${ADDON_BUILD}/${PKG_ADDON_ID}/bin
makeinstall_target() {
mkdir -p ${INSTALL}/usr/bin
cp bin/syncthing ${INSTALL}/usr/bin
cp -rf ${PKG_DIR}/sources/start_syncthing.sh ${INSTALL}/usr/bin
chmod 0755 ${INSTALL}/usr/bin/*
}

View file

@ -1,15 +0,0 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv)
. /etc/profile
oe_setup_addon service.system.syncthing
STNODEFAULTFOLDER="1" syncthing -home=$ADDON_HOME \
-gui-address="$gui_address" \
-logflags=0 \
-no-browser \
-no-restart \
&

View file

@ -1,20 +0,0 @@
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv)
import subprocess
import xbmc
import xbmcaddon
class Monitor(xbmc.Monitor):
def __init__(self, *args, **kwargs):
xbmc.Monitor.__init__(self)
self.id = xbmcaddon.Addon().getAddonInfo('id')
def onSettingsChanged(self):
subprocess.call(['systemctl', 'restart', self.id])
if __name__ == '__main__':
Monitor().waitForAbort()

View file

@ -1,14 +0,0 @@
# Kodi Media Center language file
# Addon Name: syncthing
# Addon id: service.system.syncthing
# Addon Provider: awiouy at gmail dot com
msgid ""
msgstr ""
msgctxt "#30000"
msgid "GUI Address"
msgstr ""
msgctxt "#30001"
msgid "GUI Address"
msgstr ""

View file

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<settings>
<category label="30000">
<setting id="gui_address" label="30001" type="text" default="0.0.0.0:8384" />
</category>
</settings>

View file

@ -1,3 +0,0 @@
<settings version="2">
<setting id="gui_address" default="true">0.0.0.0:8384</setting>
</settings>

View file

@ -1,16 +0,0 @@
[Unit]
Description=Syncthing - Open Source Continuous File Synchronization
Documentation=http://docs.syncthing.net/
After=network.target
Requires=network.target
[Service]
Type=forking
ExecStart=/bin/sh /storage/.kodi/addons/service.system.syncthing/bin/syncthing-service
Restart=on-failure
SuccessExitStatus=3 4
RestartForceExitStatus=3 4
[Install]
WantedBy=kodi.target

View file

@ -0,0 +1,12 @@
#!/bin/bash
# SPDX-License-Identifier: Apache-2.0
# Copyright (C) 2021-present Fewtarius (https://github.com/fewtarius)
. /etc/profile
ROOTPASS=$(get_setting root.password)
# Set the root user and password for SyncThing
syncthing generate --gui-user root --gui-password ${ROOTPASS}
xmlstarlet ed --inplace -u "//configuration/gui/address" -v ":8384" /storage/.config/syncthing/config.xml
syncthing -no-browser -no-restart

View file

@ -0,0 +1,10 @@
[Unit]
Description=Start SyncThing
After=jelos.service
[Service]
Type=simple
ExecStart=/usr/bin/start_syncthing.sh
[Install]
WantedBy=jelos.service

View file

@ -1,13 +0,0 @@
[Unit]
Description=WireGuard VPN Service
After=network-online.target nss-lookup.target connman-vpn.service time-sync.target
Wants=network-online.target nss-lookup.target connman-vpn.service time-sync.target
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/connmanctl connect vpn_service_name_goes_here
ExecStop=/usr/bin/connmanctl disconnect vpn_service_name_goes_here
[Install]
WantedBy=multi-user.target

View file

@ -1,14 +0,0 @@
[provider_wireguard]
Type = WireGuard
Name = WireGuard VPN Tunnel
Host = 3.2.5.6
Domain = my.home.network
WireGuard.Address = 10.2.0.2/24
WireGuard.ListenPort = 51820
WireGuard.PrivateKey = qKIj010hDdWSjQQyVCnEgthLXusBgm3I6HWrJUaJymc=
WireGuard.PublicKey = zzqUfWGIil6QxrAGz77HE5BGUEdD2PgHYnCg3CDKagE=
WireGuard.PresharedKey = DfEYeVs04HS9XhKGM4/ZXHG3Qc4MFK2AJd8XouYDbRQ=
WireGuard.DNS = 8.8.8.8, 1.1.1.1
WireGuard.AllowedIPs = 0.0.0.0/0
WireGuard.EndpointPort = 51820
WireGuard.PersistentKeepalive = 25

View file

@ -0,0 +1,3 @@
STATE=$(get_setting syncthing.enabled)
SVC="syncthing"
DAEMONS=("syncthing")

View file

@ -1,24 +0,0 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv)
PKG_NAME="entropy"
PKG_VERSION="0"
PKG_LICENSE="GPL"
PKG_SITE=""
PKG_URL=""
PKG_DEPENDS_TARGET="toolchain"
PKG_LONGDESC="A simple way to add entropy at boot"
PKG_TOOLCHAIN="manual"
makeinstall_target() {
mkdir -p $INSTALL/usr/lib/entropy
cp add-entropy $INSTALL/usr/lib/entropy
cp add-random-at-shutdown $INSTALL/usr/lib/entropy
chmod +x $INSTALL/usr/lib/entropy/*
}
post_install() {
enable_service add-entropy.service
enable_service add-random-at-shutdown.service
}

View file

@ -1,24 +0,0 @@
#!/usr/bin/python
import os
import struct
RNDADDENTROPY = 0x40085203
import fcntl
def add_entropy(fd, data):
add = struct.pack('ii', len(data)*8, len(data)) + data
fcntl.ioctl(fd, RNDADDENTROPY, add)
if not os.path.isfile("/storage/.cache/random.data"):
os.system("dd if=/dev/urandom of=/storage/.cache/random.data count=4 >/dev/null")
cache=os.open("/storage/.cache/random.data", os.O_RDONLY)
rnd=os.open("/dev/random", os.O_RDWR)
while True:
data=os.read(cache, 512)
if len(data) == 0:
break
add_entropy(rnd, data)

View file

@ -1,2 +0,0 @@
#!/bin/sh
dd if=/dev/urandom of=/storage/.cache/random.data count=4

View file

@ -1,13 +0,0 @@
[Unit]
Description=Add random entropy from file
DefaultDependencies=no
After=systemd-tmpfiles-setup.service
Before=systemd-udevd.service
[Service]
Type=oneshot
ExecStart=/usr/lib/entropy/add-entropy
RemainAfterExit=yes
[Install]
WantedBy=basic.target

View file

@ -1,12 +0,0 @@
[Unit]
Description=Save random entropy at shutdown
DefaultDependencies=no
Before=systemd-poweroff.service systemd-reboot.service systemd-halt.service
[Service]
Type=oneshot
ExecStart=/usr/lib/entropy/add-random-at-shutdown
RemainAfterExit=yes
[Install]
WantedBy=poweroff.target reboot.target halt.target

View file

@ -1,3 +0,0 @@
[Sleep]
SuspendMode=false
HibernateMode=false

View file

@ -1,50 +0,0 @@
# This is a sample service script to mount CIFS/SAMBA shares.
# Please read carefully the comments in this file. For production usage
# you can remove all comments (lines beginning with "#") from this file.
[Unit]
# The description should be used to explain what this servicefile is for
Description=test cifs mount script
# if we do network mounts like here we *require* 'network-online.service'
# which checks if the network is online
Requires=network-online.service
# our scripts must start *after* 'network-online.service', on timeout and if
# 'network-online.service' fails we can not mount and this scripts fails too
After=network-online.service
# usually we mount networks shares because we want they avaible *before* XBMC starts.
# so XBMC has access to this mounts from beginning. Note: this slows down the boot!
Before=kodi.service
[Mount]
# The share we want mount
What=//192.168.0.31/Music
# Where we want mount this share
Where=/storage/music2
# Any options you usually use with the "-o" parameter in the mount command
Options=username=myusername,password=mypassword
# filesystem type
Type=cifs
[Install]
# The target is used by 'systemctl enable <name_of_this_file.mount>' to link
# this service to a runlevel for starting on boot. usually 'multi-user.target'
# is ok here.
WantedBy=multi-user.target
# Important:
# this file must be renamed to <mountpoint>.mount where <mountpoint>, is the FULL path
# where the share will be mounted but slashes "/" MUST BE REPLACED with dashes "-" with .mount
# as extension.
# This means, if we want mount to "/storage/music2" (see above "Where=/storage/music2")
# then this file must be renamed to 'storage-music2.mount' and can be enabled via ssh with the
# command 'systemctl enable storage-music2.mount'

View file

@ -1,50 +0,0 @@
# This is a sample service script to mount NFS shares.
# Please read carefully the comments in this file. For production usage
# you can remove all comments (lines beginning with "#") from this file.
[Unit]
# The description should be used to explain what this servicefile is for
Description=test nfs mount script
# if we do network mounts like here we *require* 'network-online.service'
# which checks if the network is online
Requires=network-online.service
# our scripts must start *after* 'network-online.service', on timeout and if
# 'network-online.service' fails we can not mount and this scripts fails too
After=network-online.service
# usually we mount networks shares because we want they avaible *before* XBMC starts.
# so XBMC has access to this mounts from beginning. Note: this slows down the boot!
Before=kodi.service
[Mount]
# The share we want mount
What=192.168.0.31:/movies
# Where we want mount this share
Where=/storage/movies2
# Any options you usually use with the "-o" parameter in the mount command
Options=
# filesystem type
Type=nfs
[Install]
# The target is used by 'systemctl enable <name_of_this_file.mount>' to link
# this service to a runlevel for starting on boot. usually 'multi-user.target'
# is ok here.
WantedBy=multi-user.target
# Important:
# this file must be renamed to <mountpoint>.mount where <mountpoint>, is the FULL path
# where the share will be mounted but slashes "/" MUST BE REPLACED with dashes "-" with .mount
# as extension.
# This means, if we want mount to "/storage/movies2" (see above "Where=/storage/movies2")
# then this file must be renamed to 'storage-movies2.mount' and can be enabled via ssh with the
# command 'systemctl enable storage-movies2.mount'

View file

@ -1,44 +0,0 @@
[Unit]
Description=OpenVPN Autorun Service
[Service]
Type=forking
Requires=network-online.service
After=network-online.service
ExecStart=/usr/sbin/openvpn --daemon --config /storage/.config/openvpn.config
Restart=always
RestartSec=15
[Install]
WantedBy=kodi.target
# NOTES:
#
# 1) Edit /storage/.config/openvpn.config to the .config/.conf/.ovpn file
# from your VPN service provider and test it works first by connecting at
# the console:
#
# /usr/sbin/openvpn --daemon --config /storage/.config/openvpn.config
#
# 2) The openvpn.service file must be addeded to the active systemd config
# before it will work. This is done by running:
#
# systemctl enable openvpn.service
#
# 3) If you suspend/resume your LibreELEC system you will need to stop and
# restart the connection with a systemd *.power script, e.g.
#
# mkdir -p /storage/.config/sleep.d
# nano /storage/.config/sleep.d/01-openvpn.power
#
# Copy the sample script below. Remove # marks except for #!/bin/bash
#
# #!/bin/sh
# case "$1" in
# pre)
# systemctl stop openvpn.service
# ;;
# post)
# systemctl start openvpn.service
# ;;
# esac

View file

@ -7,7 +7,7 @@ PKG_VERSION="252.5"
PKG_LICENSE="LGPL2.1+"
PKG_SITE="http://www.freedesktop.org/wiki/Software/systemd"
PKG_URL="https://github.com/systemd/systemd-stable/archive/v${PKG_VERSION}.tar.gz"
PKG_DEPENDS_TARGET="toolchain libcap kmod util-linux entropy libidn2 wait-time-sync Python3:host jinja2:host"
PKG_DEPENDS_TARGET="toolchain libcap kmod util-linux libidn2 wait-time-sync Python3:host jinja2:host"
PKG_LONGDESC="A system and session manager for Linux, compatible with SysV and LSB init scripts."
PKG_MESON_OPTS_TARGET="--libdir=/usr/lib \

View file

@ -6,47 +6,42 @@
. /etc/profile
# Remove those sample files that we manage
for sample in $(find /storage/.config -name '*.sample' 2>/dev/null); do
[ -f /usr/config/${sample:16} ] && rm -f ${sample}
done
if [ ! -e "/storage/.configured" ]
then
# Copy config files, but don't overwrite. Only run if /storage is fresh
## cp -iRp /usr/config/* /storage/.config/ &>/dev/null
## ignore es_systems.cfg and switch to rsync
rsync -a --ignore-existing --exclude=es_systems.cfg /usr/config/* /storage/.config/
mkdir -p /storage/.config/emulationstation/themes
ln -s /usr/share/themes/es-theme-art-book-next /storage/.config/emulationstation/themes/system-theme
ln -s /usr/share/themes/es-theme-minielec /storage/.config/emulationstation/themes/es-theme-minielec
ln -s /usr/share/themes/es-theme-minimal /storage/.config/emulationstation/themes/es-theme-minimal
rsync -a --ignore-existing --exclude=es_systems.cfg /usr/config/* /storage/.config/ 2>&1 >/var/log/configure.log
mkdir -p /storage/.config/emulationstation/themes 2>&1 >>/var/log/configure.log
ln -s /usr/share/themes/es-theme-art-book-next /storage/.config/emulationstation/themes/system-theme 2>&1 >>/var/log/configure.log
ln -s /usr/share/themes/es-theme-minielec /storage/.config/emulationstation/themes/es-theme-minielec 2>&1 >>/var/log/configure.log
ln -s /usr/share/themes/es-theme-minimal /storage/.config/emulationstation/themes/es-theme-minimal 2>&1 >>/var/log/configure.log
### Link the game controller database so it is managed with OS updates.
rm -f /storage/.config/SDL-GameControllerDB/gamecontrollerdb.txt
ln -s /usr/config/SDL-GameControllerDB/gamecontrollerdb.txt /storage/.config/SDL-GameControllerDB/gamecontrollerdb.txt
rm -f /storage/.config/SDL-GameControllerDB/gamecontrollerdb.txt 2>&1 >>/var/log/configure.log
ln -s /usr/config/SDL-GameControllerDB/gamecontrollerdb.txt /storage/.config/SDL-GameControllerDB/gamecontrollerdb.txt 2>&1 >>/var/log/configure.log
### Remove and link es configs so they are managed with OS updates.
for es_cfg in es_features.cfg es_systems.cfg
do
ln -s /usr/config/emulationstation/${es_cfg} /storage/.config/emulationstation/${es_cfg}
ln -s /usr/config/emulationstation/${es_cfg} /storage/.config/emulationstation/${es_cfg} 2>&1 >>/var/log/configure.log
done
### Link the ES splash to the distribution splash
rm -f /storage/.config/emulationstation/resources/logo.png
ln -sf /usr/config/splash/splash.png /storage/.config/emulationstation/resources/logo.png
rm -f /storage/.config/emulationstation/resources/logo.png 2>&1 >>/var/log/configure.log
ln -sf /usr/config/splash/splash.png /storage/.config/emulationstation/resources/logo.png 2>&1 >>/var/log/configure.log
mkdir -p /storage/.config/modprobe.d
touch /storage/.configured
mkdir -p /storage/.config/modprobe.d 2>&1 >>/var/log/configure.log
touch /storage/.configured 2>&1 >>/var/log/configure.log
fi
if [ ! -e "/storage/.cache/ld.so.cache" ]
then
### Create library cache
ldconfig -X
ldconfig -X 2>&1 >>/var/log/configure.log
fi
if [ ! -d "/storage/.config/emulationstation/locale/" ]
if [ ! -d "/storage/.config/emulationstation/locale" ]
then
rsync -a --delete /usr/config/locale/ /storage/.config/emulationstation/locale/
rsync -a --delete /usr/config/locale/ /storage/.config/emulationstation/locale/ 2>&1 >>/var/log/configure.log
fi

View file

@ -1,20 +0,0 @@
# Keymaps table
#
# This table creates an association between a keycode file and a kernel
# driver. It can be used to automatically override a keycode definition.
#
#
# Format:
# driver - name of the driver provided via uevent - use * for any driver
# table - RC keymap table, provided via uevent - use * for any table
# file - file name. If directory is not specified, it is first looked up
# in /storage/.config/rc_keymaps, then /usr/lib/udev/rc_keymaps
#
# For example:
#
# driver table file
#
# gpio-rc-recv rc-streamzap streamzap
# gpio-rc-recv * justboom
# * rc-rc6-mce rc6_mce_new
# * * hauppauge_new

View file

@ -3,7 +3,7 @@
# Copyright (C) 2020-present Fewtarius
PKG_NAME="emulationstation"
PKG_VERSION="9d06419"
PKG_VERSION="f8ad59d"
PKG_GIT_CLONE_BRANCH="main"
PKG_REV="1"
PKG_ARCH="any"

View file

@ -0,0 +1,11 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright (C) 2022 - Fewtarius
PKG_NAME="synctools"
PKG_LICENSE="Apache-2.0"
PKG_SITE="www.jelos.org"
PKG_SECTION="virtual"
PKG_LONGDESC="Cloud/local sync tools metapackage."
PKG_DEPENDS_TARGET="rsync rclone syncthing"