aboutsummaryrefslogtreecommitdiff
path: root/scripts/auto-build/pd-extended-source-tarball.sh
blob: bd51fa964a866b808f8a163176b3885c4a1680e3 (plain)
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
#!/bin/sh

# show each thing being executed
set -x

# Any subsequent commands which fail will cause the shell script to exit
set -e

rsync_file()
{
    file=$1
    file_upload=$(basename $file)
    # if the rsync fails, ignore and carry on
	(rsync -a ${file} rsync://${RSYNC_SERVER}/upload/${DATE}/${file_upload} && \
        echo "successfully uploaded: ${file_upload}") || \
        true
}

upload_generated_file()
{
    file=$1
    rsync_file $file
    md5sum ${file} | sed "s|^\([0-9a-f][0-9a-f]*  \)/.*/|\1|" > ${file}.md5
    rsync_file $file.md5
}

# the source dir where this script is
## this could be done more easily with ${0%/*}
SCRIPT_DIR=$(echo $0 | sed 's|\(.*\)/.*$|\1|')
. $SCRIPT_DIR/auto-build-common

# convert into absolute path
cd "${SCRIPT_DIR}/../.."
auto_build_root_dir=`pwd`
echo "build root: $auto_build_root_dir" 

$SCRIPT_DIR/pd-extended-auto-builder.sh source-tarball-only

# the version is set by the above script, so keep this after
version=$(get_pd_version $auto_build_root_dir)

source=`ls -1 /tmp/Pd-extended*$version*-source.tar.bz2 | tail -1`
upload_generated_file $source
debian=`ls -1 /tmp/Pd-extended*$version*-source.debian.tar.bz2 | tail -1`
upload_generated_file $debian
if [ "$running_on_server" = "yes" ]; then
    rm -f -- $source $source.md5
    rm -f -- $debian $debian.md5
fi
echo SUCCESS