#!/bin/sh # Heavily based on the Slackware 13.0 SlackBuild # # SlackBuild from Matteo Rossini (zerouno @ slacky.it) # Patches from Debian # site: http://www.brzitwa.de/mb/gpart/ # # # Guess PC disk partition table, find lost partitions # # Gpart is a tool which tries to guess the primary partition table of a PC-type disk in case the primary partition table in sector 0 is damaged, incorrect or deleted. # # It is also good at finding and listing the types, locations, and sizes of inadvertently-deleted partitions, both primary and logical. It gives you the information you need to manually re-create them (using fdisk, cfdisk, sfdisk, etc.). # # The guessed table can also be written to a file or (if you firmly believe the guessed table is entirely correct) directly to a disk device. # # Currently supported (guessable) filesystem or partition types: # # * BeOS filesystem type. # * FreeBSD/NetBSD/386BSD disklabel sub-partitioning scheme used on Intel # platforms. # * Linux second extended filesystem. # * MS-DOS FAT12/16/32 "filesystems". # * IBM OS/2 High Performance filesystem. # * Linux LVM physical volumes (LVM by Heinz Mauelshagen). # * Linux swap partitions (versions 0 and 1). # * The Minix operating system filesystem type. # * MS Windows NT/2000 filesystem. # * QNX 4.x filesystem. # * The Reiser filesystem (version 3.5.X, X > 11). # * Sun Solaris on Intel platforms uses a sub-partitioning scheme on PC hard # disks similar to the BSD disklabels. # * Silicon Graphics' journalling filesystem for Linux. set -e CWD=`pwd` NAME=gpart TMP=${TMP:-/tmp/txz}/$NAME PKG=$TMP/$NAME-package VER=0.1h SVER=11 BUILD=1mt ARCH=${ARCH:-i486} VERSION=${VER}_$SVER TAR=${NAME}_$VER.orig.tar.gz PATCH=${NAME}_$VER-$SVER.diff.gz DSC=${NAME}_$VER-$SVER.dsc SOURCE=http://ftp.de.debian.org/debian/pool/main/g/$NAME/ if [ "$ARCH" = "i386" ]; then SLKCFLAGS="-march=i386 -mcpu=i686" elif [ "$ARCH" = "i486" ]; then SLKCFLAGS="-march=i486 -mtune=i686" elif [ "$ARCH" = "i686" ]; then SLKCFLAGS="" elif [ "$ARCH" = "x86_64" ]; then SLKCFLAGS="" LIBDIRSUFFIX=64 fi [ -e $TMP ]&&rm -rf $TMP mkdir -p $TMP [ -e $PKG ]&&rm -rf $PKG mkdir -p $PKG [ ! -e $TAR ]&&wget $SOURCE/$TAR [ ! -e $PATCH ]&&wget $SOURCE/$PATCH cd $TMP tar xzvf $CWD/$TAR cd $NAME-$VER || exit 1 chown -R root.root . chmod -R u+w,go+r-w,a-s . gzip -cd $CWD/$PATCH | patch -p1 cat debian/patches/*.patch |patch -p1 echo "CFLAGS+=$SLKCFLAGS" >> make.defs make make LDFLAGS="-L/lib$LIBDIRSUFFIX/libc.so.6 -static" prg=gpart_static -C src make install DESTDIR=$PKG mandir=$PKG/usr/man make install DESTDIR=$PKG prg=gpart_static -C src mkdir -p $PKG/usr/doc cp $CWD/$NAME.SlackBuild $CWD/slack-desc $PKG/usr/doc cp COPYING Changes INSTALL LSM Makefile README $PKG/usr/doc mkdir -p $PKG/usr/doc/debian cd debian cp changelog compat control copyright gpart.docs $PKG/usr/doc/debian mkdir -p $PKG/install cp $CWD/slack-desc $PKG/install ( find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs -r strip --strip-unneeded ) ( cd $PKG/usr/man find . -type f -exec gzip -9 {} \; ) cd $PKG requiredbuilder -v -y -s $CWD $PKG /sbin/makepkg -l y -c n $CWD/$NAME-$VERSION-$ARCH-$BUILD.txz if [ "$1" = "--cleanup" ]; then rm -rf $TMP/$NAME-$VER $PKG fi