#! /bin/sh # automatic saving of logs from Novell Bugzilla # http://en.opensuse.org/User:Mvidner # v 0.4, using bnc_curl, checking URL set -o errexit : ${BUGLOG_DIR=$HOME/logs} # if stdout is not a terminal, open one if [ "$1" == "-n" ]; then shift else test -t 1 || exec xterm -e "$0" "$@" fi if [ "$1" == "--install" ]; then # enabling this as a konqueror plugin (thanks Seli): cat > ~/.kde/share/apps/konqueror/servicemenus/buglog.desktop <"$AEF" # Edit Attachment #72681 for Bug #156830 # update: Attachment 94209 Details for Bug 194106 BUGNUM=`sed -n 's/.*Attachment .* for Bug #*\([0-9]*\).*/\1/;T;p;q' "$AEF"` # # 'N' appends next line ATTF=`sed -n '/name="filename"/{N;s/.*value="\([^"]*\)".*/\1/;T;p;q;}' "$AEF"` if [ -z "$BUGNUM" -a -z "$ATTF" ]; then echo "Empty bug number and attachment filename. Skipping." else ATTF="${BUGLOG_DIR}/$BUGNUM-$ATTF" mkdir -p "${BUGLOG_DIR}" echo "Reading attachment data > $ATTF" bnc_curl "$AU" >"$ATTF" fi if test -t 1; then # wait before closing the xterm WAIT=30 echo Waiting $WAIT seconds, press Enter to finish now. read -t $WAIT fi