X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=scripts%2Ftools%2Ffg-submit;h=9ca695ff803d6abd9dbbb68d6b5ae8c549c94cd2;hb=991beb0b5ecf08df56ad77f6a49b0e20c191be11;hp=fb550c99aed69f169794446f3516a96f812b414b;hpb=f39ad54d9324367f699f7754e39395d5d3d2231d;p=flightgear.git diff --git a/scripts/tools/fg-submit b/scripts/tools/fg-submit index fb550c99a..9ca695ff8 100755 --- a/scripts/tools/fg-submit +++ b/scripts/tools/fg-submit @@ -28,7 +28,7 @@ # 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)"' # # # @@ -36,12 +36,12 @@ # 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 @@ -50,9 +50,14 @@ # 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 # # @@ -64,12 +69,12 @@ # 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 ... accept & report matching file -# DENY ... reject & report matching file -# IGNORE ... silently reject matching file +# ALLOW ... accept & report matching file +# DENY ... reject & report matching file +# IGNORE ... silently reject matching file # # A is a space-separated list of shell pattern. # It may also be empty, in which case it has no effect. Examples: @@ -79,12 +84,12 @@ # # 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: @@ -93,7 +98,7 @@ # 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) # @@ -112,8 +117,8 @@ -SELF=${0/#*\/} -DIR=${PWD/#*\/} +SELF=${0##*/} +DIR=${PWD##*/} if [ "$1" == "-v" ]; then DBG=1 @@ -143,7 +148,7 @@ DEFAULT_RULES=" +.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* " @@ -223,25 +228,27 @@ function search_config { 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 @@ -258,7 +265,7 @@ trap "rm -rf $TMP" 0 1 2 3 13 15 -# 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 @@ -266,7 +273,7 @@ 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 @@ -317,20 +324,14 @@ if [ -f $TMP/check ]; 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 @@ -360,5 +361,6 @@ else fi -[ -x "$UPLOAD" -a -f $RESULT ] && exec $UPLOAD $RESULT $DIFF +[ -x "$UPLOAD" -a -f $RESULT ] && $UPLOAD $RESULT $DIFF +