3 # Script for updating OpenXPKI nightly snapshot at a www mirror.
6 if [ ! -x ${WGET} ]; then
7 WGET
="/usr/local/bin/wget"
11 # Fetch newer files from the master server
12 # (do NOT shorten the name "sourceforge" below,
13 # this would ruin the operation of wget):
14 #${WGET} -nH -m -I lastmidnight http://openxpki.sourceforge.net/lastmidnight/index.html
16 ${WGET} -nH -m -I lastmidnight http
://www7.openxpki.org
/lastmidnight
/index.html
18 # Remove those files at the mirror, which are
19 # not referenced by new index.html any more:
21 cd ${THIS_DIR}/lastmidnight
22 # Find files which names begin with a letter and contain only appropriate
23 # characters (letters, digits, '-' and '.')
24 FILES_LIST
=`find ./ -maxdepth 1 -type f -regex "\./[a-zA-Z][a-zA-Z0-9\.-]*"`
26 for file in ${FILES_LIST}; do
27 file=`echo $file | sed -e 's/\.\///'`
28 if [ ! $file = 'index.html' ]; then
29 RES
=`grep -e href=\"$file\" index.html`
30 if [ ! "${RES}" ]; then
31 echo "File $file will be removed"
32 rm -f ${THIS_DIR}/lastmidnight
/$file
33 fi # if a file is absent from index.html
34 fi # if a file is not index.html