Hanno Böck commited on 2025-01-07 11:10:31
Zeige 1 geänderte Dateien mit 36 Einfügungen und 0 Löschungen.
... | ... |
@@ -0,0 +1,36 @@ |
1 |
+#!/bin/bash |
|
2 |
+# |
|
3 |
+# This script is used to generate the update files for freewvs. |
|
4 |
+# You do not need it if you merely want to use freewvs. |
|
5 |
+# |
|
6 |
+# SPDX-License-Identifier: 0BSD |
|
7 |
+ |
|
8 |
+TARGETDIR="$HOME/websites/freewvsdb.schokokeks.org/htdocs/" |
|
9 |
+GITDIR="$HOME/gitmirror/freewvs/" |
|
10 |
+ |
|
11 |
+TIMESTAMP=$(git --git-dir $GITDIR.git --no-pager log --format=%ct -1) |
|
12 |
+ |
|
13 |
+TIMESTAMP_OLD=0 |
|
14 |
+if [ -e "$TARGETDIR/freewvsdb.timestamp" ]; then |
|
15 |
+ TIMESTAMP_OLD=$(cat "$TARGETDIR/freewvsdb.timestamp") |
|
16 |
+fi |
|
17 |
+ |
|
18 |
+if [ "$TIMESTAMP" -lt "$TIMESTAMP_OLD" ]; then |
|
19 |
+ echo "ERROR: New timestamp is smaller than old timestamp" |
|
20 |
+ exit 1 |
|
21 |
+fi |
|
22 |
+ |
|
23 |
+if [ "$TIMESTAMP" -eq "$TIMESTAMP_OLD" ]; then |
|
24 |
+ # nothing to do |
|
25 |
+ exit 0 |
|
26 |
+fi |
|
27 |
+ |
|
28 |
+# We try to be as reproducible as possible, see |
|
29 |
+# https://h2.jaguarpaw.co.uk/posts/reproducible-tar/ |
|
30 |
+pushd $GITDIR/freewvsdb >/dev/null |
|
31 |
+tar --sort=name --mtime="@$TIMESTAMP" --owner=0 --group=0 --numeric-owner \ |
|
32 |
+ --strip-components=99 \ |
|
33 |
+ -cJf $TARGETDIR/$TIMESTAMP.tar.xz \ |
|
34 |
+ *.json |
|
35 |
+popd >/dev/null |
|
36 |
+echo -n $TIMESTAMP >$TARGETDIR/freewvsdb.timestamp |
|
0 | 37 |