#!/bin/bash # src2pkg-bootstrap.src2pkg ## This script builds the src2pkg/src2pkg package, ## including the libsentry libraries. Once you ## have built the src2pkg package, install it using ## the 'installpkg' command. Then you can build other ## packages from source using the src2pkg/src2pkg tools. CWD=$(pwd) # use /tmp if you can't write to the current working directory TEMP_DIR=$CWD NAME="src2pkg" VERSION="1.9" BUILD="1" ARCH='noarch' LIBSENTRY_VERSION="0.6.7.3" TAR_VERSION=1.13 BB_VERSION=1.2.1 PKG_DIR=$TEMP_DIR/$NAME-$VERSION-$ARCH-$BUILD$SIG PACKAGE=$TEMP_DIR/$NAME-$VERSION-$ARCH-$BUILD$SIG.tgz [[ -d $PKG_DIR ]] && echo "Removing existing PKG_DIR" && rm -rf $PKG_DIR [[ -e $PACKAGE ]] && echo "Removing existing package" && rm -rf $PACKAGE cd $TEMP_DIR ; # build the package echo "Creating Package Tree..." mkdir -p $PKG_DIR chown root:root $PKG_DIR chmod 755 $PKG_DIR mkdir -p $PKG_DIR/usr/libexec/src2pkg chmod 755 $PKG_DIR/usr/libexec/src2pkg cp -a $CWD/Resources/libexec/* $PKG_DIR/usr/libexec/src2pkg chown root:root $PKG_DIR/usr/libexec/src2pkg/* chmod 644 $PKG_DIR/usr/libexec/src2pkg/* # Install static tar mkdir -p $PKG_DIR/usr/libexec/src2pkg/static chmod 755 $PKG_DIR/usr/libexec/src2pkg/static # src2pkg mkdir -p $PKG_DIR/usr/bin cp -a $CWD/Resources/bin/src2pkg $PKG_DIR/usr/bin chown root:root $PKG_DIR/usr/bin/src2pkg chmod 755 $PKG_DIR/usr/bin/src2pkg # trackinstall cp -a $CWD/Resources/bin/trackinstall $PKG_DIR/usr/bin chown root:root $PKG_DIR/usr/bin/trackinstall chmod 755 $PKG_DIR/usr/bin/trackinstall # disrpm mkdir -p $PKG_DIR/usr/bin cp -a $CWD/Resources/bin/disrpm $PKG_DIR/usr/bin chown root:root $PKG_DIR/usr/bin/disrpm chmod 755 $PKG_DIR/usr/bin/disrpm # tracklist can be run by non-root users so place it in /usr/bin #mkdir -p $PKG_DIR/usr/bin cp -a $CWD/Resources/bin/tracklist $PKG_DIR/usr/bin chown root:root $PKG_DIR/usr/bin/tracklist chmod 755 $PKG_DIR/usr/bin/tracklist # install the libsentry wrapper cp -a $CWD/Resources/bin/sentry $PKG_DIR/usr/bin chown root:root $PKG_DIR/usr/bin/sentry chmod 755 $PKG_DIR/usr/bin/sentry # config files mkdir -p $PKG_DIR/etc/src2pkg cp -a $CWD/Resources/etc/* $PKG_DIR/etc/src2pkg chown root:root $PKG_DIR/etc/src2pkg/* chmod 755 $PKG_DIR/etc/src2pkg chmod 644 $PKG_DIR/etc/src2pkg/* # docs mkdir -p $PKG_DIR/usr/doc/$NAME-$VERSION cp -a $CWD/Resources/doc/* $PKG_DIR/usr/doc/$NAME-$VERSION cp -a $TEMP_DIR/libsentry-$LIBSENTRY_VERSION/README $PKG_DIR/usr/doc/$NAME-$VERSION/README if [[ -e ../$CWD/ChangeLog ]] ; then rm -f $PKG_DIR/usr/doc/$NAME-$VERSION/ChangeLog cp -a ../$CWD/ChangeLog $PKG_DIR/usr/doc/$NAME-$VERSION/ fi chown -R root:root $PKG_DIR/usr/doc/$NAME-$VERSION cd $PKG_DIR/usr/doc/$NAME-$VERSION ; find . -type f -exec chmod 644 {} \; # manpage(s) mkdir -p $PKG_DIR/usr/man/man1 cp -a $CWD/Resources/man/* $PKG_DIR/usr/man/man1 gzip $PKG_DIR/usr/man/man1/* # slack-desc and doinst.sh mkdir -p $PKG_DIR/install cp -a $CWD/slack-desc $PKG_DIR/install cp $CWD/doinst.sh $PKG_DIR/install echo "Creating Package..." cd $PKG_DIR ; # use our new tar-1.13 so the package is created properly $TEMP_DIR/tar-1.13/src/tar cvf $NAME-$VERSION-$ARCH-$BUILD$SIG.tar . gzip -9 $NAME-$VERSION-$ARCH-$BUILD$SIG.tar mv $NAME-$VERSION-$ARCH-$BUILD$SIG.tar.gz ../$NAME-$VERSION-$ARCH-$BUILD$SIG.tgz echo "Finished Package is located in:" echo "$PACKAGE" echo "" echo "Use 'installpkg $NAME-$VERSION-$ARCH-$BUILD.tgz' to install the package." echo "Then you can use the 'src2pkg' program to build sources and/or generate" echo "src2pkg scripts for build customization." if [[ $1 = "--cleanup" ]] ; then cd $TEMP_DIR ; rm -rf $NAME-$VERSION-$ARCH-$BUILD$SIG rm -rf busybox-$BB_VERSION rm -rf libsentry-$LIBSENTRY_VERSION rm -rf tar-$TAR_VERSION fi