aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-11-29 15:13:11 -0800
committerRobin H. Johnson <robbat2@gentoo.org>2015-11-29 15:13:11 -0800
commita88756a60a04f469139077268338c10af29e85df (patch)
treef7462e6ee33af2f9fa7ac0191f1a21190e309469 /datestamp.sh
downloadmastermirror-scripts-a88756a60a04f469139077268338c10af29e85df.tar.gz
mastermirror-scripts-a88756a60a04f469139077268338c10af29e85df.tar.bz2
mastermirror-scripts-a88756a60a04f469139077268338c10af29e85df.zip
Initial commit.
Copied from git+ssh://git@git.gentoo.org/infra/cfengine.git repo as: timestamp 2015-11-29T21:57:00Z commit 3b63da8fbbb848d5a1f7e7cd7c6989638ed0d817 No passwords, passphrases or key material is contained herein, but it may reference the pathes to such. Reviewed-by: Robin H. Johnson <robbat2@gentoo.org> Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Diffstat (limited to 'datestamp.sh')
-rwxr-xr-xdatestamp.sh18
1 files changed, 18 insertions, 0 deletions
diff --git a/datestamp.sh b/datestamp.sh
new file mode 100755
index 0000000..de6ef9a
--- /dev/null
+++ b/datestamp.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+# distributed by cfengine
+
+umask 022 # ensure globally readable perms on new files for rsyncd
+
+source /usr/local/bin/mastermirror/rsync-gen.vars
+
+# The only time ${STAGEDIR}/metadata should not exist is when rsync-gen.sh
+# hasn't ran even once yet
+if [[ -d ${STAGEDIR}/metadata ]]; then
+ /bin/date -u '+%s %c' > ${STAGEDIR}/metadata/timestamp.x.tmp
+ /bin/mv ${STAGEDIR}/metadata/timestamp.x.tmp ${STAGEDIR}/metadata/timestamp.x
+fi
+
+if [[ -d ${FINALDIR}/metadata ]]; then
+ /bin/date -R -u > ${FINALDIR}/metadata/timestamp.chk.tmp
+ /bin/mv ${FINALDIR}/metadata/timestamp.chk.tmp ${FINALDIR}/metadata/timestamp.chk
+fi