#!/bin/sh echo "Don't forget to update this script with the change-log! Press ENTER to start..." read NAME="cherokee" VERSION="1.2.101" SOURCE="http://www.cherokee-project.com/download/1.2/$VERSION/cherokee-$VERSION.tar.gz" CONFIGURE="--prefix=/usr/local --sysconfdir=/usr/local/etc --localstatedir=/var --with-wwwroot=/var/www" DATE=`date '+%Y/%m/%d'` SCRIPT_NAME=$(basename $0) cp $0 /tmp/ export CFLAGS="-march=i486 -mtune=i686 -Os -pipe" export CXXFLAGS="-march=i486 -mtune=i686 -Os -pipe" export LDFLAGS="-Wl,-O1" echo "Downloading essential packages..." tce-load -wi compiletc squashfs-tools-4.x gettext pcre pcre-dev openssl-1.0.0 openssl-1.0.0-dev ffmpeg-ffserver ffmpeg-ffserver-dev php5 php5-dev mysql-dev cd /tmp/ wget $SOURCE sudo rm -rf $NAME-$VERSION 2>/dev/null sudo rm /tmp/$NAME.tcz /tmp/$NAME.tcz.list /tmp/$NAME.tcz.md5.txt /tmp/$NAME.tcz.dep 2>/dev/null sudo rm -rf /tmp/$NAME 2>/dev/null sudo rm /tmp/$NAME-doc.tcz /tmp/$NAME-doc.tcz.list /tmp/$NAME-doc.tcz.md5.txt /tmp/$NAME-doc.tcz.dep 2>/dev/null sudo rm -rf /tmp/$NAME-doc 2>/dev/null sudo rm /tmp/$NAME-locale.tcz /tmp/$NAME-locale.tcz.list /tmp/$NAME-locale.tcz.md5.txt /tmp/$NAME-locale.tcz.dep 2>/dev/null sudo rm -rf /tmp/$NAME-locale 2>/dev/null tar xvfz $NAME-$VERSION.tar.gz cd $NAME-$VERSION echo " Starting ./configure $CONFIGURE" ./configure $CONFIGURE echo "Press ENTER to continue... " read make -j3 echo " Starting make install to: /tmp/$NAME" sudo make DESTDIR=/tmp/$NAME install-strip cd /tmp/$NAME sudo find . | xargs file | grep "executable" | grep ELF | grep "not stripped" | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null sudo find . | xargs file | grep "shared object" | grep ELF | grep "not stripped" | cut -f 1 -d : | xargs strip -g 2> /dev/null sudo rm -rf /tmp/$NAME/usr/local/include sudo rm -rf /tmp/$NAME/usr/local/share/aclocal sudo rm -rf /tmp/$NAME/usr/local/lib/*.a sudo rm -rf /tmp/$NAME/usr/local/lib/cherokee/*.a mkdir -p /tmp/$NAME-doc/usr/local/share mkdir -p /tmp/$NAME-locale/usr/local/share cd /tmp/$NAME/usr/local/share sudo mv man /tmp/$NAME-doc/usr/local/share/ sudo mv doc /tmp/$NAME-doc/usr/local/share/ sudo mv locale /tmp/$NAME-locale/usr/local/share/ sudo mkdir -p /tmp/$NAME/usr/local/etc/init.d sudo echo "#!/bin/sh # Cherokee files CHEROKEE_BIN=/usr/local/sbin/cherokee CHEROKEE_CONF=/usr/local/etc/cherokee/cherokee.conf PIDFILE=/var/run/cherokee.pid # Exit if we are not root if [ \`whoami\` != 'root' ]; then echo \"Run as root!\" 1>&2 exit 1 fi # If PIDFILE exists we use that PID, if doesn't we try to get the PID from ps|grep if [ -f \$PIDFILE ]; then pid=\`cat \$PIDFILE\` else pid=\`ps -ef|grep cherokee|egrep -vi 'grep|worker|init\\.d'|sed -e 's/^[ \t]*//'|cut -d\" \" -f1\` fi if [ ! -x \$CHEROKEE_BIN ]; then echo \"\$CHEROKEE_BIN: cannot execute\" exit 1 fi case \$1 in start) if [ -n \"\$pid\" ]; then echo \" - cherokee is already running...\" exit 1 fi if [ -r \$CHEROKEE_CONF ]; then echo -n \" - Starting cherokee... \" echo \"\" >/var/log/cherokee.startup \$CHEROKEE_BIN >>/var/log/cherokee.startup 2>>/var/log/cherokee.startup & sleep 1 else echo \"Cannot start cherokee -- \$CHEROKEE_CONF missing\" fi if [ \`ps|grep cherokee|egrep -vic 'grep|worker|init\\.d'\` -eq 0 ]; then echo \"Failed to start\" 1>&2 exit 1 else echo \"OK\" fi ;; stop) if [ -n \"\$pid\" ]; then echo -n \" - Stopping cherokee... \" kill -TERM \$pid 2>/dev/null sleep 1 kill -KILL \$pid 2>/dev/null sleep 0.5 if [ \`ps|grep cherokee|egrep -vic 'grep|worker|init\\.d'\` -eq 0 ]; then echo \"OK\" else echo \"Failed to stop\" 1>&2 exit 1 fi else echo \" - cherokee is not running...\" exit 1 fi ;; restart) \$0 stop \$0 start ;; reload) if [ -n \"\$pid\" ]; then echo \"Relolading cherokee configuration\" kill -HUP \$pid 2>/dev/null else echo \" - cherokee is not running...\" \$0 start fi ;; *) echo \"usage: \$0 {start|stop|restart|reload}\" exit 1 ;; esac exit 0" > /tmp/cherokee-init sudo chmod +x /tmp/cherokee-init sudo mv /tmp/cherokee-init /tmp/$NAME/usr/local/etc/init.d/cherokee sudo echo "#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (C) 2006 Edgewall Software # Copyright (C) 2006 Matthew Good # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms # are also available at http://trac.edgewall.org/wiki/TracLicense. # # This software consists of voluntary contributions made by many # individuals. For the exact contribution history, see the revision # history and logs, available at http://trac.edgewall.org/log/. # # Author: Matthew Good import errno import fileinput import sys from optparse import OptionParser from getpass import getpass # The md5 module is deprecated in Python 2.5 try: from hashlib import md5 except ImportError: from md5 import md5 def ask_pass(): pass1 = getpass('New password: ') pass2 = getpass('Re-type new password: ') if pass1 != pass2: print >>sys.stderr, \"They don't match, sorry\" sys.exit(1) return pass1 def get_digest(userprefix, password=None): if password == None: password = ask_pass() return make_digest(userprefix, password) def make_digest(userprefix, password): return userprefix + md5(userprefix + password).hexdigest() usage = \"%prog [-c] [-b] passwordfile realm username\" parser = OptionParser(usage=usage) parser.add_option('-c', action='store_true', dest='create', default=False, help='Create a new file') parser.add_option('-b', action='store_true', dest='batch', default=False, help='Batch mode, password on the commandline.') opts, args = parser.parse_args() try: if opts.batch: filename, realm, username, password = args else: filename, realm, username = args password = None except ValueError: parser.error('Wrong number of arguments') prefix = '%s:%s:' % (username, realm) if opts.create: try: f = open(filename, 'w') except EnvironmentError, e: if e.errno == errno.EACCES: print >>sys.stderr, 'Unable to update file', filename sys.exit(1) else: raise try: print >>f, get_digest(prefix, password) finally: f.close() else: try: matched = False for line in fileinput.input(filename, inplace=True): if line.startswith(prefix): if not matched: print get_digest(prefix, password) matched = True else: print line, if not matched: f = open(filename, 'a') try: print >>f, get_digest(prefix, password) finally: f.close() except EnvironmentError, e: if e.errno == errno.ENOENT: print >>sys.stderr, 'Could not open passwd file %s for reading.' \ % filename print >>sys.stderr, 'Use -c option to create a new one.' sys.exit(1) elif e.errno == errno.EACCES: print >>sys.stderr, 'Unable to update file', filename sys.exit(1) else: raise " > /tmp/htdigest.py sudo chmod +x /tmp/htdigest.py sudo mv /tmp/htdigest.py /tmp/$NAME/usr/local/sbin/htdigest.py echo "Creating package..." cd /tmp/ sudo mksquashfs $NAME $NAME.tcz sudo md5sum $NAME.tcz > $NAME.tcz.md5.txt cd $NAME sudo find usr -not -type d > ../$NAME.tcz.list cd /tmp/ SIZE="`du -k $NAME.tcz|cut -f1`k" sudo echo "Title: $NAME.tcz Description: Cherokee Web Server Version: $VERSION Author: Alvaro Lopez Ortega Original-site: http://www.cherokee-project.com/ Copying-policy: GPL Size: $SIZE Extension_by: andriscom Comments: Cherokee is a lighweight, very fast, flexible and easy to configure Web Server. Its performance is comparable to nginx, with less RAM utilized under high load. It supports: FastCGI, SCGI, PHP, CGI, SSI, TLS and SSL encrypted connections, Virtual hosts, Authentication, on the fly encoding, Load Balancing, Apache compatible log files, Data Base Balancing, Reverse HTTP Proxy, Traffic Shaper and others. An optional user friendly interface called cherokee-admin is provided for a no-hassle browser-based configuration of the server. The conf file can also be edited manually. Check out the benchmarks and documentation to learn more, and give it a try to squeeze your hardware to the fullest! This extension is PPI Compatible. Just add /usr/local/etc/cherokee/cherokee.conf into your /opt/.filetool.lst Built with CFLAGS: -march=i486 -mtune=i686 -Os -pipe Built with CXXFLAGS: -march=i486 -mtune=i686 -Os -pipe Built with LDFLAGS: -Wl,-O1 Built with the following options: ./configure $CONFIGURE There are some optional dependencies that are not included to keep Cherokee lightweight. These packages are requied to get the following functionality: PHP: php5.tcz Streaming: ffmpeg-ffserver.tcz, lib Cherokee-admin WebGUI: python.tcz htdigest.py: python.tcz Generate server certificate and key for Mod TLS: sudo openssl req -new -x509 -days 1460 -nodes -out /usr/local/etc/cherokee/cherokee.cert.pem -keyout /usr/local/etc/cherokee/cherokee.key.pem To create authorized user: (Digest) htdigest.py -c /usr/local/etc/cherokee.passwd \"Realm name\" username -b password To control Cherokee: sudo /usr/local/etc/init.d/cherokee [start|stop|reload|rotate-logs|restart|force-restart] Source: $SOURCE Change-log: 2009/10/16 Original version by evofx (0.99.24) 2010/11/06 Version: 1.0.8 2011/07/06 Version: 1.2.98 Current: $DATE Version: $VERSION - Updated init.d script " > $NAME.tcz.info sudo echo "pcre.tcz openssl-1.0.0.tcz " > $NAME.tcz.dep echo "Creating doc package..." cd /tmp/ sudo mksquashfs $NAME-doc $NAME-doc.tcz sudo md5sum $NAME-doc.tcz > $NAME-doc.tcz.md5.txt cd $NAME-doc sudo find usr -not -type d > ../$NAME-doc.tcz.list cd /tmp/ SIZE="`du -k $NAME-doc.tcz|cut -f1`k" sudo echo "Title: $NAME-doc.tcz Description: Cherokee man pages Version: $VERSION Author: Alvaro Lopez Ortega Original-site: http://www.cherokee-project.com/ Copying-policy: GPL Size: $SIZE Extension_by: andriscom Comments: Manual entry files and HTML documentation for Cherokee $VERSION. Source: $SOURCE Change-log: 2009/10/16 Original version by evofx (0.99.24) 2010/11/06 Version: 1.0.8 2011/07/06 Version: 1.2.98 Current: $DATE Version: $VERSION " > $NAME-doc.tcz.info sudo echo "cherokee.tcz " > $NAME-doc.tcz.dep echo "Creating locale package..." cd /tmp/ sudo mksquashfs $NAME-locale $NAME-locale.tcz sudo md5sum $NAME-locale.tcz > $NAME-locale.tcz.md5.txt cd $NAME-locale sudo find usr -not -type d > ../$NAME-locale.tcz.list cd /tmp/ SIZE="`du -k $NAME-locale.tcz|cut -f1`k" sudo echo "Title: $NAME-locale.tcz Description: Cherokee locale files Version: $VERSION Author: Alvaro Lopez Ortega Original-site: http://www.cherokee-project.com/ Copying-policy: GPL Size: $SIZE Extension_by: andriscom Comments: Locale files for Cherokee $VERSION. Source: $SOURCE Change-log: 2009/10/16 Original version by evofx (0.99.24) 2010/11/06 Version: 1.0.8 2011/07/06 Version: 1.2.98 Current: $DATE Version: $VERSION " > $NAME-locale.tcz.info sudo echo "cherokee.tcz " > $NAME-locale.tcz.dep cd /tmp/ mkdir packages 2>/dev/null sudo rm packages/$NAME.tar.gz 2>/dev/null tar zcf packages/$NAME.tar.gz $NAME.tcz* $NAME-doc.tcz* $NAME-locale.tcz* $SCRIPT_NAME echo " Run bcrypt on /tmp/packages/*.tar.gz... give password: tinycore" echo "Run the extension_audit.sh and reboot a clean system to try the packages!" echo "Send it to: tcesubmit@gmail.com"