Ticket #11191: zipCatKeys.sh

File zipCatKeys.sh, 1.6 KB (added by mmadia, 6 years ago)

script for generating and uploading catkeys

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