Skip to main content
summaryrefslogtreecommitdiffstats
blob: b1743a38a80c5cdafa3fb897a0c71491f95e317f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash -e

#*******************************************************************************
# Copyright (c) 2009 Tasktop Technologies and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# Contributors:
#      Tasktop Technologies - initial API and implementation
#*******************************************************************************

if [ $# -lt 3 ]
then
  echo "usage: sign-and-wait.sh srcdir signdir filter"
  exit 1
fi

set -x

SRC=$1
DST=/home/data/httpd/download-staging.priv/$2
OUT=$DST/output
LOG=/home/data/httpd/download-staging.priv/arch/signer.log

# prepare

rm -rf $DST
mkdir -p $DST
mkdir -p $OUT

# create zip

echo Creating archive for signing

cd $SRC
/usr/bin/find -name "*$3*" | zip $DST/site.zip -@

# sign

/usr/bin/sign $DST/site.zip nomail $OUT

# wait up to 30 minutes for signing to complete

tail -f $LOG | grep -E \(Extracting\|Finished\) &

I=0
while [ $I -lt 120 ] && [ ! -e $OUT/site.zip ]; do
  echo Waiting for $OUT/site.zip... $I / 120
  sleep 30
  let I=I+1
done

PID=`jobs -l -p`
kill $PID

if [ ! -e $OUT/site.zip ]
then
  echo
  echo Signing Failed: Timeout waiting for $OUT/site.zip
  exit 1
fi

# unzip

echo Unzipping signed files
/usr/bin/unzip -o -d $SRC $OUT/site.zip

# cleanup

rm $DST/site.zip

Back to the top