#!/bin/bash # # fakeroot.SlackBuild # code: Vicious (michal@scxd.info); improvements: Zielony (e-pl@o2.pl) set -e # PACKAGE GENERAL INFO [EDIT] PKGNAME=fakeroot VERSION=1.9.1 BUILD=1X ARCH=i686 URL=http://ftp.debian.org/debian/pool/main/f/fakeroot/fakeroot_$VERSION.tar.gz CWD=`pwd` TMP=/tmp/$PKGNAME if [ -e $TMP/$PKGNAME-$VERSION/'Makefile' ]; then cd $TMP/$PKGNAME-$VERSION make else if [ ! -d $TMP/$PKGNAME-$VERSION ]; then rm -rf $TMP/package mkdir -p $TMP/package/install $TMP/package/usr/doc/$PKGNAME-$VERSION # PACKAGE DESCRIPTION [EDIT] cat << SLACKDESC | fmt -w $(( 80 - `echo $PKGNAME | wc -c` - 3 )) | perl -pe "s/^/$PKGNAME: /" > $TMP/package/install/slack-desc Fakeroot (fake root privileges) Fakeroot runs a command in an environment were it appears to have root privileges for file manipulation, by setting LD_PRELOAD to a library with alternative versions of getuid(), stat(), etc. This is useful for allowing users to create archives with files in them with root permissions/ownership. Without fakeroot one would have to have root privileges to create the constituent files of the archives with the correct permissions and ownership, and then pack them up, or one would have to construct the archives directly, without using the archiver. Package prepared by Zielony (e-pl@o2.pl) SLACKDESC cd $TMP # step 1: DOWNLOAD SOURCE PKGFNAME=`ls -t | grep -i $PKGNAME*.t*z* | head -1` if [ -z $PKGFNAME ]; then ( wget -c $URL -P $TMP -O $PKGNAME-$VERSION.${URL//*.} ) # step 2: UNPACK SOURCE AND COMPILE PKGFNAME=`ls -t | grep -i $PKGNAME*.t*z* | head -1` fi EXTENSION=`echo ${PKGFNAME//*.}` if [ $EXTENSION = "bz2" ]; then tar jxvf $PKGFNAME -C $TMP else tar xvfz $PKGFNAME -C $TMP fi DIRNAME=`tar tf $PKGFNAME | head -1` echo $DIRNAME | grep '/' && DIRNAME=${DIRNAME%${DIRNAME#*/}} if [ $DIRNAME != $PKGNAME-$VERSION/ ]; then mv $DIRNAME $PKGNAME-$VERSION; fi chown root:root $TMP -R fi cd $TMP/$PKGNAME-$VERSION if [ "$ARCH" = "i686" ]; then SLKCFLAGS="-O2 -march=i686 -mtune=i686" elif [ "$ARCH" = "i486" ]; then SLKCFLAGS="-O2 -march=i486 -mtune=i686" elif [ "$ARCH" = "i386" ]; then SLKCFLAGS="-O2 -march=i386 -mcpu=i686" elif [ "$ARCH" = "s390" ]; then SLKCFLAGS="-O2" elif [ "$ARCH" = "x86_64" ]; then SLKCFLAGS="-O2" fi if [ -s 'configure' ]; then CFLAGS="$SLKCFLAGS" CXXFLAGS="$SLKCFLAGS" ./configure \ --prefix=/usr \ --disable-debug \ --disable-static \ --mandir=/usr/man \ --sysconfdir=/etc \ --program-prefix="" \ --program-suffix="" \ $ARCH-slackware-linux fi make fi make install DESTDIR=$TMP/package cp -af README AUTHORS BUGS COPYING DEBUG $TMP/package/usr/doc/$PKGNAME-$VERSION find $TMP/package/usr/man ! -name 'man*' -mindepth 1 -maxdepth 1 -exec rm -rf \{} \; # step 3: STRIP BINARIES & GZIP MANUALS ( cd $TMP/package 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 ) ( gzip $TMP/package/usr/man/man?/* ) # step 4: CREATE PACKAGE & CLEAN TMP cd $TMP/package if [ `ls | wc -m` -le 8 ]; then echo "Brak plików pakietu!" else ( requiredbuilder -y -s $TMP/package/install $TMP/$PKGNAME-$VERSION ) makepkg -l y -c n $CWD/$PKGNAME-$VERSION-$ARCH-$BUILD.tgz rm -rf $TMP fi