Added dialog for HTML export. Grouping in Switchboard shortcuts
6 set -e # abort on errors
7 shopt -s nullglob # file globs that don't match expand
11 # Check if $EDITOR is set, otherwise set to "vi".
16 # Check for -f option ()
18 if [ "$1" = -f ]; then
24 # Detect the name of the file to edit
35 FILE=$(package_name $1).changelog
40 if [ -z "$FILE" ]; then
41 for f in *.changelog; do
42 if [ -n "$FILE" ]; then
50 if [ -z "$FILE" ]; then
52 if [ -n "$FILE" ]; then
58 if [ -n "$FILE" ]; then
59 FILE=$(package_name $FILE).changelog
63 if [ -z "$FILE" ]; then
64 echo "usage: ${0##*/} [filename[.changelog]|path [file_with_comment]]"
65 echo "If no <filename> is given, exactly one *.changelog or"
66 echo "*.spec file has to be in the cwd or in <path>."
72 # Add domain to username (if it's me ;-)
75 #if [ $user = "uwedr" ]; then
76 # user="$user@suse.de"
82 # Create the lockfile and temporary file.
84 lockfile=.${FILE##*/}.lock
85 if [ "${FILE/\//}" != "$FILE" ]; then
86 lockfile=${FILE%/*}/.$lockfile
89 if [ ! -w "$(dirname "$FILE")" ]; then
90 echo "Write access to directory $(dirname "$FILE") required" >&2
94 if [ -e "$FILE" -a ! -w "$FILE" ]; then
95 echo "Write access to file $FILE required" >&2
100 while ! echo $$@$(hostname -f) 2> /dev/null > $lockfile; do
101 if [ -z "$retry_lock" ]; then
102 echo "$lockfile: Lock by process $(cat $lockfile)" >&2
103 echo "Please remove stale lockfiles manually" >&2
106 echo "$lockfile: Waiting for process $(cat $lockfile) to release lock" >&2
111 tmpfile=$(mktemp /tmp/${0##*/}.XXXXXX)
112 trap "rm -f $lockfile $tmpfile" EXIT
115 # Prepare the working copy and start the editor
118 { timestamp=$(LC_ALL=POSIX TZ=Europe/Berlin date)
119 echo "-------------------------------------------------------------------"
120 echo "$timestamp - $user"
122 if [ -z "$COMMENT_FILE" ]; then
128 if [ -f "$FILE" ]; then
134 if [ -z "$COMMENT_FILE" ]; then
136 CHKSUM_BEFORE=$(md5sum $tmpfile | awk '{print $1}')
138 lines=$(wc -l $COMMENT_FILE | awk '{print $1}')
139 CHKSUM_BEFORE=has_changed
142 $EDITOR +$((3+lines)) $tmpfile
144 if [ "$CHKSUM_BEFORE" = "$(md5sum $tmpfile | awk '{print $1}')" ]; then