88 lines
2.8 KiB
Bash
Executable File
88 lines
2.8 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Check parameters
|
|
if [ "$1" == "frontend" ]; then
|
|
echo "Packaging frontend...";
|
|
SOURCEDIR=/home/packager/lastbuild/frontend
|
|
TARGETDIR=frontend
|
|
PACKAGE=frontend
|
|
INCLUDEDB=yes
|
|
elif [ "$1" == "backend" ]; then
|
|
echo "Packaging backend..."
|
|
SOURCEDIR=/home/packager/lastbuild/backend
|
|
TARGETDIR=backend
|
|
PACKAGE=backend
|
|
INCLUDEDB=yes
|
|
elif [ "$1" == "extscripts" ]; then
|
|
echo "Packaging external scripts..."
|
|
SOURCEDIR=/home/prod/Smallwebs/HostedScripts
|
|
TARGETDIR=frontend/Scripts/ExternalScripts
|
|
PACKAGE=external-scripts
|
|
else
|
|
echo "Syntax:"
|
|
echo "repackage {frontend|backend|extscripts} [stable]"
|
|
echo
|
|
echo "If 'stable' is not given, -internal will be added to the package name."
|
|
exit 1;
|
|
fi
|
|
|
|
if [ "$2" == "stable" ]; then
|
|
CONTROLSUFFIX=-stable
|
|
echo "Packaging STABLE for external deployment."
|
|
else
|
|
CONTROLSUFFIX=-internal
|
|
if [ "$1" == "extscripts" ]; then
|
|
echo "Error: Cannot package external scripts for internal build. Use 'stable'."
|
|
exit 1;
|
|
fi
|
|
fi
|
|
|
|
PACKAGENAME=$PACKAGE$CONTROLSUFFIX
|
|
|
|
# Delete flag that indicates a new drop is available
|
|
#rm /home/packaging/lastbuild/BuildDropped.txt
|
|
|
|
# Init build
|
|
cd debian
|
|
|
|
# Delete temporary files
|
|
echo "Removing previous package files..."
|
|
rm -rf opt/swarmops/*
|
|
|
|
echo "Copying new files into repo..."
|
|
mkdir -p opt/swarmops/$TARGETDIR
|
|
cp -R $SOURCEDIR/* opt/swarmops/$TARGETDIR/.
|
|
|
|
echo "Copying template files into repo..."
|
|
if [ "$INCLUDEDB" == "yes" ]; then
|
|
cp ../templates/database.config.template opt/swarmops/$TARGETDIR/database.config
|
|
fi
|
|
cp ../templates/control-$PACKAGENAME.template DEBIAN/control
|
|
cp ../templates/conffiles-$PACKAGE.template DEBIAN/conffiles
|
|
|
|
echo "Setting build number ($(cat ../../lastbuild/frontend/BuildIdentity.txt | tr -d ' \r'))..."
|
|
sed -i "s/--BuildNumber--/$(cat ../../lastbuild/frontend/BuildIdentity.txt | tr -d ' \r')/" DEBIAN/control
|
|
|
|
# Calculating new checksums
|
|
echo "Creating MD5 checksum file..."
|
|
../scripts/create-md5
|
|
|
|
echo "Creating package 'swarmops-$PACKAGENAME-latest.deb'..."
|
|
cd ..
|
|
if [ -a swarmops-$PACKAGENAME-latest.deb ]; then
|
|
rm swarmops-$PACKAGENAME-latest.deb
|
|
fi
|
|
fakeroot dpkg-deb --build debian
|
|
mv debian.deb swarmops-$PACKAGENAME-latest.deb
|
|
cp swarmops-$PACKAGENAME-latest.deb /home/prod/Smallwebs/Activizr-repo
|
|
|
|
echo "Updating repositories..."
|
|
scripts/update-repos swarmops-$PACKAGENAME-latest.deb
|
|
|
|
#echo "Notifying developers that new build has deployed for test..."
|
|
#echo "Swarmops frontend STABLE build $(cat debian-stable/opt/swarmops/frontend/BuildIdentity.txt | tr -d ' \r') has been deployed as daily build." > deploymsg.txt
|
|
#echo "Test it at http://dev.swarmops.com/ as usual." >> deploymsg.txt
|
|
#mail -s "Swarmops frontend STABLE $(cat debian-stable/opt/swarmops/frontend/BuildIdentity.txt)deployed as daily" "swarmops-builds@falkvinge.net" < deploymsg.txt
|
|
rm deploymsg.txt
|
|
|