diff options
author | rhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58> | 2008-11-27 19:58:42 +0000 |
---|---|---|
committer | rhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58> | 2008-11-27 19:58:42 +0000 |
commit | 254aadb51e2401e73be2edafea453079b2b761f2 (patch) | |
tree | fabdbc043a808cf6e47873c0e9b33662ea471b49 /trunk/lib | |
parent | 27b59b59e8fb3deefe10be5225ab6bf9c80dc0b6 (diff) | |
download | simplepkg-254aadb51e2401e73be2edafea453079b2b761f2.tar.gz simplepkg-254aadb51e2401e73be2edafea453079b2b761f2.tar.bz2 |
more binary repository management improvements
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@545 04377dda-e619-0410-9926-eae83683ac58
Diffstat (limited to 'trunk/lib')
-rw-r--r-- | trunk/lib/common.sh | 52 |
1 files changed, 51 insertions, 1 deletions
diff --git a/trunk/lib/common.sh b/trunk/lib/common.sh index 857d01e..2fc49c9 100644 --- a/trunk/lib/common.sh +++ b/trunk/lib/common.sh @@ -753,7 +753,8 @@ function gen_md5_checksums { cwd="`pwd`" cd $1 - echo '' > CHECKSUMS.md5 + echo 'MD5 digest for files in this directory.' > CHECKSUMS.md5 + echo '' >> CHECKSUMS.md5 find . -type f -name '*.tgz' -exec md5sum {} \; >> CHECKSUMS.md5 cat CHECKSUMS.md5 | gzip -9 -c - > CHECKSUMS.md5.gz @@ -772,6 +773,37 @@ function gen_md5_checksums { } +function update_md5_checksum { + + # update CHECKSUMS.md5 + # usage: update_md5_checksums <folder> <file> + + if [ -z "$2" ] || [ ! -d "$1" ] || [ ! -f "$file" ]; then + return 1 + fi + + if ! echo $2 | grep -q -e "^\.\/"; then + # add ./ in front of the file name + file="./$1" + else + file="$1" + fi + + if [ ! -f CHECKSUMS.md5 ]; then + gen_md5_checksums . + else + # remove the old entry and add a new one + sed -i "/ $(regexp_slash $file)$/d" CHECKSUMS.md5 + md5sum $file >> CHECKSUMS.md5 + fi + + cat CHECKSUMS.md5 | gzip -9 -c - > CHECKSUMS.md5.gz + + svn_add CHECKSUMS.md5 + svn_add CHECKSUMS.md5.gz + +} + function gen_meta { # generate metafiles @@ -1040,3 +1072,21 @@ function is_number { fi } + +function regexp_slash { + + # escape slashes + echo $1 | sed -e 's/\//\\\//g' + +} + +function su_svn { + + # execute svn using a different user + if [ ! -z "$SVN_USER" ]; then + su $SVN_USER -c "svn $*" + else + svn $* + fi + +} |