updated cherokee for systemd

This commit is contained in:
Michael 2012-09-15 21:47:17 +00:00
parent 255b05e021
commit d38b5b24b7
7 changed files with 173 additions and 90 deletions

View File

@ -7,8 +7,8 @@
# include global config
pkgname=cherokee
pkgver=1.2.1
pkgrel=1
pkgver=1.2.101
pkgrel=5
pkgdesc="A very fast, flexible and easy to configure Web Server"
arch=('i686' 'x86_64')
url="http://www.cherokee-project.com/"
@ -23,50 +23,84 @@ optdepends=('python2: cherokee-admin (administrative web interface)'
'ffmpeg: Audio/Video streaming handler'
'geoip: GeoIP rule module'
'rrdtool: RRDtool based information collector')
categories=('network')
backup=('etc/cherokee/cherokee.conf'
'etc/logrotate.d/cherokee')
categories=('system')
source=(http://www.cherokee-project.com/download/1.2/$pkgver/cherokee-$pkgver.tar.gz
cherokee.rc
cherokee.logrotate)
options=('!libtool')
md5sums=('2204b9da5b910a8fe251f5dee4506155'
'a2d2b69c6220fab57cda4f531b680f9f'
'8d69341bd4002bffd69c6e82ff6c905f')
source=("http://www.cherokee-project.com/download/1.2/${pkgver}/${pkgname}-${pkgver}.tar.gz"
'cherokee.service'
'cherokee.logrotate'
'fix-ctk-path-handler-match.patch'
'gentoo-cherokee-1.2.98-linux3.patch'
'gentoo-cherokee-1.2.99-chakra-customized.patch'
'cherokee-1.2.101-ffmpeg0.11.patch')
sha256sums=('ca465ab3772479fc843b38ffc45113bf24d8bfae9185cdd5176b099d5a17feb8'
'a5ba46821799eaeea39c35f46ae51d58a8394f5e729889729f814562561d1edb'
'20e26d633f8c1cd90eb21f41dd163b73a83846e405b1ce995e072c4efefc522e'
'f682e9e6287e1db7d1843843143afa70b687f59807346aca9ddf19a35bacee45'
'cc03fa321bb01cd4a7026685ef2e3fc606fd53da056f629307c6e1904987ad1b'
'298a9394ca7c0e50c320bfc08f8674d23929272825cd3001c955fc560e62b662'
'6bcdcb8eaccb5516478a0c36960fbacc3d68f8bc326b9b526c388e0607a65116')
build() {
cd "$srcdir/$pkgname-$pkgver"
cd "${srcdir}/${pkgname}-${pkgver}"
# Fix path matching bug in CTK apps (e.g. market)
patch -Np1 -i "${srcdir}/fix-ctk-path-handler-match.patch"
# ffmpeg patch
patch -Np1 -i "${srcdir}/cherokee-1.2.101-ffmpeg0.11.patch"
# Apply Gentoo patches
patch -Np1 -i "${srcdir}/gentoo-cherokee-1.2.98-linux3.patch"
patch -Np1 -i "${srcdir}/gentoo-cherokee-1.2.99-chakra-customized.patch"
# Use subdirectory for logs
sed -i -r 's|(%localstatedir%/log)|\1/cherokee|' cherokee.conf.sample.pre
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var \
--with-wwwroot=/srv/http --disable-static \
--with-wwwuser=http --with-wwwgroup=http \
./configure --prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var \
--with-wwwroot=/srv/http \
--disable-static \
--with-wwwuser=http \
--with-wwwgroup=http \
--with-python=python2 \
--enable-os-string="Chakra Linux"
make
make -j1 DESTDIR="$pkgdir" install
}
package() {
cd "${srcdir}/${pkgname}-${pkgver}"
make -j1 DESTDIR="${pkgdir}" install
# PAM configuration file for cherokee
install -D -m644 pam.d_cherokee "$pkgdir/etc/pam.d/$pkgname"
install -D -m644 pam.d_cherokee "${pkgdir}/etc/pam.d/${pkgname}"
# Fix ownership of /var/lib/cherokee/graphs
chown -R http:http "$pkgdir/var/lib/$pkgname/graphs"
chown -R http:http "${pkgdir}/var/lib/${pkgname}/graphs"
# Point Python scripts to the python2 binary
sed -i 's/env python/env python2/' \
"$pkgdir/usr/share/cherokee/admin/"{server,upgrade_config}.py
# Use Python 2
sed -i 's/env python$/&2/' \
"${pkgdir}/usr/share/cherokee/admin/"{server,upgrade_config}.py \
"${pkgdir}/usr/bin/"{CTK-run,cherokee-{admin-launcher,tweak}}
sed -i -r "s/['\"]python/&2/g" \
"${pkgdir}/usr/share/cherokee/admin/wizards/django.py"
# Compile Python scripts
python2 -m compileall "$pkgdir"
python2 -O -m compileall "$pkgdir"
python2 -m compileall "${pkgdir}"
python2 -O -m compileall "${pkgdir}"
install -d -o http -g http "$pkgdir/var/log/$pkgname"
install -D "$srcdir/$pkgname.rc" "$pkgdir/etc/rc.d/$pkgname"
install -Dm644 "$srcdir/$pkgname.logrotate" "$pkgdir/etc/logrotate.d/$pkgname"
install -d -o http -g http "${pkgdir}/var/log/${pkgname}"
install -Dm644 "${srcdir}/${pkgname}.logrotate" "${pkgdir}/etc/logrotate.d/${pkgname}"
# install service file
install -Dm644 "${srcdir}/${pkgname}.service" "${pkgdir}/usr/lib/systemd/system/${pkgname}.service"
# Cleanup
rm -rf "$pkgdir/srv"
rm -rf "${pkgdir}/srv"
}
# vim:set ts=2 sw=2 et:

