source: npl/signpkg @ d849d83

gcc484ntopperl-5.22
Last change on this file since d849d83 was c5c522c, checked in by Edwin Eefting <edwin@datux.nl>, 8 years ago

initial commit, transferred from cleaned syn3 svn tree

  • Property mode set to 100755
File size: 1010 bytes
Line 
1#!/bin/bash
2
3PKGDIR=/tmp/$$.signpkg
4
5if ! [ "$GPG_AGENT_INFO" ];then
6        echo "Please run gpg agent with:"
7        echo "gpg-agent --daemon bash"
8        exit 1
9fi
10
11trap "rm -rf $PKGDIR" 0
12
13while true; do
14        PKG=$1
15        shift
16        [ "$PKG" ] || exit 0
17       
18        if ! echo "$PKG" | grep '^/' >/dev/null; then
19                BASENAME="`pwd`/$PKG"
20        else
21                BASENAME="$PKG"
22        fi
23
24        if [ -f "$BASENAME.asc" ]; then
25                echo "$PKG is already signed, skipping..."
26                continue
27        fi
28       
29        rm -rf "$PKGDIR" 2>/dev/null
30        mkdir "$PKGDIR" || exit 1
31
32        echo "Checksumming $PKG..."
33        md5sum -b $PKG  > $BASENAME.tmp
34       
35        echo "Extracting $PKG..."
36        tar --exclude 'dev/*' --no-same-permissions --no-same-owner --directory $PKGDIR -xzf $PKG || exit 1
37        chmod -R 755 $PKGDIR || exit 1
38       
39        echo "Checksumming files..."
40        pushd $PKGDIR >/dev/null || exit 1
41        find -type f -exec md5sum -b "{}" \; >> $BASENAME.tmp || exit 1
42        popd >/dev/null
43
44        echo "Signing $BASENAME.tmp..."
45        gpg --clearsign $BASENAME.tmp || exit 1
46        rm $BASENAME.tmp || exit 1
47        mv $BASENAME.tmp.asc $BASENAME.asc || exit 1
48done
49
Note: See TracBrowser for help on using the repository browser.