From 7a378226a1e30f0654c4135371e252ca8fe0d767 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Wed, 20 May 2015 12:03:54 +0200 Subject: [PATCH] Added mangle-changelog.sh for transforming the original changelog from LSI into a 'normal' file --- mangle-changelog.sh | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100755 mangle-changelog.sh diff --git a/mangle-changelog.sh b/mangle-changelog.sh new file mode 100755 index 0000000..07f8e90 --- /dev/null +++ b/mangle-changelog.sh @@ -0,0 +1,45 @@ +#!/bin/bash + + +set -e +set -u + +CUR_DIR=$( dirname $0 ) + +if [[ "$#" -ne "1" ]] ; then + cat >&2 <&2 + exit 1 +fi + +TEMP_FILE=$(mktemp tmp.changelog.XXXXXXXXXX.txt) + +cleanup() { + if [[ -f "${TEMP_FILE}" ]] ; then + rm -v "${TEMP_FILE}" + fi +} + +trap "cleanup; echo 'Exception while running $0'; exit 5" INT TERM EXIT + +iconv -f windows-1252 -t utf-8 "${ORIG}" > "${TEMP_FILE}" +dos2unix "${TEMP_FILE}" +sed -i -e 's/[ ][ ]*$//' "${TEMP_FILE}" + +mv -vi "${TEMP_FILE}" "${CUR_DIR}/changelog.txt"