diff --git a/system/foremost/README b/system/foremost/README new file mode 100644 index 0000000000..3362396b24 --- /dev/null +++ b/system/foremost/README @@ -0,0 +1,5 @@ +Foremost is a Linux program to recover files based on their headers and +footers. Foremost can work on image files, such as those generated by dd, +Safeback, Encase, etc, or directly on a drive. The headers and footers are +specified by a configuration file, so you can pick and choose which +headers you want to look for. \ No newline at end of file diff --git a/system/foremost/doinst.sh b/system/foremost/doinst.sh new file mode 100644 index 0000000000..908b49e64d --- /dev/null +++ b/system/foremost/doinst.sh @@ -0,0 +1,14 @@ +config() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + # 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... +} + +config etc/foremost.conf.new diff --git a/system/foremost/foremost-broken-jpeg.patch b/system/foremost/foremost-broken-jpeg.patch new file mode 100644 index 0000000000..fef3ad164c --- /dev/null +++ b/system/foremost/foremost-broken-jpeg.patch @@ -0,0 +1,17 @@ +diff -Naur foremost-1.5.6.orig/extract.c foremost-1.5.6/extract.c +--- foremost-1.5.6.orig/extract.c 2009-05-06 03:56:16.000000000 +0000 ++++ foremost-1.5.6/extract.c 2009-06-07 19:59:12.000000000 +0000 +@@ -1794,7 +1794,12 @@ + if (((foundat + headersize) - buf) > buflen){ return NULL; } + + foundat += headersize; +- ++ ++ if (foundat >= (buf + buflen)) ++ { ++ return buf + needle->header_len; ++ } ++ + if (foundat[2] != (unsigned char)'\xff') + { + break; diff --git a/system/foremost/foremost.SlackBuild b/system/foremost/foremost.SlackBuild new file mode 100644 index 0000000000..d0e0fe7d4e --- /dev/null +++ b/system/foremost/foremost.SlackBuild @@ -0,0 +1,81 @@ +#!/bin/sh +# Slackware build script for foremost +# Written by Larry Hajali + +PRGNAM=foremost +VERSION=${VERSION:-1.5.6} +ARCH=${ARCH:-i486} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i486" ]; then + SLKCFLAGS="-O2 -march=i486 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +tar xvf $CWD/$PRGNAM-$VERSION.tar.gz +cd $PRGNAM-$VERSION +chown -R root:root . +find . \ + \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \ + -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ + -exec chmod 644 {} \; + +# Set the $ARCH variable for the Makefile. +sed -i "s|-O2|\$(CFLAGS)|" Makefile +# Set location of configuration file. +sed -i 's|\/usr\/local\/etc|\/etc|' config.c +# Fix segfaults with broken jpeg headers. +patch -p1 < $CWD/foremost-broken-jpeg.patch +# Make the directories. +mkdir -p $PKG/etc $PKG/usr/{man/man8,bin} + +make CFLAGS="$SLKCFLAGS" +make install \ + CONF=$PKG/etc \ + MAN=$PKG/usr/man/man8 \ + BIN=$PKG/usr/bin + +( cd $PKG + find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | \ + xargs strip --strip-unneeded 2> /dev/null || true + find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | \ + xargs strip --strip-unneeded 2> /dev/null +) + +# Don't clobber conf file on upgrades. +mv $PKG/etc/foremost.conf $PKG/etc/foremost.conf.new + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +./foremost -V > COPYRIGHT +cp -a \ + CHANGES README COPYRIGHT \ + $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild +# Remove executable priveleges from text files. +chmod 0644 $PKG/usr/doc/$PRGNAM-$VERSION/* + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc +cat $CWD/doinst.sh > $PKG/install/doinst.sh + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.tgz diff --git a/system/foremost/foremost.info b/system/foremost/foremost.info new file mode 100644 index 0000000000..44511c46ff --- /dev/null +++ b/system/foremost/foremost.info @@ -0,0 +1,8 @@ +PRGNAM="foremost" +VERSION="1.5.6" +HOMEPAGE="http://foremost.sourceforge.net/" +DOWNLOAD="http://foremost.sourceforge.net/pkg/foremost-1.5.6.tar.gz" +MD5SUM="1ac068f5681bbee679f99d2f9fa7f39f" +MAINTAINER="Larry Hajali" +EMAIL="larryhaja[at]gmail[dot]com" +APPROVED="dsomero" diff --git a/system/foremost/slack-desc b/system/foremost/slack-desc new file mode 100644 index 0000000000..2c140cdcde --- /dev/null +++ b/system/foremost/slack-desc @@ -0,0 +1,19 @@ +# 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------------------------------------------------------| +foremost: foremost (recover files based on their headers and footers) +foremost: +foremost: Foremost is a Linux program to recover files based on their headers +foremost: and footers. Foremost can work on image files, such as those +foremost: generated by dd, Safeback, Encase, etc, or directly on a drive. The +foremost: headers and footers are specified by a configuration file, so you can +foremost: pick and choose which headers you want to look for. +foremost: +foremost: Homepage: http://foremost.sourceforge.net/ +foremost: +foremost: