aboutsummaryrefslogtreecommitdiff
path: root/update-infcloud-cache
blob: 162b8d1cb73b0306f819d3cfe4a533cce6158935 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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
test -z "${MANIFEST}" && 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
bgstack15