From f794474e96d3be692f66b8e850d08212a4238b7f Mon Sep 17 00:00:00 2001 From: rhatto Date: Tue, 7 Apr 2009 22:32:29 +0000 Subject: lsyncd: addin lsyncd git-svn-id: svn+slack://slack.fluxo.info/var/svn/slackbuilds@2146 370017ae-e619-0410-ac65-c121f96126d4 --- app/backup/lsyncd/Manifest | 23 ++++ app/backup/lsyncd/lsyncd.SlackBuild | 223 ++++++++++++++++++++++++++++++++++++ 2 files changed, 246 insertions(+) create mode 100644 app/backup/lsyncd/Manifest create mode 100644 app/backup/lsyncd/lsyncd.SlackBuild (limited to 'app/backup/lsyncd') diff --git a/app/backup/lsyncd/Manifest b/app/backup/lsyncd/Manifest new file mode 100644 index 00000000..445ceec8 --- /dev/null +++ b/app/backup/lsyncd/Manifest @@ -0,0 +1,23 @@ +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA1 + +DIST lsyncd-1.26.tar.gz 171811 MD5 ff06aed03a012c84c0526a4f892900fe RMD160 79f2f3c88f956dafc41e9936fad9a0a02ce311f9 SHA1 73f738b987905ffcfe34f763921fe837e1b34102 SHA256 717eb5b17d2244993e8be5c63595457e7c7825ede20b21e072f1564552d850eb SHA512 1a47ed6459d5c8bc0be82296e0c52c19ae33b6dffc83dfc48ccefa1542a18e1fbcb0fafa98e507ad03cdcefcacfe68ca737d2662f39ccf032c16bd1ee32e3258 +MKBUILD lsyncd.mkbuild 5259 MD5 dae618bfdba97e08600f5b53dfe98c59 RMD160 d269df9ab78cb2f48bed47582787b0afff25d985 SHA1 48412b682a1919d23c3879572606b30492aef976 SHA256 1b9f99f8d5e7fd0776e5fec8dfeca4563bc1dcc055b55b6538ff15f5f624c141 SHA512 dbed43fc62b1b3e7ac82f5453cc84b6cb1a5da238ff65acd8f3e3e565afc1c17f78863b07b33be9758e6d40c12436840e29f1f441ec10aefa50f87fa974d0aa3 +SLACKBUILD lsyncd.SlackBuild 7220 MD5 6bf38456c9e3ee0a91a29b4d07b5f4fa RMD160 40c68b881ca795f20612a6ee1bfb0393ee2aaa65 SHA1 936dd64ae5d843a4a0e20fac7c754728ea0ee1d7 SHA256 d96630416f9515839e395813e52869210ee3b05eb880a6719d5192d09222a368 SHA512 b6bb3af127a903bcef1fd498a10f824f5e47df8266ba5ca4dcf1a27027449a67936e9aee9a61ad5f61d7866c8ce7b1cf126e47c8cf3084177787ea2846bdbe0d +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.9 (GNU/Linux) + +iQIcBAEBAgAGBQJJ29VSAAoJEEHL93ESzgeibNQQAK4txyffT0zQ77ndqITwOYjq +V3nVnu1I5TtQ5t+hp7663Mf4ctr8L8aLaFSlw7TLy5cA8Yafg7kiGIRfPLPjkpI5 ++4wuXI8k6oKeA8qObr4N+g9wigF2iPhd8isolxUnO8IUs3CF65hSv2QW29mBvuQV +rYhgFxCET23dYOG884iUblEZVz3clulJBZ931b8b5vj8VTGB0M7dK+f8jOigL8G4 +i2U38XHUO2fM8zUVdPDAmAMyG1hrRKFzkrho7aMG7Lt+3dEtyQ3c7HFZZAXKcJ5F +VzlmLNqV09i64VU2oufD8csGLpV1f2LtLI4BAJ3mfLPi8RaJ+b/0H0tsi38dtjFu +yIrtts645qakPrKiqNwsfPBhBf6jr9K283+yd7ceSKThSO70VmMclIzgfw/oxS4E +DDbm2++BOwtnxYyLKiorw6dwcI3aWFtaflkdd5ZOel+nU4hGFQfQPLYk1Eo52IAz +bktJu4InVrz5V25cJ+TT/L+P+dOLcwyto5C0vI9Re9/UdVHutTpHL6iAoyepK1ws +5V2PfjdrpVcbTlzeEGISqEX6OT5BG54gl9gFqpGcqt8a7W4dCpYwxK8sqw23QBr8 +oQQB76ID4IzRq/+GbMFMyMjbVrmaI8M6r9EHmowXZwzR2q9pO0cGtE9Hxh5qNIqM +7eYa+Lw687+NsAYorDYJ +=E+Yn +-----END PGP SIGNATURE----- diff --git a/app/backup/lsyncd/lsyncd.SlackBuild b/app/backup/lsyncd/lsyncd.SlackBuild new file mode 100644 index 00000000..7221c851 --- /dev/null +++ b/app/backup/lsyncd/lsyncd.SlackBuild @@ -0,0 +1,223 @@ +#!/bin/bash +# +# lsyncd.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. +# +# lsyncd.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 +# +# slackbuild for lsyncd, by Silvio Rhatto +# requires: +# tested: lsyncd-1.26 +# model: generic.mkSlackBuild $Rev: 805 $ +# + +# Look for slackbuildrc +if [ -f ~/.slackbuildrc ]; then + source ~/.slackbuildrc +elif [ -f /etc/slackbuildrc ]; then + source /etc/slackbuildrc +fi + +# Set variables +CWD="$(pwd)" +SRC_NAME="lsyncd" +PKG_NAME="lsyncd" +ARCH=${ARCH:=i486} +SRC_VERSION=${VERSION:=1.26} +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} +SLACKBUILD_PATH=${SLACKBUILD_PATH:="app/backup/lsyncd"} +PREFIX=${PREFIX:=/usr} +PKG_WORK="$TMP/$SRC_NAME" +CONF_OPTIONS=${CONF_OPTIONS:=""} +NUMJOBS=${NUMJOBS:=""} + +# 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_VCS=41; ERROR_MKDIR=42 +ERROR_MANIFEST=43; + +# Clean up any leftovers of previous builds +rm -rf "$PKG_WORK" 2> /dev/null +rm -rf "$PKG" 2> /dev/null + +# 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 + +# Dowload source if necessary +SRC="$SRC_NAME-$VERSION.tar.gz" +URL="http://lsyncd.googlecode.com/files/$SRC" + +if [ ! -s "$SRC_DIR/$SRC" ] || ! gunzip -t "$SRC_DIR/$SRC" 2> /dev/null; then + wget "$URL" -O "$SRC_DIR/$SRC" || 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 + + if [ ! -e "$MANIFEST_FILE" ] || [ -d "$MANIFEST_FILE" ]; then + continue + fi + + echo "Checking Manifest for $MANIFEST_FILE_TYPE $MANIFEST_FILE integrity..." + + SIZE_SRC="`wc -c $MANIFEST_FILE | awk '{ print $1 }'`" + SIZE_MANIFEST="`echo $MANIFEST_LINE | awk '{ print $3 }'`" + + # 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 + + # 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 + + done + +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 + +# Compile +make $NUMJOBS || exit $ERROR_MAKE + +# Install +make install DESTDIR="$PKG" || exit $ERROR_INSTALL + +# 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 +) + +# Install documentation +DOCS="AUTHORS COPYING ChangeLog INSTALL NEWS README TODO" +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 + +# 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 +# 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 +# make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':'. + + |-----handy-ruler-------------------------------------------------------| +lsyncd: lsyncd +lsyncd: +lsyncd: Lsyncd uses rsync to synchronize local directories with a remote +lsyncd: machine running rsyncd. Lsyncd watches multiple directories trees +lsyncd: through inotify. The first step after adding the watches is to +lsyncd: rsync all directories with the remote host, and then sync single +lsyncd: file by collecting the inotify events. So lsyncd is a light-weight +lsyncd: live mirror solution that should be easy to install and use while +lsyncd: blending well with your system. See lsyncd --help for detailed +lsyncd: command line options. +lsyncd: +EODESC + +# 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 -- cgit v1.2.3