#!/bin/sh -x CWD=$(pwd) PRGNAM=$(basename $CWD) TAG=cyco TMP=${TMP:-/tmp/cyco} PKG=$TMP/pkg-$PRGNAM OUTPUT=${OUTPUT:-/tmp} VERSION=${VERSION:-PLACEHOLDER} ARCH=${ARCH:-noarch} BUILD=${BUILD:-1} TAG=${TAG:-cyco} PREFIX=/usr set -e rm -rf $PKG mkdir -p $TMP $OUTPUT $PKG/{opt,etc/profile.d} cd $PKG/opt [ -e $CWD/$PRGNAM.zip ] && mv $CWD/$PRGNAM.zip $CWD/$PRGNAM.zip.bkp wget -c http://s3.amazonaws.com/ec2-downloads/$PRGNAM.zip -O $CWD/$PRGNAM.zip unzip $CWD/$PRGNAM.zip || exit 1 VERSION=$(ls | sed "s|$PRGNAM-||") 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 {} \; chmod +x bin/* mkdir -p $PKG$PREFIX/bin ( cd $PKG$PREFIX/bin for b in $PKG/opt/$PRGNAM-$VERSION/bin/* ; do ln -s /opt/$PRGNAM-$VERSION/bin/$(basename $b) $(basename $b) done ) cat < $PKG/etc/profile.d/$PRGNAM.sh #!/bin/sh export EC2_AMITOOL_HOME=/opt/$PRGNAM-$VERSION EOF cat < $PKG/etc/profile.d/$PRGNAM.csh #!/bin/csh setenv EC2_AMITOOL_HOME /opt/$PRGNAM-$VERSION EOF chmod +x $PKG/etc/profile.d/$PRGNAM.* mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION mv *.txt $PKG/usr/doc/$PRGNAM-$VERSION 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 || true mkdir -p $PKG/install cat < $PKG/install/slack-desc $PRGNAM: $PRGNAM (Amazon EC2 Machine Image Command line tools) $PRGNAM: $PRGNAM: $PRGNAM: $PRGNAM: $PRGNAM: $PRGNAM: $PRGNAM: $PRGNAM: $PRGNAM: http://aws.amazon.com/developertools/368 EOF makepkg -l y -c n $OUTPUT/$PRGNAM-$(echo $VERSION | tr - _)-$ARCH-$BUILD$TAG.txz