mirror of
https://github.com/MailScanner/v5.git
synced 2024-11-10 17:35:06 +08:00
0a87daf349
* Initial Refactor for 5.1.4-1 * Reorder docs and patch processing * Explicit targets for copy * Update install phase of specs * Disable AutoReqProv * Update install splash * Refactor post install * Update README * Distinguish rhel and suse rpms in naming Clarify naming in README Log ms-configure to /var/log * Do not automatically enable mailscanner on debian builds Move notes in packages to end of ms-configure Alter notes in specs to notify user to run ms-configure * Correct package name in copy * Move mtagroup creation back to spec * patch.diff no longer valid * Remove patch.diff from spec and build * Bump to version 5.2.1-1 for major changes * ATTENTION block added to README * Cosmetic changes to README * Tab cleanup of README * Revert not enabling mailscanner during install * Explicit destination file for copy on suse builds * Reorder doc copies for tarballing * Remove unneeded subdirectory in suse build * 5.2.1-1 Builds
159 lines
4.6 KiB
Bash
Executable file
159 lines
4.6 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
#
|
|
# Updated: 2 Nov 2019
|
|
# MailScanner Team <https://www.mailscanner.info>
|
|
#
|
|
# This script will build the latest SuSE install
|
|
# package and put it in /msbuilds/suse
|
|
|
|
# make sure this is run from the base directory
|
|
if [ ! -d 'suse' ]; then
|
|
echo 'This script must be executed from the base directory.';
|
|
echo './suse was not found. Exiting ...';
|
|
echo;
|
|
exit 192
|
|
fi
|
|
|
|
# directory we are in
|
|
THISCURDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
|
|
|
# if not set from the "Build.all" script
|
|
if [ -z "$RPMOUT" ]; then
|
|
RPMOUT="$HOME/msbuilds/suse";
|
|
export RPMOUT;
|
|
fi
|
|
|
|
# check to see if the output directory exists
|
|
if [ ! -d "$RPMOUT" ]; then
|
|
mkdir -p $RPMOUT
|
|
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 )
|
|
#echo "You current directory is $THISCURDIR"; echo;
|
|
#echo "Enter the parent directory of RPM.files without the trailing slash: ";
|
|
#read DEVBASEDIR
|
|
export DEVBASEDIR
|
|
fi
|
|
|
|
# create this if missing
|
|
#if [ ! -f '/tmp/MailScanner.conf.index.html' ]; then
|
|
# sh $DEVBASEDIR/config.index/make.sh
|
|
#fi
|
|
|
|
# the source directory
|
|
SRCDIR=$DEVBASEDIR/suse
|
|
|
|
# version info
|
|
BUILD=$MSBUILD
|
|
VERSION=$MSVERSION-$BUILD
|
|
export VERSION BUILD
|
|
|
|
# setup rpm development dirs
|
|
mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
|
|
|
|
# create build output base dir
|
|
mkdir -p $RPMOUT
|
|
|
|
# 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
|
|
mkdir -p $WORK/{usr,etc}
|
|
|
|
# etc
|
|
cp -fr $DEVBASEDIR/common/etc/* $WORK/etc/
|
|
cp -fr $DEVBASEDIR/suse/etc/* $WORK/etc/
|
|
|
|
# usr
|
|
cp -fr $DEVBASEDIR/common/usr/* $WORK/usr/
|
|
cp -fr $DEVBASEDIR/suse/usr/* $WORK/usr/
|
|
|
|
# Insert the version number we are building
|
|
perl -pi -e 's/VersionNumberHere/'$MSVERSION'/;' $WORK/etc/MailScanner/MailScanner.conf
|
|
perl -pi -e 's/VersionNumberHere/'$MSVERSION'/;' $WORK/usr/sbin/MailScanner
|
|
|
|
# do the same for mailscanner.spec
|
|
cp -f $DEVBASEDIR/suse/mailscanner.spec ~/rpmbuild/SPECS/mailscanner.spec
|
|
perl -pi -e 's/VersionNumberHere/'$MSVERSION'/;' ~/rpmbuild/SPECS/mailscanner.spec
|
|
perl -pi -e 's/ReleaseNumberHere/'$MSBUILD'/;' ~/rpmbuild/SPECS/mailscanner.spec
|
|
|
|
# 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 {} \;
|
|
|
|
# permissions
|
|
cd $WORK
|
|
find . -type f -exec chmod 0644 {} \;
|
|
find . -type d -exec chmod 0755 {} \;
|
|
chmod +x $WORK/usr/sbin/*
|
|
chmod +x $WORK/usr/lib/MailScanner/wrapper/*-autoupdate
|
|
chmod +x $WORK/usr/lib/MailScanner/wrapper/*-wrapper
|
|
chmod +x $WORK/usr/lib/MailScanner/init/*
|
|
chmod +x $WORK/etc/cron.daily/*
|
|
chmod +x $WORK/etc/cron.hourly/*
|
|
|
|
mkdir -p $WORK/usr/share/MailScanner/doc
|
|
cp $DEVBASEDIR/changelog $WORK/usr/share/MailScanner/doc/changelog
|
|
cp $DEVBASEDIR/README $WORK/usr/share/MailScanner/doc/README
|
|
cp $DEVBASEDIR/LICENSE $WORK/usr/share/MailScanner/doc/LICENSE
|
|
|
|
# Build the src tarball for RPM construction
|
|
cd $WORK
|
|
cd ..
|
|
tar czf ~/rpmbuild/SOURCES/MailScanner-${MSVERSION}.tgz MailScanner-${MSVERSION}
|
|
|
|
# return to where i started
|
|
cd $THISCURDIR
|
|
|
|
# copy some file we need
|
|
#cp $SRCDIR/install.sh $RPMOUT/MailScanner-$VERSION/
|
|
# find $RPMOUT/MailScanner-$VERSION -name 'install.sh' -exec chmod 755 {} \;
|
|
# find $RPMOUT/MailScanner-$VERSION -name 'LICENSE' -exec chmod 644 {} \;
|
|
# find $RPMOUT/MailScanner-$VERSION -name 'README' -exec chmod 644 {} \;
|
|
# find $RPMOUT/MailScanner-$VERSION -name 'patch.diff' -exec chmod 644 {} \;
|
|
|
|
# Build the RPM and SRPMS
|
|
# extra define statements help make the rpm backwards compatible
|
|
#rpmbuild -ba --sign --define "_binary_filedigest_algorithm 1" --define "_binary_payload 1" ~/rpmbuild/SPECS/mailscanner.spec
|
|
rpmbuild -ba --define "_binary_filedigest_algorithm 1" --define "_binary_payload 1" ~/rpmbuild/SPECS/mailscanner.spec
|
|
|
|
# copy the rpm built to the output dir
|
|
cp ~/rpmbuild/RPMS/noarch/MailScanner-${VERSION}.suse.noarch.rpm $RPMOUT
|
|
#cd $RPMOUT
|
|
# tar czf MailScanner-${VERSION}.suse.tar.gz MailScanner-$VERSION
|
|
#rm -rf $RPMOUT/MailScanner-$VERSION
|
|
rm -rf $WORK
|
|
|
|
echo;
|
|
echo "Completed: $RPMOUT/MailScanner-${VERSION}.suse.noarch.rpm";
|
|
|