From 74f9e0cfa0f01266fd3bd889ea93585ab0defd2c Mon Sep 17 00:00:00 2001 From: kx1t <15090643+kx1t@users.noreply.github.com> Date: Sat, 16 Dec 2023 08:20:35 -0500 Subject: [PATCH] Update update-plugins --- rootfs/scripts/update-plugins | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/rootfs/scripts/update-plugins b/rootfs/scripts/update-plugins index b3e0e0f..ccb0424 100755 --- a/rootfs/scripts/update-plugins +++ b/rootfs/scripts/update-plugins @@ -27,18 +27,16 @@ find /data -maxdepth 1 -name '*.~*~' -mtime +"${BACKUP_RETENTION_TIME:-30}" -exe #APPNAME="${APPNAME:-plugin-updates}" s6wrap=(s6wrap --quiet --timestamps --prepend="$(basename "$0")") -function update_refreshrate () { - # update or create the refreshrate.pjs plugin if needed - if [[ -n "${REFRESHRATE}" ]]; then - if [[ -f /data/plugins/refreshrate.pjs ]]; then - sed -i "s/^\s*#*\s*refreshIntervalMs.*\$/refreshIntervalMs = $REFRESHRATE/Ig" /data/plugins/refreshrate.pjs - else - echo "refreshIntervalMs = $REFRESHRATE/Ig" > /data/plugins/refreshrate.pjs - fi +# update or create the refreshrate.pjs plugin if needed +if [[ -n "${REFRESHRATE}" ]]; then + if [[ -f /data/plugins/refreshrate.pjs ]]; then + sed -i "s/^\s*#*\s*refreshIntervalMs.*\$/refreshIntervalMs = $REFRESHRATE/Ig" /data/plugins/refreshrate.pjs else - rm -f /data/plugins/refreshrate.pjs + echo "refreshIntervalMs = $REFRESHRATE/Ig" > /data/plugins/refreshrate.pjs fi -} +else + rm -f /data/plugins/refreshrate.pjs +fi if ! chk_enabled "${UPDATE_PLUGINS}" then @@ -90,8 +88,9 @@ else cp -n /tmp/AIS-catcher/plugins/* /data/plugins/ >/dev/null 2>&1 fi -# update or create the refreshrate.pjs plugin if needed -update_refreshrate +if [[ -n "${REFRESHRATE}" ]]; then + rm -f /data/plugins/refreshrate.pjs +fi # remove any plugin backups older than BACKUP_RETENTION_TIME (or 30 days if undefined) find /data/plugins -name '*.~*~' -mtime +"${BACKUP_RETENTION_TIME:-30}" -exec rm {} \;