#!/bin/bash # src2pkg.setup # Copyright 2007-2008 Gilbert Ashley # This script builds the binaries and libraries needed by src2pkg to function properly. The src2pkg package # contains no binaries when first installed, so this script must be run to setup src2pkg for use on your system. # This method is used to ensure that the binaries and libraries work properly on your system, no matter # which architecture and OS version you are running. It also provides a check to be sure that your system # has the basic tools needed to compile software. Otherwise src2pkg would not work anyway. SRC2PKG_HELPERS_VERSION=0.1 LIBSENTRY_VERSION=0.6.7.4 TAR_VERSION=1.13 COREUTILS_VERSION=5.2.1 TEMP_DIR=/tmp/src2pkg-helpers if [[ -d $TEMP_DIR ]] ; then rm -rf $TEMP_DIR fi mkdir -p $TEMP_DIR # ANSI COLORS CRE="" NORMAL="" # RED: Failure or error message RED="" # GREEN: Success message GREEN="" # YELLOW: Warnings YELLOW="" # BLUE: Summary messages BLUE="" # CYAN: Current Process CYAN="" echo $CYAN"NOTICE - "$NORMAL"Setting up src2pkg for the first time." echo " When first installed the src2pkg package contains" echo " only the script components of src2pkg. Since src2pkg" echo " also uses shared libraries, they must be compiled" echo " before you can use src2pkg. Compiling them on your" echo " system insures that these libs are compatible with" echo " your kernel and glibc version and OS version." echo " srcpkg also creates its' own copy of the tar program." echo "" #sleep 4 . /usr/libexec/src2pkg/FUNCTIONS get_flags if [[ $ARCH = "x86_64" ]] ; then CFLAGS="-O2 -fPIC" elif [[ $ARCH = "i486" ]] ; then CFLAGS="-O2" fi export CFLAGS cd $TEMP_DIR ; echo "Unpacking sources..." tar xf /usr/src/src2pkg/src2pkg-helpers/src2pkg-helpers-$SRC2PKG_HELPERS_VERSION.tar.bz2 cd src2pkg-helpers-$SRC2PKG_HELPERS_VERSION # make the libs cd libsentry-$LIBSENTRY_VERSION ; echo "Creating libsentry" make mkdir -p $TEMP_DIR/PKG/usr/libexec/src2pkg/lib cp libsentry.so $TEMP_DIR/PKG/usr/libexec/src2pkg/lib chmod 755 $TEMP_DIR/PKG/usr/libexec/src2pkg/lib/libsentry.so cd .. # make tar cd tar-$TAR_VERSION ; echo "Creating tar" patch -p1 < $TEMP_DIR/src2pkg-helpers-$SRC2PKG_HELPERS_VERSION/tar-1.13-bzip2.diff ./configure --disable-nls --with-ncursesw --enable-widec make mkdir -p $TEMP_DIR/PKG/usr/libexec/src2pkg/bin cp src/tar $TEMP_DIR/PKG/usr/libexec/src2pkg/bin/tar-1.13 chmod 755 $TEMP_DIR/PKG/usr/libexec/src2pkg/bin/tar cd .. # make the coreutils echo "Creating coreutils" cd coreutils-$COREUTILS_VERSION ; patch -p1 < $TEMP_DIR/src2pkg-helpers-$SRC2PKG_HELPERS_VERSION/coreutils-mini.diff ./configure make cd src for prog in cat chmod chown cp ginstall groups link ln mkdir mknod mv readlink rm rmdir stat touch unlink; do cp $prog $TEMP_DIR/PKG/usr/libexec/src2pkg/bin chmod 755 $TEMP_DIR/PKG/usr/libexec/src2pkg/bin/$prog done #( cd $TEMP_DIR/PKG/usr/libexec/src2pkg/bin ; ln -sf ginstall install ) mkdir -p $TEMP_DIR/PKG/install cp /usr/src/src2pkg/src2pkg-helpers/slack-desc $TEMP_DIR/PKG/install cp /usr/src/src2pkg/src2pkg-helpers/doinst.sh $TEMP_DIR/PKG/install mkdir -p $TEMP_DIR/PKG/usr/doc/src2pkg-helpers-$SRC2PKG_HELPERS_VERSION cp $TEMP_DIR/src2pkg-helpers-$SRC2PKG_HELPERS_VERSION/README $TEMP_DIR/PKG/usr/doc/src2pkg-helpers-$SRC2PKG_HELPERS_VERSION # remove any old package rm -f /usr/src/src2pkg/src2pkg-helpers/src2pkg-helpers-$SRC2PKG_HELPERS_VERSION-$ARCH-1.tgz # make the new package cd $TEMP_DIR/PKG makepkg -l n -c n /usr/src/src2pkg/src2pkg-helpers/src2pkg-helpers-$SRC2PKG_HELPERS_VERSION-$ARCH-1.tgz #exit # install new package -upgrading if necessary upgradepkg --install-new /usr/src/src2pkg/src2pkg-helpers/src2pkg-helpers-$SRC2PKG_HELPERS_VERSION-$ARCH-1.tgz rm -rf $TEMP_DIR echo "" echo $GREEN"DONE! "$NORMAL"src2pkg is now ready to use."