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 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
|
#!/bin/sh
set -e
source functions.sh
if [ "$1" != "bin" ] && [ "$1" != "src" ]
then
echo "Should have one param: <bin | src>"
echo "Second param can be <fresh>, in which case all the"
echo " package is rebuilt for binary pacakge"
exit 1
fi
cd /home/rusconi/devel
thisDir=$(pwd)
##########################################################################
# Grab the version of the source package and construct the name of the
# source tarball that we'll need.
cd massxpert || { echo "Failed to change directory to massxpert"; exit 1; }
VERSION=$(sourceVersion)
##########################################################################
# Make sure we are not going to package backup files.
fileList=$(find -name "*~")
if [ ! -z "${fileList}" ]
then
echo "There are backup files still present:"
echo "${fileList}"
echo "Please remove them first."
exit 1
fi
# Go back to the parent directory
cd ${thisDir}
# At this point we are in /home/rusconi/devel.
########################## SOURCE TARBALL ##########################
if [ "$1" == "src" ]
then
tarballName=massxpert-${VERSION}.tar.gz
echo "Tarball name: ${tarballName}"
# Create source tarball
makeSourceTarball ${tarballName} || { echo "Failed to prepare source tarball"; exit 1; }
echo "Produced source tarball ${tarballName}"
exit 0
fi
########################## SOURCE TARBALL ##########################
########################## BINARY TARBALL ##########################
if [ "$1" == "bin" ]
then
srcTarballName=massxpert-${VERSION}.tar.gz
echo "src Tarball name: ${srcTarballName}"
binTarballName=massxpert-bin-${VERSION}.tar.gz
echo "bin Tarball name: ${binTarballName}"
# See if the user wants to remove everything massxpert from
# /usr/local, so that we can install the soft in there, and then pick
# out everything to put in a binary tarball.
prefix="/usr/local"
if [ "$2" == "fresh" ]
then
echo "Should anything massxpert removed from ${prefix}? (y/n)"
read char
if [ "x$char" == "xy" ]
then
# Remove anything massxpert in ${prefix}.
for removedFile in $(find ${prefix} -name "*massxpert*")
do
sudo rm -vrf ${removedFile}
done
fi
fi
# Create source tarball
makeSourceTarball ${srcTarballName} || { echo "Failed to prepare source tarball"; exit 1; }
echo "Produced source tarball ${srcTarballName}"
sleep 2
# At this point ~/tmp/massxpert-${VERSION} contains the source
# directory which was used to compress and create
# massxpert-bin-${VERSION}.tar.gz. Give the path to that directory, so
# that the binary tarball can be created out of it.
echo -n "Making binary with source tree at ~/tmp/massxpert-${VERSION}..."
sleep 2
makeBinary ~/tmp/massxpert-${VERSION} ~/tmp/massxpert-bin-${VERSION}
if [ "$?" != "0" ]
then
echo "Failed making binary"
exit 1
fi
# At this point the binary is complete. Install it to /usr/local.
makeInstall ~/tmp/massxpert-bin-${VERSION} || { echo "Failed to make install massxpert."; exit 1; }
makeBinaryTarball ~/tmp/${binTarballName} ${prefix} || { echo "Failed to make binary tarball."; exit 1; }
echo "Produced binary tarball ~/tmp/${binTarballName}"
exit 0
fi
|