aboutsummaryrefslogtreecommitdiff
path: root/update-infcloud-cache
blob: 071ec778aae24b47e7de91840f2959b33ae25c88 (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
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