Fix browser cache issues with the scouting app
Before this patch, folks had trouble getting the latest version of the
scouting app when visiting https://scouting.frc971.org/. The reason
for that is that they used the `Last-Modified` timestamp of the
individual files to determine whether they need to be fetched. Because
of `pkg_tar()`'s reproducibility, the timestamp is always the same.
This patch works around this by adding a `touch` step to the package's
`postinst`. This step updates the `Last-Modified` time of each
deployed file to the current time. In essence, every time the scouting
app is deployed, users should now see the latest version.
Signed-off-by: Philipp Schrader <philipp.schrader@gmail.com>
Change-Id: I6ba71c0a3ce791c0b281736397ff75c4375a1000
diff --git a/scouting/deploy/postinst b/scouting/deploy/postinst
index a7a8b16..be2b170 100644
--- a/scouting/deploy/postinst
+++ b/scouting/deploy/postinst
@@ -19,6 +19,10 @@
# Make sure it's all usable by the user.
chown -R www-data:www-data /var/frc971/scouting/
+# Update the timestamps on the files so that web browsers pull the new version.
+# Otherwise users have to explicitly bypass the cache when visiting the site.
+find /opt/frc971/scouting_server/scouting/www/ -type f -exec touch {} +
+
systemctl daemon-reload
systemctl enable scouting.service
systemctl start scouting.service || :