3
# This script is used to generate the codeblocks orig tarball used for this
6
# Some variables to make maintaining this script easier
7
CODEBLOCKS_VERSION="10.05"
8
CODEBLOCKS_URL_DIR="http://download.berlios.de/codeblocks"
9
CODEBLOCKS_TARBALL="codeblocks-$CODEBLOCKS_VERSION-src.tar.bz2"
10
CODEBLOCKS_TARBALL_CHECKSUM="ab077d562e98b0586f2f86c14cb773ba"
13
This script is used to generate the orig tarball used in building\n\
14
Debian packages for codeblocks-$CODEBLOCKS_VERSION.\n\
15
Usage: get-orig-source [OPTION]\n\
17
-h, --help Display this help message.\n\
18
--keep-upstream-files Keep downloaded files.\n\
19
--keep-orig-dir Keep the generated orig directory.\n"
21
while [ "$#" -gt "0" ]
24
--keep-upstream-files)
41
# Function to download files. Takes two parameters, the directory name of the
42
# url to use, and the filename of the file.
46
# Download the tarball
51
# Function to verify the checksum. Takes two parameters, the file to compute the
52
# checksum for and the checksum it should be.
54
local checksum=`md5sum $1 | cut -d ' ' -f 1`
56
if [ $2 != $checksum ] ; then
57
echo "Checksum verification failed. Checksum was $checksum
61
echo "Checksum verified. Checksum is $2"
65
# The rest is our main functions.
67
download $CODEBLOCKS_URL_DIR $CODEBLOCKS_TARBALL
69
# Verify the checksums
70
verify_checksum $CODEBLOCKS_TARBALL $CODEBLOCKS_TARBALL_CHECKSUM
72
# Unpack the upstream source
73
if [ ! -d codeblocks-$CODEBLOCKS_VERSION-release -a ! -d codeblocks-$CODEBLOCKS_VERSION ]; then
74
echo "Unpacking upstream source."
75
tar jxf $CODEBLOCKS_TARBALL
76
mv codeblocks-$CODEBLOCKS_VERSION-release codeblocks-$CODEBLOCKS_VERSION
78
echo -n "Please remove or move codeblocks-$CODEBLOCKS_VERSION-release and codeblocks-$CODEBLOCKS_VERSION "
83
# Pack into a gzipped tarball
84
if [ ! -f codeblocks-$CODEBLOCKS_VERSION ]; then
85
echo "Removing all prebuilt windows binaries"
86
find codeblocks-$CODEBLOCKS_VERSION -name "*.dll" | xargs rm -f
87
echo "Creating codeblocks_$CODEBLOCKS_VERSION orig tarball."
88
tar --owner=root --group=root -cjf codeblocks_$CODEBLOCKS_VERSION.orig.tar.bz2 codeblocks-$CODEBLOCKS_VERSION
90
echo "Please remove or move codeblocks_$CODEBLOCKS_VERSION.orig.tar.gz."
95
if [ -z "$KEEP_ORIG_DIR" ]; then
96
echo "Removing extracted directory."
97
rm -rf codeblocks-$CODEBLOCKS_VERSION
99
if [ -z "$KEEP_UPSTREAM_FILES" ]; then
100
echo "Removing upstream files."
101
rm $CODEBLOCKS_TARBALL