#!/bin/sh # Heavily based on the Slackware 13.0 SlackBuild # Set initial variables: PKGNAM=sshfs VERSION=${VERSION:-2.2} ARCH=${ARCH:-i486} BUILD=${BUILD:-3kc} SRCPACK=${PKGNAM}-fuse-$VERSION.tar.gz CWD=$(pwd) TMP=${TMP:-/tmp} PKG=$TMP/package-${PKGNAM} SRC=$TMP/source-${PKGNAM} if [ "$ARCH" = "i386" ]; then SLKCFLAGS="-O2 -march=i386 -mcpu=i686" elif [ "$ARCH" = "i486" ]; then SLKCFLAGS="-O2 -march=i486 -mtune=i686" elif [ "$ARCH" = "s390" ]; then SLKCFLAGS="-O2" elif [ "$ARCH" = "x86_64" ]; then SLKCFLAGS="-O2" fi mkdir -p $TMP rm -rf $PKG mkdir -p $PKG rm -rf $SRC mkdir -p $SRC cd $SRC || exit 1 tar vxzf $CWD/${SRCPACK} ################################################## cd $(ls) || exit 1 # SOURCE TREE ################################################## chown -R root:root . find . -perm +111 -exec chmod 755 {} \; find . ! -perm +111 -exec chmod 644 {} \; CFLAGS="$SLKCFLAGS" \ ./configure \ --prefix=/usr \ --build=$ARCH-slackware-linux make || exit 1 make install DESTDIR=$PKG || exit 1 mkdir -p $PKG/usr/man/man1 cat $PKG/usr/share/man/man1/sshfs.1 | gzip -9c > $PKG/usr/man/man1/sshfs.1.gz rm -rf $PKG/usr/share # Add documentation: mkdir -p $PKG/usr/doc/${PKGNAM}-$VERSION cp -a AUTHORS COPYING ChangeLog FAQ.txt INSTALL NEWS README $PKG/usr/doc/${PKGNAM}-$VERSION ################################################## cd $PKG || exit 1 # PACKAGE TREE ################################################## 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 -g usr/lib/*.a usr/lib/*/*.a rm -f usr/info/dir gzip -9 usr/info/* usr/man/man?/*.? usr/man/*/man?/*.? 2> /dev/null # Add install files: mkdir install cat $CWD/slack-desc > install/slack-desc #cat $CWD/slack-required > install/slack-required #zcat $CWD/doinst.sh.gz > install/doinst.sh ## Remove empty directories: #find . -type d -exec rmdir -p {} \; 2> /dev/null # List files with unusual perm, user, group: find . -type d ! -perm 755 -exec ls -ld {} \; find . ! -type d ! -type l -perm +6022 -exec ls -ld {} \; find . ! -user root -exec ls -ld {} \; find . ! -group root ! -group bin -exec ls -ld {} \; # Build the package: requiredbuilder -v -y -s $CWD $PKG makepkg -l y -c n $CWD/${PKGNAM}-$VERSION-$ARCH-$BUILD.txz # Clean up the extra stuff: [ "$1" = "--cleanup" ] && rm -rf $SRC $PKG