#!/bin/bash # # Blueprint to build e2fsprogs-1.35 with a statically-linked # e2fsck program. # # Static linking provides an extra degree of fault-tolerance by # ensuring that e2fsck can still function even if libraries become # corrupted or deleted. The best fault-tolerance can be achieved # when e2fsprogs-static is used with sysvint-static and bash-static # as a root shell. # # Source code is from http://e2fsprogs.sourceforge.net # # This architect blueprint is copyright (c)2003-2004 David Horton # dhorton@nospam.speakeasy.net # # This program 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 # (at your option) any later version. # # This program 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: # # Free Software Foundation, Inc. # 59 Temple Place - Suite 330 # Boston, MA 02111-1307, USA # # # Define the package name, source directory, build directory and # staging directory paths. Prefixes to directories may be overridden # by setting shell variables SRC, BUILD and STAGING. For example, # doing "export SRC=/root/foo" before calling this script will override # the default /usr/src and set SRC_DIR to /root/foo/$PKG_NAME instead. # PKG_NAME=$(basename $0) SRC_DIR=${SRC:-/usr/src}/$PKG_NAME # Remove "-static" from the source path using sed. SRC_DIR=$(echo "$SRC_DIR" | sed s/-static//) BUILD_DIR=${BUILD:-/var/tmp/build}/$PKG_NAME STAGING_DIR=${STAGING:-/var/tmp/staging}/$PKG_NAME # # Check that the source directory really exits and bail out if not. if ! [ -d $SRC_DIR ]; then echo "$PKG_NAME: Cannot find source code directory $SRC_DIR." exit 1 fi # # Do not overwrite existing build directory. if [ -d $BUILD_DIR ]; then echo "$PKG_NAME: Build directory $BUILD_DIR already exists." exit 2 else mkdir -p $BUILD_DIR fi # # Do not overwrite existing staging directory. if [ -d $STAGING_DIR ]; then echo "$PKG_NAME: Staging directory $STAGING_DIR already exists." exit 4 else mkdir -p $STAGING_DIR fi # # Configure the package for FHS compliance and i386 processor. export CC="gcc -mcpu=i386" cd $BUILD_DIR $SRC_DIR/configure \ --disable-evms \ --host=i386-pc-linux-gnu \ --infodir=/usr/share/info \ --mandir=/usr/share/man \ --prefix=/usr \ --with-root-prefix=/ # # Check return status and bail out if it's non-zero. if [ $? -gt 0 ]; then echo "$PKG_NAME: Configuration failed!" exit 8 fi # Build the package. make # # Check return code and bail if it looks bad. if [ $? -gt 0 ]; then echo "$PKG_NAME: Build failed!" exit 16 fi # # Install into staging area overriding make variables as needed. make \ DESTDIR=$STAGING_DIR \ install # # Check return code and bail if it looks bad. if [ $? -gt 0 ]; then echo "$PKG_NAME: Installation to staging area failed!" exit 32 fi # # Some programs, like mkfs.ext2, fsck.ext2 and so on are actually just # links to other programs. These are hard linked by default. Making # them symbolic links will not change the way these programs work, but # it will make it more obvious to the system admin that they are links. for E2FSCK_LINK in fsck.ext2 fsck.ext3; do rm $STAGING_DIR/sbin/$E2FSCK_LINK ln -s e2fsck $STAGING_DIR/sbin/$E2FSCK_LINK done for MKE2FS_LINK in mkfs.ext2 mkfs.ext3; do rm $STAGING_DIR/sbin/$MKE2FS_LINK ln -s mke2fs $STAGING_DIR/sbin/$MKE2FS_LINK done for TUNE2FS_LINK in e2label findfs; do rm $STAGING_DIR/sbin/$TUNE2FS_LINK ln -s tune2fs $STAGING_DIR/sbin/$TUNE2FS_LINK done # End of statically-linked e2fsprogs blueprint