View File

@ -0,0 +1,14 @@
--- cherokee-1.2.101/cherokee/handler_streaming.c.ffmpeg 2012-06-04 12:56:16.000000000 +0800
+++ cherokee-1.2.101/cherokee/handler_streaming.c 2012-06-04 12:56:40.000000000 +0800
@@ -380,7 +380,7 @@
if (likely (secs > 0)) {
long tmp;
- tmp = (hdl->avformat->file_size / secs);
+ tmp = (avio_size(hdl->avformat) / secs);
if (tmp > rate) {
rate = tmp;
TRACE(ENTRIES, "New rate: %d bytes/s\n", rate);

View File

@ -1,65 +0,0 @@
#!/bin/bash
daemon_name=cherokee
. /etc/rc.conf
. /etc/rc.d/functions
case "$1" in
start)
stat_busy "Starting $daemon_name daemon"
if [ ! -f /var/run/$daemon_name.pid ] && $daemon_name -d &>/dev/null; then
add_daemon $daemon_name
stat_done
else
stat_fail
exit 1
fi
;;
stop)
stat_busy "Stopping $daemon_name daemon"
[ -f /var/run/$daemon_name.pid ] && read PID </var/run/$daemon_name.pid
if kill $PID &>/dev/null; then
rm_daemon $daemon_name
stat_done
else
stat_fail
exit 1
fi
;;
reload)
stat_busy "Reloading $daemon_name daemon"
[ -f /var/run/$daemon_name.pid ] && read PID </var/run/$daemon_name.pid
if kill -HUP $PID &>/dev/null; then
add_daemon $daemon_name
stat_done
else
stat_fail
exit 1
fi
;;
restart)
stat_busy "Restarting $daemon_name daemon"
[ -f /var/run/$daemon_name.pid ] && read PID </var/run/$daemon_name.pid
if kill -USR1 $PID &>/dev/null; then
add_daemon $daemon_name
stat_done
else
stat_fail
exit 1
fi
;;
status)
stat_busy "Checking $daemon_name status";
ck_status $daemon_name
;;
*)
echo "usage: $0 {start|stop|reload|restart|status}"
esac
exit 0

10
cherokee/cherokee.service Normal file
View File

@ -0,0 +1,10 @@
[Unit]
Description=Cherokee web server
After=syslog.target
[Service]
Type=forking
ExecStart=/usr/sbin/cherokee -d -C /etc/cherokee/cherokee.conf
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,16 @@
diff -upr cherokee-1.2.99.orig/admin/CTK/CTK/Server.py cherokee-1.2.99/admin/CTK/CTK/Server.py
--- cherokee-1.2.99.orig/admin/CTK/CTK/Server.py 2011-06-06 14:17:35.000000000 +0300
+++ cherokee-1.2.99/admin/CTK/CTK/Server.py 2011-09-16 03:31:06.000000000 +0300
@@ -121,8 +121,11 @@ class ServerHandler (pyscgi.SCGIHandler)
my_thread.scgi_conn = self
my_thread.request_url = url
+ # Drop the query string before matching against the handlers
+ path = url.split('?', 1)[0]
+
for published in server._web_paths:
- if re.match (published._regex, url):
+ if re.match (published._regex, path):
# POST
if published._method == 'POST':
post = self._process_post()

