4 SAVE_LC_ALL="${LC_ALL}"
6 SAVE_LANGUAGE="${LANGUAGE}"
20 echo "Run this script from the top-level directory in the"
26 echo "usage: $0 <NAME> <PATCHFILE>"
31 test -n "${NAME}" || {
36 test -n "${PATCHFILE}" || {
41 test -f "${PATCHFILE}" || {
46 grep -q "<a name=\"${NAME}\"" "${PATCHFILE}" || {
47 echo "NAME[${NAME}] does not match content of PATCHFILE[${PATCHFILE}]"
51 grep -q "<a name=\"${NAME}\"" posted_news/*.body.html && {
52 echo "NAME[${NAME}] is not unique, choose another name"
53 grep "<a name=\"${NAME}\"" posted_news/*.body.html
57 nd=$(git diff -p --stat HEAD | wc -l)
58 test x"${nd}" = x"0" || {
59 echo "You have uncommited changes your working tree"
66 echo "ERROR: cleaning up"
69 for f in ${CLEANUP_FILES}; do
70 echo "Removing file[${f}]"
73 echo "failed to remove ${f}"
78 test -n "${CLEANUP_RESET_COMMIT}" && {
79 echo "Reverting to commit[${CLEANUP_RESET_COMMIT}]"
80 git reset "${CLEANUP_RESET_COMMIT}"
85 trap trap_handler INT QUIT TERM EXIT
87 utcdate=$(date --utc +"%d %B %Y")
88 utctime=$(date --utc +"%Y%m%d-%H%M%S")
91 CLEANUP_RESET_COMMIT="HEAD"
92 cat "${PATCHFILE}" | \
93 sed -e "s!@UTCTIME@!${utctime}!g" -e "s!@UTCDATE@!${utcdate}!g" | \
94 git am --ignore-whitespace
95 CLEANUP_RESET_COMMIT="HEAD^"
98 echo "Once you have pushed the commit a cronjob updates"
99 echo "the webserver content every 5-10 mins."
101 echo "Please verify the commit carefully before pushing:"
103 echo " git show -p --stat HEAD"
107 trap - INT QUIT TERM EXIT