Skip to Content.
Sympa Menu

sm-discuss - Re: [SM-Discuss] update-history: a script for very-very-lazy gurus

sm-discuss AT lists.ibiblio.org

Subject: Public SourceMage Discussion List

List archive

Chronological Thread  
  • From: "Dale E. Edmons" <demaillists AT comcast.net>
  • To: Ismael Luceno <ismael.luceno AT gmail.com>
  • Cc: SM-Discuss <sm-discuss AT lists.ibiblio.org>
  • Subject: Re: [SM-Discuss] update-history: a script for very-very-lazy gurus
  • Date: Tue, 01 Apr 2008 04:00:35 -0700

Ismael,

Cool. I wonder if it'd be worth creating a git repo (repo.or.cz?)
that each of us could add a few of our favorite scripts to. This
might benefit the whole community as it would at least give one
a starting place if doing something similar.

I have two scripts that fit this category: backup, switchmga. The
backup script's main function is obvious, but if the name is linked
to by lchroot, lmount, lumount, it serves to customize these primary
commands. switchmga will switch between xorg-modular's video
drivers for the mga. It could be easily adapted to any driver and
I've included env variables to assist.

Any thoughts?


Dale E. Edmons
(aka linuxfan)


Ismael Luceno wrote:
Hi lazy people (if you're not lazy, don't read this e-mail :P).

The following script will make your life even easier, updating
HISTORY for you. Next week I will write a script to tie the laces of
your shoes :P.


#!/bin/sh
[ $# = 0 ] && {
echo "Usage: $0 <msg> [file]..."
exit
}

MSG="$1"; shift

DATE="`date --rfc-3339=date`"
NAME="`git-config --get user.name`"
EMAIL="`git-config --get user.email`"

PREVDIR=
FILES=

{ git-ls-files -m -d "$@"; echo; } | while read FILE; do
DIR="`dirname "$FILE"`"

if [ -n "$PREVDIR" -a "$PREVDIR" != "$DIR" ]; then
mv "$PREVDIR/HISTORY" "$PREVDIR/HISTORY.old"
FILES="`echo "$FILES" | sed 's/^, //'`"

cat > "$PREVDIR/HISTORY" << EOF
$DATE $NAME <$EMAIL>
* $FILES: $MSG

EOF
cat "$PREVDIR/HISTORY.old" >> "$PREVDIR/HISTORY"
rm -f "$PREVDIR/HISTORY.old"
FILES=
fi

FILES="$FILES, `basename "$FILE"`"
PREVDIR="$DIR"
done

------------------------------------------------------------------------

_______________________________________________
SM-Discuss mailing list
SM-Discuss AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/sm-discuss





Archive powered by MHonArc 2.6.24.

Top of Page