mirror of
https://github.com/MailScanner/v5.git
synced 2024-11-11 01:42:36 +08:00
282ac3e673
cleanup mailscanner.spec spacing add systemd logic add ms-systemd add ms-sendmail*
117 lines
3.2 KiB
Bash
Executable file
117 lines
3.2 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
# Jerry Benton
|
|
# 24 APR 2016
|
|
|
|
# this Build.debian script should be located in the base
|
|
# directory when run.
|
|
|
|
# make sure this is run from the base directory
|
|
if [ ! -d 'common' ]; then
|
|
echo 'This script must be executed from the base directory.';
|
|
echo;
|
|
exit 192
|
|
fi
|
|
|
|
# directory we are in
|
|
THISCURDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
|
|
|
# where the final file will be copied
|
|
FILEOUT="$HOME/msbuilds/deb";
|
|
export FILEOUT;
|
|
|
|
# check to see if the output directory exists
|
|
if [ ! -d "$FILEOUT" ]; then
|
|
mkdir -p $FILEOUT
|
|
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
|
|
|
|
# our working directory
|
|
WORK="/tmp/MailScanner-$FULLMSVER";
|
|
|
|
# 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/debian/etc/* $WORK/etc/
|
|
|
|
# usr
|
|
cp -fr $DEVBASEDIR/common/usr/* $WORK/usr/
|
|
cp -fr $DEVBASEDIR/debian/usr/* $WORK/usr/
|
|
|
|
|
|
cp -rf $DEVBASEDIR/debian/DEBIAN/ $WORK
|
|
perl -pi -e 's/DebianVersionHere/'$FULLMSVER'/;' $WORK/DEBIAN/control
|
|
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 {} \;
|
|
|
|
cd $WORK
|
|
find . -type f -exec chmod 0644 {} \;
|
|
find . -type d -exec chmod 0755 {} \;
|
|
chmod +x $WORK/usr/sbin/*
|
|
chmod +x $WORK/DEBIAN/postinst
|
|
chmod +x $WORK/DEBIAN/preinst
|
|
chmod +x $WORK/DEBIAN/postrm
|
|
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/usr/lib/MailScanner/systemd/*
|
|
chmod +x $WORK/etc/cron.daily/*
|
|
chmod +x $WORK/etc/cron.hourly/*
|
|
|
|
# create a working dir for package
|
|
PKGTMP="/tmp/deb.$$/";
|
|
mkdir -p $PKGTMP/MailScanner-${FULLMSVER}
|
|
fakeroot dpkg -b $WORK $PKGTMP/MailScanner-${FULLMSVER}/MailScanner-$FULLMSVER-noarch.deb
|
|
cp $DEVBASEDIR/debian/install.sh $PKGTMP/MailScanner-${FULLMSVER}
|
|
cp $DEVBASEDIR/changelog $PKGTMP/MailScanner-${FULLMSVER}
|
|
cp $DEVBASEDIR/LICENSE $PKGTMP/MailScanner-${FULLMSVER}
|
|
cp $DEVBASEDIR/README $PKGTMP/MailScanner-${FULLMSVER}
|
|
chmod +x $PKGTMP/MailScanner-${FULLMSVER}/install.sh
|
|
cd $PKGTMP
|
|
tar czf MailScanner-${FULLMSVER}.deb.tar.gz *
|
|
mv -f MailScanner-${FULLMSVER}.deb.tar.gz $FILEOUT
|
|
|
|
rm -rf $PKGTMP
|
|
rm -rf $WORK
|