#!/bin/sh # Built on TCL v4.1 # Required extensions: # compiletc # bison # diffutils # file # findutils # flex # gawk # gcc # gcc_libs # binutils # mpfr # gmp # mpc # grep # m4 # make # patch # pkg-config # glib2 # popt # sed # e2fsprogs_base-dev # eglibc_base-dev # freetype_base-dev # gcc_base-dev # imlib2_base-dev # jpeg_base-dev # libpng_base-dev # linux-3.0.1_api_headers # util-linux_base-dev # zlib_base-dev # squashfs-tools-4.x # tar # openssl-1.0.0 # openssl-1.0.0-dev getTime.sh installExtension() { if [ ! -e /usr/local/tce.installed/$1 ]; then echo "Installing "$1" ..." if [ -e $TCEDIR/optional/$1.tcz ]; then tce-load -i $1 else tce-load -wi $1 fi [ ! -e /usr/local/tce.installed/$1 ] && echo "Error: Extension "$1" not installed! Aborting" && exit fi } createExtension() { mksquashfs $1 $1.tcz -noappend [ ! -e $1.tcz ] && echo "Error: "$1".tcz not created! Aborting" && exit } unpackSrc() { #unpack source if [ -e $1.tar.bz2 ]; then tar -jxf $1.tar.bz2 elif [ -e $1.tb2 ]; then tar -jxf $1.tb2 elif [ -e $1.tbz ]; then tar -jxf $1.tbz elif [ -e $1.tar.gz ]; then tar -zxf $1.tar.gz elif [ -e $1.tgz ]; then tar -zxf $1.tgz elif [ -e $1.tar.xz ]; then tar -Jxf $1.tar.xz elif [ -e $1.txz ]; then tar -Jxf $1.txz elif [ -e $1.tar.lzma ]; then tar -xf $1.tar.lzma --lzma elif [ -e $1.tlz ]; then tar -xf $1.tlz --lzma else echo "Source "$1" not found! Aborting" && exit fi } # Install these extensions automagically export EXTS="compiletc squashfs-tools-4.x tar openssl-1.0.0-dev openssl-1.0.0" export TCEDIR=`cat /opt/.tce_dir` export CFLAGS="-march=i486 -mtune=i686 -Os -pipe" export CXXFLAGS=$CFLAGS" -fno-exceptions -fno-rtti" export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig export EXTNAME="vsftpd" export VER="-2.3.5" export DESTDIR=`pwd`/$EXTNAME export PKGNAME=$EXTNAME$VER for f in $EXTS; do installExtension $f done unpackSrc $PKGNAME cd $PKGNAME # change some defaults to be more compatible with TC sed -i 's!etc!usr/local/etc!' defs.h sed -i "s!-O2!$CFLAGS!" Makefile sed -i 's!/usr!$(DESTDIR)/usr!' Makefile sed -i 's!/etc!$(DESTDIR)/usr/local/etc!' Makefile sed -i 's!usr/share/empty!usr/local/share/empty!' tunables.c sed -i 's!etc!usr/local/etc!' tunables.c sed -i 's!usr/share!usr/local/etc!' tunables.c # bug in source, need to make these directories to avoid errors, does not install to prefix unless these are present mkdir -p $DESTDIR/usr/local/man/man8 $DESTDIR/usr/local/man/man5 $DESTDIR/usr/local/sbin $DESTDIR/usr/local/etc $DESTDIR/usr/local/tce.installed $DESTDIR/usr/local/share/empty mkdir -p $DESTDIR-ssl/usr/local/man/man8 $DESTDIR-ssl/usr/local/man/man5 $DESTDIR-ssl/usr/local/sbin $DESTDIR-ssl/usr/local/etc $DESTDIR-ssl/usr/local/tce.installed $DESTDIR-ssl/usr/local/share/empty make && make install || exit cp vsftpd.conf $DESTDIR/usr/local/etc/vsftpd.conf.orig cd $DESTDIR sudo chown root:staff usr/local/etc/vsftpd.conf.orig strip --strip-unneeded usr/local/sbin/* rm -rf usr/local/man echo "#!/bin/sh [ ! -e /usr/local/etc/vsftpd.conf ] && cp -p /usr/local/etc/vsftpd.conf.orig /usr/local/etc/vsftpd.conf" > usr/local/tce.installed/$EXTNAME sudo chown -R root:staff usr/local/tce.installed sudo chmod -R 775 usr/local/tce.installed # Build again for SSL support cd ../$PKGNAME export DESTDIR=$DESTDIR-ssl sed -i 's!#undef VSF_BUILD_SSL!#define VSF_BUILD_SSL!' builddefs.h make clean && make && make install || exit cp vsftpd.conf $DESTDIR-ssl/usr/local/etc/vsftpd.conf.orig cd $DESTDIR strip --strip-unneeded usr/local/sbin/* sudo chown root:staff usr/local/etc/vsftpd.conf.orig rm -rf usr/local/man echo "#!/bin/sh [ ! -e /usr/local/etc/vsftpd.conf ] && cp -p /usr/local/etc/vsftpd.conf.orig /usr/local/etc/vsftpd.conf" > usr/local/tce.installed/$EXTNAME-ssl sudo chown -R root:staff usr/local/tce.installed sudo chmod -R 775 usr/local/tce.installed cd .. createExtension $EXTNAME createExtension $EXTNAME-ssl sudo rm -rf $EXTNAME $EXTNAME-ssl $PKGNAME # Create extension support files and test installExtension "submitqc4" submitqc4