aboutsummaryrefslogtreecommitdiff
path: root/updater-ng-auto/files
diff options
context:
space:
mode:
authorKarel Kočí <karel.koci@nic.cz>2017-09-13 15:33:26 +0200
committerKarel Kočí <karel.koci@nic.cz>2017-09-13 15:33:26 +0200
commit74799790484128bc2de80a620b67aa584c204b6e (patch)
treecb5faee73240ca43a250949605648bec7817f3ba /updater-ng-auto/files
parentec7dbd0c3d7bff453883e7377e6ca974479aceb9 (diff)
downloadturris-myrepo-74799790484128bc2de80a620b67aa584c204b6e.tar.gz
turris-myrepo-74799790484128bc2de80a620b67aa584c204b6e.tar.bz2
turris-myrepo-74799790484128bc2de80a620b67aa584c204b6e.zip
Updater-ng-auto
Diffstat (limited to 'updater-ng-auto/files')
-rw-r--r--updater-ng-auto/files/updater.config9
-rw-r--r--updater-ng-auto/files/updater.defaults24
2 files changed, 33 insertions, 0 deletions
diff --git a/updater-ng-auto/files/updater.config b/updater-ng-auto/files/updater.config
new file mode 100644
index 0000000..4bc05ed
--- /dev/null
+++ b/updater-ng-auto/files/updater.config
@@ -0,0 +1,9 @@
+config pkglists pkglists
+ list lists 'cacerts'
+ list lists 'luci-controls'
+ list lists 'nas'
+ list lists 'netutils'
+
+config l10n 'l10n'
+ list langs 'cs'
+ list langs 'de'
diff --git a/updater-ng-auto/files/updater.defaults b/updater-ng-auto/files/updater.defaults
new file mode 100644
index 0000000..951558a
--- /dev/null
+++ b/updater-ng-auto/files/updater.defaults
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+# We want to generate some "random" time when the updater is run, every 12 hours.
+# The time when the router is first booted or the updater is installed for
+# the first time is as good source of the time as any.
+#
+# With date +%l we get time in interval 1-12. Substracting 1 gives us 0-11, and
+# the next run is 12-23 by adding 12. We may take the minutes as they are.
+#
+# We need to take care not to have leading zeroes, since tools tend to take that
+# as octal. We don't want to study which tools are OK with it, so we simply
+# don't have them.
+
+HOUR=$(($(date +%I | sed -e 's/^0*\(..*\)/\1/') - 1)) # We want 12-hour interval. And no leading zeroes (except for a lone 0)
+HOUR_NEXT=$(($HOUR + 12))
+MINUTE=$(date +%M | sed -e 's/^0*\(..*\)/\1/')
+
+# Generate the cron script
+(
+ echo 'MAILTO=""'
+ echo "$MINUTE $HOUR,$HOUR_NEXT * * * root /usr/bin/updater.sh >/dev/null 2>&1 &"
+ echo "0 0 * * * root /usr/bin/updater-unstuck.sh >/dev/null 2>&1"
+) >/etc/cron.d/updater
+chmod 0600 /etc/cron.d/updater