diff options
Diffstat (limited to 'update-infcloud-cache')
-rwxr-xr-x | update-infcloud-cache | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/update-infcloud-cache b/update-infcloud-cache new file mode 100755 index 0000000..071ec77 --- /dev/null +++ b/update-infcloud-cache @@ -0,0 +1,15 @@ +#!/bin/bash +# File: /usr/sbin/update-infcloud-cache +# Part of infcloud rpm for stackrpms +# Use this script every time you modify any file to force browsers to reload it (empty HTML5 cache). + +USE_BIN=none +MANIFEST=/etc/infcloud/cache.manifest +test -e $( command -v ed 2>/dev/null ) && USE_BIN=ed +test -e $( command -v sed 2>/dev/null ) && USE_BIN=sed +command -v "${USE_BIN}" &> /dev/null || { echo "Error: 'ed' not installed. Aborting." > /dev/stderr; exit 1; } +case "${USE_BIN}" in + ed) printf ",s/#V.*/#V $(date '+%Y%m%d%H%M%S')/\nw\nq\n" | ed -s "${MANIFEST}" ;; + sed) sed -i -r -e "s/^#V.*/#V $(date "+%Y%m%d%H%M%S" )/;" "${MANIFEST}" ;; + *) echo "Error: need ed or sed. Aborted." 1>/dev/stderr ; exit 1 ;; +esac |