#!/bin/sh set -e export LANG=C STATEDIR=/org/www.debian.or.jp/var/lib/www.debian.or.jp DSA_URL=https://www.debian.org/security/dsa RSS_URL='http://localhost/blog/index.cgi/index.rss?recache=all' do_update=false if [ "$(whoami)" != "wwwadm" ]; then exec sudo -u wwwadm -H $0 fi P=$(pwd) cd $STATEDIR if wget -m $DSA_URL 2>&1 | grep -q 'Downloaded:'; then nkf -e www.debian.org/security/dsa | sed -e "s/utf\-8/x-euc-jp-unicode/" > dsa.ja.euc-jp do_update=true fi if wget -q --header='Host: www.debian.or.jp' -O index.rss $RSS_URL; then sed -e "s/EUC-JP/x-euc-jp-unicode/" -e "s/index.cgi\///g" < index.rss > news.rss if ! diff -q news.rss.old news.rss > /dev/null; then cp news.rss news.rss.old do_update=true fi fi if $do_update; then cd $P ttree index.tt2 fi