# to have the date in the archive name can conveniently achieve this
# by defining a shell alias in ~/.bashrc:
#
-# alias submit='fg-submit "${PWD/#*\/}-$(date +%Y-%m-%d)"'
+# alias submit='fg-submit "${PWD##*/}-$(date +%Y-%m-%d)"'
#
#
#
# this at the end with two arguments:
#
# $1 ... archive or compressed diff for submission
-# $2 ... accessory diff, *NOT* for submission!
+# $2 ... accessory uncompressed diff, *NOT* for submission!
#
# $1 and $2 are guaranteed not to contain spaces, only $1 is guaranteed
# to actually exist. Such a script can be used to upload the file to an
# ftp-/webserver, and/or to remove one or both files. Example using
-# KDE's kfmclient for upload (alternatives: ncftpput, gnomevfs-copy, wput):
+# KDE's kfmclient for upload (alternatives: ncftpput, gnomevfs-copy):
#
# $ cat ~/bin/fg-upload
# #!/bin/bash
# echo "deleting $1 $2"
# rm -f $1 $2
#
-# echo "Done. URL: ftp://server.com/$1"
+# URL=ftp://server.com/$1
+#
+# # copy URL to KDE's clipboard, so that MMB-clicking pastes it
+# dcop klipper klipper setClipboardContents $URL
+#
+# echo "Done. --> $URL"
# else
-# echo "arghh ... HELP! HELP!"
+# echo "$0: uploading failed!"
# fi
#
#
# in its parent directory, in its grand-parent directory and so on,
# and finally in the $HOME directory. The first found file is taken.
#
-# A file can use a list of four keywords with arguments, each on a
+# A file can use a list of three keywords with arguments, each on a
# separate line:
#
-# ALLOW <pattern-list> ... accept & report matching file
-# DENY <pattern-list> ... reject & report matching file
-# IGNORE <pattern-list> ... silently reject matching file
+# ALLOW <pattern-list> ... accept & report matching file
+# DENY <pattern-list> ... reject & report matching file
+# IGNORE <pattern-list> ... silently reject matching file
#
# A <pattern-list> is a space-separated list of shell pattern.
# It may also be empty, in which case it has no effect. Examples:
#
# The list of pattern is checked in the same order in which it was
# built. The first match causes a file to be accepted or rejected.
-# Further matches are not considered. Comments using the
-# hash character '#' are allowed and ignored.
+# Further matches are not considered. Comments using the hash
+# character '#' are allowed and ignored.
#
# Some default rules are always added at the end. If you want to
-# bypass them, then just add "ALLOW *" or "DENY *" at the end of
-# your configuration, and no file will ever reach the default rules.
+# bypass them, then finish your configuration with an "ALLOW *"
+# or "DENY *", and no file will ever reach the default rules.
#
#
# Example:
# ALLOW *.xcf # ... allow all other GIMP images (the default
# # rules would otherwise throw them out)
#
-# ALLOW g.old # add this silly file, but ...
+# ALLOW not.old # add this file, but ...
# IGNORE *.old # throw out all other "old" files (and don't
# # report that to the terminal)
#
-SELF=${0/#*\/}
-DIR=${PWD/#*\/}
+SELF=${0##*/}
+DIR=${PWD##*/}
if [ "$1" == "-v" ]; then
DBG=1
+.cvsignore +*/.cvsignore
-*~ -*. -*.bak -*.orig
-*.RGB -*.RGBA -*.MDL
- -*.xcf -*.XCF -*.tga -*.TGA -*.bmp -*.BMP -*.png -*.PNG
+ -*.XCF -*.tga -*.TGA -*.bmp -*.BMP -*.PNG
-*.blend -*.blend[0-9] -*blend[0-9][0-9] -*.blend[0-9][0-9][0-9]
-*.gz -*.tgz -*.bz2 -*.zip -*.tar.gz* -*.tar.bz2*
"
CONFIG="$file"
return 0
elif [ "$1" ]; then
- search_config ${1%/${1/#*\/}} # parent dir
+ search_config ${1%/${1##*/}} # parent dir
return
fi
return 1
}
+set -f
RULES=
if search_config "$PWD"; then
LOG "loading config file $CONFIG"
source "$CONFIG"
elif [ -f ~/$CONFIG_FILE ]; then
- DEBUG "loading config file $CONFIG"
+ DEBUG "loading config file ~/$CONFIG_FILE"
source ~/$CONFIG_FILE
elif [ -f ~/${CONFIG_FILE}rc ]; then
- DEBUG "loading config file $CONFIG"
+ DEBUG "loading config file ~/${CONFIG}rc"
source ~/${CONFIG_FILE}rc
fi
RULES="$PREFIX_RULES $RULES $DEFAULT_RULES $POSTFIX_RULES"
+set +f
if [ $DBG ]; then
-# move old files out of the way giving sequential suffixes
+# move old files out of the way adding sequential suffixes
for i in $DIFF $CDIFF $ARCHIVE; do
[ -f $i ] && mv $i $(backup_filename $i)
done
LOG "updating and checking for new files ..."
-$CVS -q up -dP >$TMP/up
+$CVS -q up -dP >$TMP/up || exit 1
if grep "^C " $TMP/up &>/dev/null; then
DEBUG "checking whether file '$i' matches"
for r in $RULES; do
DEBUG "\t\trule $r"
- rule=${r#?}
- case "!$i" in $r)
- DEBUG "\t\t\t\"silently\" rejected\t\t$rule"
- break
- ;;
- esac
- case "-$i" in $r)
- REJECT "$i\t\t$rule"
- break
- ;;
- esac
- case "+$i" in $r)
- NEW "$i\t\t$rule"
- echo "$i" >>$TMP/files
+ class=${r:0:1}
+ rule=${r:1}
+ case "$i" in $rule)
+ case $class in
+ !) DEBUG "$i\t\t\"silently\" rejected\t\t$rule" ;;
+ -) REJECT "$i\t\t$rule" ;;
+ +) NEW "$i\t\t$rule" && echo "$i" >>$TMP/files ;;
+ esac
break
;;
esac
fi
-[ -x "$UPLOAD" -a -f $RESULT ] && exec $UPLOAD $RESULT $DIFF
+[ -x "$UPLOAD" -a -f $RESULT ] && $UPLOAD $RESULT $DIFF
+