View File

@ -0,0 +1,45 @@
diff -Naur cherokee-1.2.98.orig/admin/SystemStats.py cherokee-1.2.98/admin/SystemStats.py
--- cherokee-1.2.98.orig/admin/SystemStats.py 2011-05-03 18:01:41.000000000 +0900
+++ cherokee-1.2.98/admin/SystemStats.py 2011-08-26 13:05:08.128851462 +0900
@@ -39,7 +39,7 @@
global _stats
if not _stats:
- if sys.platform == 'linux2':
+ if sys.platform == 'linux2' or sys.platform == 'linux3':
_stats = System_stats__Linux()
elif sys.platform == 'darwin':
_stats = System_stats__Darwin()
diff -Naur cherokee-1.2.98.orig/admin/market/InstallUtil.py cherokee-1.2.98/admin/market/InstallUtil.py
--- cherokee-1.2.98.orig/admin/market/InstallUtil.py 2011-05-03 18:01:41.000000000 +0900
+++ cherokee-1.2.98/admin/market/InstallUtil.py 2011-08-26 13:05:06.596844132 +0900
@@ -56,7 +56,7 @@
first_group = str(root_group)
# Systems
- if sys.platform == 'linux2':
+ if sys.platform == 'linux2' or sys.platform == 'linux3':
if os.getuid() == 0:
return root_group
return first_group
@@ -72,7 +72,7 @@
def current_UID_is_admin():
- if sys.platform == 'linux2':
+ if sys.platform == 'linux2' or sys.platform == 'linux3':
return os.getuid() == 0
elif sys.platform == 'darwin':
return os.getuid() == 0
diff -Naur cherokee-1.2.98.orig/admin/util.py cherokee-1.2.98/admin/util.py
--- cherokee-1.2.98.orig/admin/util.py 2011-03-31 17:30:04.000000000 +0900
+++ cherokee-1.2.98/admin/util.py 2011-08-26 13:05:04.622834682 +0900
@@ -341,7 +341,7 @@
def os_get_document_root():
if sys.platform == 'darwin':
return "/Library/WebServer/Documents"
- elif sys.platform == 'linux2':
+ elif sys.platform == 'linux2' or sys.platform == 'linux3':
if os.path.exists ("/etc/redhat-release"):
return '/var/www'
elif os.path.exists ("/etc/fedora-release"):

View File

@ -0,0 +1,29 @@
diff -Naur a/admin/configured.py.pre b/admin/configured.py.pre
--- a/admin/configured.py.pre 2012-01-20 00:58:20.098021174 +0000
+++ b/admin/configured.py.pre 2012-01-20 00:58:33.997967915 +0000
@@ -22,7 +22,7 @@
CHEROKEE_DATADIR = join (DATADIR, "cherokee")
CHEROKEE_DEPSDIR = join (DATADIR, "cherokee/deps")
CHEROKEE_CONFDIR = join (SYSCONFDIR, "cherokee")
-CHEROKEE_VAR_LOG = join (LOCALSTATE, "log")
+CHEROKEE_VAR_LOG = join (LOCALSTATE, "log/cherokee")
CHEROKEE_VAR_RUN = join (LOCALSTATE, "run")
CHEROKEE_VAR_LIB = join (LOCALSTATE, "lib/cherokee")
CHEROKEE_RRD_DIR = join (LOCALSTATE, "lib/cherokee/graphs")
diff -Naur a/cherokee.conf.sample.pre b/cherokee.conf.sample.pre
--- a/cherokee.conf.sample.pre 2012-01-20 00:58:20.064687465 +0000
+++ b/cherokee.conf.sample.pre 2012-01-20 00:58:45.677878184 +0000
@@ -27,11 +27,11 @@
vserver!1!logger = combined
vserver!1!logger!access!type = file
-vserver!1!logger!access!filename = %localstatedir%/log/cherokee.access
+vserver!1!logger!access!filename = %localstatedir%/log/cherokee/cherokee.access
vserver!1!logger!access!buffsize = 16384
vserver!1!error_writer!type = file
-vserver!1!error_writer!filename = %localstatedir%/log/cherokee.error
+vserver!1!error_writer!filename = %localstatedir%/log/cherokee/cherokee.error
vserver!1!rule!1!match = default
vserver!1!rule!1!handler = common