Mercurial > masqmail
annotate devel/gen-dist @ 249:f9da5a7caeda
refactored the cmdline argument processing
I replaced the nested switch statements with one single
large else-if construct. Instead of char comparision now
str(n)cmp(3) is used. Although this is slower it is much
more readable and covers corner-cases which were uncovered
before (e.g. -bdxxx).
As always: Readability and simplicity matter, not performance.
author | markus schnalke <meillo@marmaro.de> |
---|---|
date | Thu, 04 Nov 2010 11:02:42 -0300 |
parents | 7b70bf4f1f42 |
children |
rev | line source |
---|---|
47 | 1 #!/bin/sh |
2 # | |
3 # generate a tar.gz archive to distribute | |
4 # generate an md5sum and a detached signature of the archive | |
5 # | |
6 # requires: | |
7 # - mercurial (hg) | |
8 # - md5sum | |
9 # - gnupg | |
10 | |
11 if [ $# -ne 1 -o -e "$1" ] ; then | |
60 | 12 echo "usage: gen-dist DEST.tar.gz" 2>&1 |
47 | 13 exit 1 |
14 fi | |
15 | |
50
1761b3bde646
fixed wrong paths in the md5sum file (gen-dist)
meillo@marmaro.de
parents:
47
diff
changeset
|
16 dir="${1%/*}" |
1761b3bde646
fixed wrong paths in the md5sum file (gen-dist)
meillo@marmaro.de
parents:
47
diff
changeset
|
17 file="${1##*/}" |
1761b3bde646
fixed wrong paths in the md5sum file (gen-dist)
meillo@marmaro.de
parents:
47
diff
changeset
|
18 |
104
b212da6385a8
remove all mercurial files from distribution
meillo@marmaro.de
parents:
60
diff
changeset
|
19 hg archive -t tgz -X .hg\* "$1" |
50
1761b3bde646
fixed wrong paths in the md5sum file (gen-dist)
meillo@marmaro.de
parents:
47
diff
changeset
|
20 |
1761b3bde646
fixed wrong paths in the md5sum file (gen-dist)
meillo@marmaro.de
parents:
47
diff
changeset
|
21 cd "$dir" |
1761b3bde646
fixed wrong paths in the md5sum file (gen-dist)
meillo@marmaro.de
parents:
47
diff
changeset
|
22 md5sum "$file" >"$file.md5sum" |
1761b3bde646
fixed wrong paths in the md5sum file (gen-dist)
meillo@marmaro.de
parents:
47
diff
changeset
|
23 gpg -ab "$file" |