Skip to content

Commit

Permalink
Update update-plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
kx1t authored Dec 16, 2023
1 parent a044338 commit 74f9e0c
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions rootfs/scripts/update-plugins
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {} \;
Expand Down

0 comments on commit 74f9e0c

Please sign in to comment.