diff options
-rw-r--r-- | net/libs/courier-authlib/Manifest | 24 | ||||
-rwxr-xr-x | net/libs/courier-authlib/courier-authlib.SlackBuild | 297 |
2 files changed, 236 insertions, 85 deletions
diff --git a/net/libs/courier-authlib/Manifest b/net/libs/courier-authlib/Manifest new file mode 100644 index 00000000..c67bc4a6 --- /dev/null +++ b/net/libs/courier-authlib/Manifest @@ -0,0 +1,24 @@ +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA1 + +DIST courier-authlib-0.62.2.tar.bz2 2233216 MD5 8b69745b1cb191ae5f743b8758ad2ff9 RMD160 c0f4f32994056f8034f30055cfe55238d137a2ca SHA1 dc495ad6c54c271483d4862e09788621d86629a9 SHA256 8ce756df57c7f4c09219fe9c70b4f7e6002a2e0fbf9de73f304c22b316387c50 SHA512 4b2ddaf1db6b439b547143d583b02dc5379a71b557ec70ba5f0934a60e5d6fbacd322032d296183359106b0655effeb44262337d35cb6749f56244f66d605e53 +MISC rc.courier-authlib.new 1308 MD5 e361ca49dc038867353c0dd564bd1831 RMD160 62302a8a381781e02bc5b8b11646aa63e3f31912 SHA1 211e60f3bc3d5f8a8d5bd24fc3940d1ea9098cd7 SHA256 f1ec813ef0be6ee703f726b7c66566406e4d8ce988e271187a68e9b69af895b5 SHA512 083014bab0422eafc19152936acfb540936f6bfa3be4cd0adae51b5ce4ba59f42ffee306a98919cc038bcb5c2cd9f750e035ab00f34e122f85f5ee6b3b5d1a27 +MKBUILD courier-authlib.mkbuild 5457 MD5 881506484abc56a83121be6f8cd3988c RMD160 3707aa231469e7f6cb8b34a530748462ee8aba4e SHA1 5cb797a13c0b46f4a6c11deddb0ec509160011c7 SHA256 3fc088dbc143d8d1e4afd3a963ac9c0f9349f3d563398c812a50f4ee94f74d39 SHA512 15365bf289bb509a2e2b9ce7bcf76929d52829d5b6db13a4dcdfdf3feaf47f9c48ead7033dff048bdec90218093a3c06d337482e996b771eb58a960bdbab0c5d +SLACKBUILD courier-authlib.SlackBuild 8517 MD5 9bce42bcbd2ed6f133fc58627872612a RMD160 a6dab9c36ed6e667c11cf99421eab0360f47bff2 SHA1 a1562a727042c1b5414a7d734b94a4558b60c3b5 SHA256 eb13908abc6aa11ab64d92b7713a31d5953def8704bcdc2ee09211c08f16d17d SHA512 76bf8f79583c07cfbbedda5c89695d87c9d0b200ec81d0288e0b1b03c5ae9abad7b9ab9046687e2db7f60957fd9ab9cc5d1e515a35ee8b4bf4c12dfb18f7c5e5 +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.9 (GNU/Linux) + +iQIcBAEBAgAGBQJJ9PYYAAoJEEHL93ESzgeiNloP/13K8HQsOxfFqQPhqwG4qBKN +Val7AgDYo/GzWlYDndWuDTDOSGktRo1la794JgXw347pFfjAxQmbNp9SYVV7yZMO +EiSFugUF1rFZlYOM462xvdbscD3CGoquDAWAqdyCN04javmcSKIc22f0dAlQh6oV +qvLgmhwJ4SsKmAwZ48Qv6qdAeD/t2Zf5NVhXA6fgTrkVd/ty6SHJOyan+TUOneWg +ZXJ20CHn/RNpm0asKHtVq6ehSOuMK+OpNwuZ8CnKVz++/Ju5lZCM3ciYkvoiac0N +fewhSSpXVjNusPPK6gtyQis+o+yLHfvSHtLlS/Ox+somxDLe6nmlOh0szrQOvsKU +EeA/C3zf1Xv3xKiTnR3GSSKFr2m/E/Yo6AGrvRcAdDL0F11DDRNSYHJxHzfaPfYh +tOG3Y8HoFGS4e5VPyOlUnr6C/6vyXqNtU22JNITO9e5B/mRdfDiFM+SyEe9hvQ79 +M5i8ku5cqFvGnKg/CxrLVngKQRZaUSrQDKReUBkOxhFTSC1MLkrqYjyjYAVkGe86 +ZyRJJOwXRyk8KuaNxH4u0Rn6rQyDPC/VImGoHNc0ljoJEu/HYgXtDGS5e6n2UCpO +208NM2KJspSDEB0Cpee5big7uf8R/OKUQ6vBZFOj5FbXQCLy2bEZ00Km0DZ9fm2n +D2HWY4+o/Lq9ESWj8yxd +=eJLC +-----END PGP SIGNATURE----- diff --git a/net/libs/courier-authlib/courier-authlib.SlackBuild b/net/libs/courier-authlib/courier-authlib.SlackBuild index f136533b..d5d1549e 100755 --- a/net/libs/courier-authlib/courier-authlib.SlackBuild +++ b/net/libs/courier-authlib/courier-authlib.SlackBuild @@ -1,119 +1,210 @@ #!/bin/bash # -# courier-authlib.SlackBuild is free software; you can redistribute it and/or modify it under the -# terms of the GNU General Public License as published by the Free Software -# Foundation; either version 2 of the License, or any later version. +# courier-authlib.SlackBuild is free software; you can redistribute +# it and/or modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the License, +# or any later version. # -# courier-authlib.SlackBuild is distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR -# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# courier-authlib.SlackBuild is distributed in the hope that it will +# be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. # -# You should have received a copy of the GNU General Public License along with -# this program; if not, write to the Free Software Foundation, Inc., 59 Temple -# Place - Suite 330, Boston, MA 02111-1307, USA +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA # -# slackbuild script for courier-authlib -# by rhatto at riseup.net +# slackbuild for courier-authlib, by Silvio Rhatto +# requires: +# tested: courier-authlib-0.62.2 +# model: generic.mkSlackBuild $Rev: 805 $ # -if [ -s "slack-required" ]; then - echo Recomended and required packages for building courier-authlib are: - cat slack-required | sed -e 's/^/\t/' - if [ "$INTERACT" != "no" ]; then - echo If you dont have those installed, press Ctrl-C. Otherwise, hit ENTER. - read crap -# else -# echo Sleeping 3 seconds... -# sleep 3 - fi -fi - -CWD="`pwd`" - +# Look for slackbuildrc if [ -f ~/.slackbuildrc ]; then source ~/.slackbuildrc elif [ -f /etc/slackbuildrc ]; then source /etc/slackbuildrc fi -# default settings -PACKAGE="courier-authlib" -VERSION=${VERION:=0.59.3} +# Set variables +CWD="$(pwd)" +SRC_NAME="courier-authlib" +PKG_NAME="courier-authlib" ARCH=${ARCH:=i486} -BUILD=${BUILD:=2rha} +SRC_VERSION=${VERSION:=0.62.2} +PKG_VERSION="$(echo "$SRC_VERSION" | tr '[[:blank:]-]' '_')" +BUILD=${BUILD:=1rha} +SRC_DIR=${SRC_DIR:=$CWD}/$PKG_NAME TMP=${TMP:=/tmp} +PKG=${PKG:=$TMP/package-$PKG_NAME} REPOS=${REPOS:=$TMP} -SRC_DIR=${SRC:=$CWD} +SLACKBUILD_PATH=${SLACKBUILD_PATH:="net/libs/courier-authlib"} +PREFIX=${PREFIX:=/usr} +PKG_WORK="$TMP/$SRC_NAME" +CONF_OPTIONS=${CONF_OPTIONS:="--sysconfdir=/etc"} +NUMJOBS=${NUMJOBS:=""} -# ------- error codes for createpkg -------------- +# Set system libraries' path and optmization flags based on $ARCH +LIBDIR="$PREFIX/lib" + +if [ "$ARCH" = "i386" ]; then + SLKCFLAGS="-O2 -march=i386 -mtune=i686" +elif [ "$ARCH" = "i486" ]; then + SLKCFLAGS="-O2 -march=i486 -mtune=i686" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686" +elif [ "$ARCH" = "s390" ]; then + SLKCFLAGS="-O2" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIR="$PREFIX/lib64" + LDFLAGS="-L/lib64 -L/usr/lib64" +fi + +# Set error codes (used by createpkg) ERROR_WGET=31; ERROR_MAKE=32; ERROR_INSTALL=33 ERROR_MD5=34; ERROR_CONF=35; ERROR_HELP=36 ERROR_TAR=37; ERROR_MKPKG=38; ERROR_GPG=39 -ERROR_PATCH=40 +ERROR_PATCH=40; ERROR_VCS=41; ERROR_MKDIR=42 +ERROR_MANIFEST=43; -if [ "$ARCH" == "x86_64" ]; then - LIBDIR=/usr/lib64 -else - LIBDIR=/usr/lib -fi +# Clean up any leftovers of previous builds +rm -rf "$PKG_WORK" 2> /dev/null +rm -rf "$PKG" 2> /dev/null -RTOOL="wget" -PACKAGE_EXT="bz2" -KEY="http://www.courier-mta.org/KEYS.bin" -SRC="$PACKAGE-$VERSION.tar.$PACKAGE_EXT" -URL="http://easynews.dl.sourceforge.net/sourceforge/courier/$SRC" +# Create directories if necessary +mkdir -p "$SRC_DIR" || exit $ERROR_MKDIR +mkdir -p "$PKG" || exit $ERROR_MKDIR +mkdir -p "$REPOS" || exit $ERROR_MKDIR +mkdir -p "$PKG_WORK" || exit $ERROR_MKDIR -SRC_DIR="$SRC_DIR/$PACKAGE" -mkdir -p $SRC_DIR +# Dowload source if necessary +SRC="$SRC_NAME-$VERSION.tar.bz2" +URL="http://downloads.sourceforge.net/courier/$SRC" -if [ "$RTOOL" == "wget" ] && [ ! -f "$SRC_DIR/$SRC" ]; then +if [ ! -s "$SRC_DIR/$SRC" ] || ! bunzip2 -t "$SRC_DIR/$SRC" 2> /dev/null; then wget "$URL" -O "$SRC_DIR/$SRC" || exit $ERROR_WGET - wget "$URL.sig" -O "$SRC_DIR/$SRC.sig" || exit $ERROR_WGET fi -if [ ! -f "$SRC_DIR/$PACKAGE-key.asc" ]; then - wget "$KEY" -O "$SRC_DIR/$PACKAGE-key.asc" && gpg --import $SRC_DIR/$PACKAGE-key.asc || exit $ERROR_WGET -fi +# Check Manifest file +if [ -e "$CWD/Manifest" ]; then + + # Manifest signature checking + if grep -q -- "-----BEGIN PGP SIGNED MESSAGE-----" $CWD/Manifest; then + echo "Checking Manifest signature..." + gpg --verify $CWD/Manifest + if [ "$?" != "0" ]; then + exit $ERROR_MANIFEST + fi + fi + + MANIFEST_LINES="`grep -E -v "^(MKBUILD|SLACKBUILD)" $CWD/Manifest | wc -l`" + + for ((MANIFEST_COUNT=1; MANIFEST_COUNT <= $MANIFEST_LINES; MANIFEST_COUNT++)); do + + MANIFEST_LINE="`grep -E -v "^(MKBUILD|SLACKBUILD)" $CWD/Manifest | head -n $MANIFEST_COUNT | tail -n 1`" + MANIFEST_FILE="`echo $MANIFEST_LINE | awk '{ print $2 }'`" + MANIFEST_FILE_TYPE="`echo $MANIFEST_LINE | awk '{ print $1 }'`" + + if [ -e "$SRC_DIR/$MANIFEST_FILE" ]; then + MANIFEST_FILE="$SRC_DIR/$MANIFEST_FILE" + else + MANIFEST_FILE="`find $CWD -name $MANIFEST_FILE`" + fi -gpg --verify $SRC_DIR/$SRC.sig $SRC_DIR/$SRC || exit $ERROR_GPG + if [ ! -e "$MANIFEST_FILE" ] || [ -d "$MANIFEST_FILE" ]; then + continue + fi -TMP="$TMP/$PACKAGE" -rm -rf $TMP -mkdir -p $TMP -cd $TMP + echo "Checking Manifest for $MANIFEST_FILE_TYPE $MANIFEST_FILE integrity..." -tar xvf $SRC_DIR/$SRC || exit $ERROR_TAR -cd $PACKAGE-$VERSION + SIZE_SRC="`wc -c $MANIFEST_FILE | awk '{ print $1 }'`" + SIZE_MANIFEST="`echo $MANIFEST_LINE | awk '{ print $3 }'`" -./configure --prefix=/usr --sysconfdir=/etc --libdir=$LIBDIR || exit $ERROR_CONF + # Check source code size + if [ "$SIZE_SRC" != "$SIZE_MANIFEST" ]; then + echo "SIZE Manifest: $SIZE_MANIFEST; SIZE $SRC: $SIZE_SRC" + exit $ERROR_MANIFEST + else + echo "Size match." + fi -make || exit $ERROR_MAKE -make DESTDIR=$TMP/package-$PACKAGE install || exit $ERROR_INSTALL -make install-migrate DESTDIR=$TMP/package-$PACKAGE install || exit $ERROR_INSTALL -make install-configure DESTDIR=$TMP/package-$PACKAGE install || exit $ERROR_INSTALL + # Check source code integrity + for ALGO in md5 rmd160 sha1 sha256 sha512; do + if [ $ALGO = "rmd160" ]; then + ALGO_SRC="`openssl rmd160 $MANIFEST_FILE | awk '{ print $2 }'`" + else + ALGO_SRC="`"$ALGO"sum $MANIFEST_FILE | awk '{ print $1 }'`" + fi + ALGO="`echo $ALGO | tr '[:lower:]' '[:upper:]'`" + ALGO_MANIFEST=$(echo $MANIFEST_LINE | sed "s/.* $ALGO //" | awk '{ print $1 }') + if [ "$ALGO_SRC" != "$ALGO_MANIFEST" ]; then + echo "$ALGO Manifest: $ALGO_MANIFEST; $ALGO $SRC: $ALGO_SRC" + exit $ERROR_MANIFEST + else + echo "$ALGO match." + fi + done -mkdir -p $TMP/package-$PACKAGE/etc/rc.d -cp $CWD/rc.courier-authlib.new $TMP/package-$PACKAGE/etc/rc.d + done -rm $TMP/package-$PACKAGE/etc/authlib/{authdaemonrc,authldaprc,authmysqlrc} +else + exit $ERROR_MANIFEST +fi + +# Untar +cd "$PKG_WORK" +tar --no-same-owner --no-same-permissions -xvf "$SRC_DIR/$SRC" || exit $ERROR_TAR +PKG_SRC="$PWD/`ls -l | awk '/^d/ { print $NF }'`" +cd "$PKG_SRC" + +# Configure +CFLAGS="$SLKCFLAGS" \ + CXXFLAGS="$SLKCFLAGS" \ + ./configure \ + --prefix="$PREFIX" --libdir="$LIBDIR" $CONF_OPTIONS || exit $ERROR_CONF -CWD="`pwd`" +# Compile +make $NUMJOBS || exit $ERROR_MAKE -cd $TMP/package-$PACKAGE +# Install +make install DESTDIR="$PKG" || exit $ERROR_INSTALL +make install-migrate DESTDIR=$PKG install || exit $ERROR_INSTALL +make install-configure DESTDIR=$PKG install || exit $ERROR_INSTALL -find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null -find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null +# Strip binaries +( cd "$PKG" + find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | \ + xargs strip --strip-unneeded 2> /dev/null + find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | \ + xargs strip --strip-unneeded 2> /dev/null +) + +# Copy init scripts +mkdir -p $PKG/etc/rc.d +cp $CWD/rc.* $PKG/etc/rc.d/ + +# Install documentation +DOCS="NEWS TODO README AUTHORS INSTALL ChangeLog MAINTAINERS COPYING LICENSE SIGNATURE readme.*" +mkdir -p "$PKG/usr/doc/$PKG_NAME-$PKG_VERSION" || exit $ERROR_MKDIR +for doc in $DOCS; do + if [ -f "$doc" ]; then + cp -a $doc "$PKG/usr/doc/$PKG_NAME-$PKG_VERSION" + fi +done -mkdir install -cat << EOF > install/slack-desc +# Add package description (slack-desc) +mkdir -p "$PKG/install" || exit $ERROR_MKDIR +cat << EODESC > "$PKG/install/slack-desc" # HOW TO EDIT THIS FILE: -# The "handy ruler" below makes it easier to edit a package description. Line +# The "handy ruler" below makes it easier to edit a package description. Line # up the first '|' above the ':' following the base package name, and the '|' -# on the right side marks the last column you can put a character in. You must +# on the right side marks the last column you can put a character in. You must # make exactly 11 lines for the formatting to be correct. It's also # customary to leave one space after the ':'. - |-----handy-ruler-----------------------------------------------------| + |-----handy-ruler----------------------------------------------| courier-authlib: courier-authlib (Courier Authentication Library) courier-authlib: courier-authlib: The Courier Authentication Library is an API toolkit for @@ -125,21 +216,57 @@ courier-authlib: courier-authlib: courier-authlib: courier-authlib: -EOF +EODESC -# docs -mkdir -p usr/doc/$PACKAGE-$VERSION +# Add a post-installation script (doinst.sh) +mkdir -p "$PKG/install" || exit $ERROR_MKDIR +cat << EOSCRIPT > "$PKG/install/doinst.sh" +config() { + NEW="\$1" + OLD="\$(dirname \$NEW)/\$(basename \$NEW .new)" + OLD="\$(dirname \$NEW)/\$(basename \$OLD .sample)" + OLD="\$(dirname \$NEW)/\$(basename \$OLD .dist)" -for file in AUTHORS COPYING COPYING.GPL ChangeLog INSTALL INSTALL.html NEWS NEWS.html README; do - cp $CWD/$file* usr/doc/$PACKAGE-$VERSION/ -done + # If there's no config file by that name, mv it over: + if [ ! -r \$OLD ]; then + mv \$NEW \$OLD + elif [ "\$(cat \$OLD | md5sum)" = "\$(cat \$NEW | md5sum)" ]; then + # toss the redundant copy + rm \$NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} + +mkgroup() { + GROUP="\$1" + if ! grep -qe "^\$GROUP:" etc/group; then + echo Creating group \$GROUP... + chroot . /usr/sbin/groupadd \$GROUP + fi +} -echo '( chroot . /sbin/ldconfig )' > install/doinst.sh -echo '( if [ ! -f "etc/rc.d/rc.courier-authlib" ]; then mv etc/rc.d/rc.courier-authlib.new etc/rc.d/rc.courier-authlib ; fi )' >> install/doinst.sh +mkuser() { + USER="\$1" + if [ ! -z "\$2" ]; then + GROUP="\$2" + else + GROUP="\$USER" + fi + if ! grep -qe "^\$USER:" etc/passwd; then + echo Creating user \$USER... + chroot . /usr/sbin/useradd \$USER -g \$GROUP + fi +} -makepkg -c y -l y $REPOS/$PACKAGE-$VERSION-$ARCH-$BUILD.tgz || exit $ERROR_MKPKG +config etc/rc.d/rc.courier-authlib.new +EOSCRIPT -if [ "$CLEANUP" == "yes" ]; then - rm -rf $TMP -fi +# Build the package +cd "$PKG" +mkdir -p $REPOS/$SLACKBUILD_PATH +makepkg -l y -c n "$REPOS/$SLACKBUILD_PATH/$PKG_NAME-$PKG_VERSION-$ARCH-$BUILD.tgz" || exit $ERROR_MKPKG +# Delete source and build directories if requested +if [ "$CLEANUP" == "yes" ] || [ "$1" = "--cleanup" ]; then + rm -rf "$PKG_WORK" "$PKG" +fi |