1 | #!/usr/local/bin/bash
|
---|
2 | set -o errexit
|
---|
3 | #set -x
|
---|
4 |
|
---|
5 | # EDIT THESE:
|
---|
6 | # use a complete path. e.g. starting with a '/'
|
---|
7 | generatedDir="/Buildbot/nightly-uploader/workdir/generated.x86gcc2"
|
---|
8 | # Choose your md5sum program
|
---|
9 | md5sum="md5 -r"
|
---|
10 | #md5sum="md5sum"
|
---|
11 |
|
---|
12 |
|
---|
13 | # DON'T EDIT BELOW THIS LINE.
|
---|
14 | echo 'Executing shell script to archive generated catkeys ...'
|
---|
15 |
|
---|
16 | catalogDir="${generatedDir}/objects/catalogs/"
|
---|
17 | cwd="${catalogDir}"
|
---|
18 | remoteDestDir=/home/haiku_files/haiku-files.org
|
---|
19 | remoteServer=haiku-files.org
|
---|
20 | remoteUser=haiku_files
|
---|
21 | archive=catkeys.zip
|
---|
22 |
|
---|
23 | # Build a list of catkeys with full path.
|
---|
24 | mkdir -p "$cwd"
|
---|
25 | pushd "$cwd"
|
---|
26 | cd ../..
|
---|
27 | echo `pwd`
|
---|
28 |
|
---|
29 | echo "Jamming the catalogs ..."
|
---|
30 | jam -q catalogs
|
---|
31 | cd "$cwd"
|
---|
32 |
|
---|
33 | echo "Finding the catalogs ..."
|
---|
34 | files=`find "$cwd" -type f -name "*.catkeys" -exec ls -1 {} \;`
|
---|
35 |
|
---|
36 |
|
---|
37 | # Change each catkey from full path to relative path.
|
---|
38 | echo "Preparing the list of catalogs to be archived ..."
|
---|
39 | declare -a listOfCatKeys
|
---|
40 | for foo in ${files[*]} ; do
|
---|
41 | catkey=${foo##${cwd}}
|
---|
42 | listOfCatKeys="${listOfCatKeys} ${catkey}"
|
---|
43 | done
|
---|
44 |
|
---|
45 | # Create new files
|
---|
46 | echo "Archiving the catalogs ..."
|
---|
47 | zip -q9u /tmp/${archive} ${listOfCatKeys}
|
---|
48 | pushd /tmp
|
---|
49 | echo "Calculating md5sum ..."
|
---|
50 | $md5sum ${archive} > /tmp/${archive}.md5
|
---|
51 | popd
|
---|
52 |
|
---|
53 | # Replace old files.
|
---|
54 | rm -f "${generatedDir}/${archive}"
|
---|
55 | rm -f "${generatedDir}/${archive}.md5"
|
---|
56 | mv /tmp/${archive} "${generatedDir}/${archive}"
|
---|
57 | mv /tmp/${archive}.md5 "${generatedDir}/${archive}.md5"
|
---|
58 |
|
---|
59 | echo "Uploading catalog archive and md5sum ..."
|
---|
60 | echo rsync -e ssh ${generatedDir}/${archive}* ${remoteUser}@${remoteServer}:${remoteDestDir}
|
---|
61 | rsync -e ssh "${generatedDir}"/${archive}* ${remoteUser}@${remoteServer}:${remoteDestDir}
|
---|
62 |
|
---|
63 | popd
|
---|
64 |
|
---|
65 | echo '...script complete.'
|
---|
66 |
|
---|
67 |
|
---|