v5/Build.nix

97 lines
2.2 KiB
Nix
Raw Normal View History

2016-05-03 21:52:08 +08:00
#!/bin/bash
# Checked and updated to be more streamlined by
# Jerry Benton
2016-05-03 21:42:47 +08:00
# 3 MAY 2016
# this Build.tarball script should be located in the base
2016-05-03 21:42:47 +08:00
# directory when run.
# make sure this is run from the base directory
2016-05-03 21:42:47 +08:00
if [ ! -d 'common' ]; then
echo 'This script must be executed from the base directory.';
2016-05-03 21:42:47 +08:00
echo './common was not found. Exiting ...';
echo;
exit 192
fi
# if not set from the "Build.all" script
if [ -z "$MSVERSION" ]; then
echo "Please tell me the version number (x.xx.x):"
read MSVERSION
export MSVERSION
fi
# if not set from the "Build.all" script
if [ -z "$MSBUILD" ]; then
echo "And the build number (-x):"
read MSBUILD
export MSBUILD
fi
# if not set from the "Build.all" script
if [ -z "$FULLMSVER" ]; then
FULLMSVER="$MSVERSION-$MSBUILD";
export FULLMSVER
fi
# if not set from the "Build.all" script
if [ -z "$DEVBASEDIR" ]; then
DEVBASEDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
export DEVBASEDIR
fi
2016-05-03 21:42:47 +08:00
# version info
2016-05-03 21:46:28 +08:00
VERSION=$MSVERSION-$MSBUILD
export VERSION
# make some dirs
2016-05-03 21:46:28 +08:00
mkdir -p ~/msbuilds/tar
2016-05-03 21:42:47 +08:00
# the work directory
WORK="/tmp/MailScanner-$MSVERSION";
# delete work tmp if already exists
if [ -d $WORK ]; then
rm -rf $WORK
fi
# make working dir and subs
mkdir -p $WORK
# etc
cp -fr $DEVBASEDIR/common/* $WORK/
2016-05-04 01:09:30 +08:00
cp -fr $DEVBASEDIR/nix/* $WORK/
2016-05-04 01:19:46 +08:00
cp -fr $DEVBASEDIR/LICENSE $WORK/
cp -fr $DEVBASEDIR/README $WORK/
# Insert the version number we are building
2016-05-03 21:42:47 +08:00
perl -pi -e 's/VersionNumberHere/'$MSVERSION'/;' $WORK/etc/MailScanner/MailScanner.conf
perl -pi -e 's/VersionNumberHere/'$MSVERSION'/;' $WORK/usr/sbin/MailScanner
# remove svn and git and mac stuff
find $WORK -name '.svn' -exec rm -rf {} \;
find $WORK -name '.git' -exec rm -rf {} \;
find $WORK -name '*.DS_Store' -exec rm -rf {} \;
find $WORK -depth -name '__MACOSX' -exec rm -rf {} \;
2016-05-03 21:42:47 +08:00
# permissions
cd $WORK
find . -type f -exec chmod 0644 {} \;
find . -type d -exec chmod 0755 {} \;
2016-05-04 01:09:30 +08:00
chmod +x install.sh
2016-05-03 21:42:47 +08:00
chmod +x $WORK/usr/sbin/*
2016-05-10 07:45:10 +08:00
chmod +x $WORK/usr/lib/MailScanner/wrapper/*-autoupdate
chmod +x $WORK/usr/lib/MailScanner/wrapper/*-wrapper
chmod +x $WORK/usr/lib/MailScanner/init/*
2016-05-03 21:42:47 +08:00
# Build the MailScanner-version.tar.gz archive
2016-05-03 21:53:15 +08:00
cd /tmp
2016-05-03 21:48:56 +08:00
tar czf ~/msbuilds/tar/MailScanner-${VERSION}.nix.tar.gz MailScanner-$MSVERSION
cd $DEVBASEDIR
2016-05-04 01:09:30 +08:00
rm -rf $WORK
2016-05-03 21:42:47 +08:00