Subject: [alpine-aports] [PATCH v2] testing/litespeed: new aport

From: Valery Kartel <[email-masked]>
Date: Mon, 20 Feb 2017 23:16:34 +0200

High-performance, lightweight, open source HTTP server with web-gui
https://open.litespeedtech.com/

---
v1 -> v2:
switch to php7 backend as default, because php5 litespeed sapi
is not implemented yet.

remove -php* backend submodules
remove -doc submodule
---
 testing/litespeed/APKBUILD              | 136 ++++++++++++++++++++
 testing/litespeed/config.patch          |  41 ++++++
 testing/litespeed/fix_php.patch         |  52 ++++++++
 testing/litespeed/include.patch         |  20 +++
 testing/litespeed/install.patch         | 213 ++++++++++++++++++++++++++++++++
 testing/litespeed/litespeed.initd       |  33 +++++
 testing/litespeed/litespeed.pre-install |   6 +
 testing/litespeed/ls_lock.patch         |  33 +++++
 testing/litespeed/thread.patch          |  37 ++++++
 9 files changed, 571 insertions(+)
 create mode 100644 testing/litespeed/APKBUILD
 create mode 100644 testing/litespeed/config.patch
 create mode 100644 testing/litespeed/fix_php.patch
 create mode 100644 testing/litespeed/include.patch
 create mode 100644 testing/litespeed/install.patch
 create mode 100644 testing/litespeed/litespeed.initd
 create mode 100644 testing/litespeed/litespeed.pre-install
 create mode 100644 testing/litespeed/ls_lock.patch
 create mode 100644 testing/litespeed/thread.patch

diff --git a/testing/litespeed/APKBUILD b/testing/litespeed/APKBUILD
new file mode 100644
index 0000000000..ddaf72607a
--- /dev/null
+++ b/testing/litespeed/APKBUILD
@@ -0,0 +1,136 @@
+# Contributor: Valery Kartel <[email-masked]>
+# Maintainer: Valery Kartel <[email-masked]>
+pkgname=litespeed
+pkgver=1.4.24
+pkgrel=0
+_pkgreal=open$pkgname
+_pkghome=var/lib/$pkgname
+pkgdesc="High-performance, lightweight, open source HTTP server"
+url="https://open.litespeedtech.com"
+arch="all"
+license="GPL3"
+pkgusers=litespeed
+pkggroups=litespeed
+depends="php7-$pkgname php7-session"
+depends_dev=
+makedepends="linux-headers libressl-dev geoip-dev expat-dev pcre-dev zlib-dev"
+install="$pkgname.pre-install"
+subpackages="$pkgname-snmp::noarch"
+source="http://open.litespeedtech.com/packages/$_pkgreal-$pkgver.tgz
+	$pkgname.initd
+	include.patch
+	install.patch
+	ls_lock.patch
+	fix_php.patch
+	thread.patch
+	config.patch
+	"
+builddir="$srcdir/$_pkgreal-$pkgver"
+
+build() {
+	cd "$builddir"
+	./configure \
+		--host=$CHOST \
+		--build=$CBUILD \
+		--prefix=/$_pkghome \
+		--with-user=$pkgusers \
+		--with-group=$pkggroups \
+		--enable-adminssl=no \
+		--disable-rpath \
+		--disable-static \
+		--with-openssl=/usr \
+		--with-expat \
+		--with-pcre \
+		--with-zlib \
+		|| return 1
+	make || return 1
+}
+
+package() {
+	local file;
+	cd "$builddir"
+	make DESTDIR="$pkgdir" install || return 1
+
+	mkdir -p "$pkgdir"/usr/lib/$pkgname \
+		"$pkgdir"/usr/sbin \
+		"$pkgdir"/var/log || return 1
+
+	# remove trash
+	rm -fr "$pkgdir"/$_pkghome/php* \
+		"$pkgdir"/$_pkghome/lib \
+		"$pkgdir"/$_pkghome/GPL* \
+		"$pkgdir"/$_pkghome/gdata \
+		"$pkgdir"/$_pkghome/autoupdate \
+		"$pkgdir"/$_pkghome/fcgi-bin/* \
+		"$pkgdir"/$_pkghome/bin/lshttpd \
+		"$pkgdir"/$_pkghome/admin/conf/php.* \
+		"$pkgdir"/$_pkghome/admin/misc/gdb-bt \
+		"$pkgdir"/$_pkghome/admin/misc/convertxml.* \
+		"$pkgdir"/$_pkghome/admin/misc/build_admin_php.sh \
+		|| return 1
+
+	# fix ownership
+	chown -R $pkgusers:$pkggroups \
+		"$pkgdir"/$_pkghome/tmp \
+		"$pkgdir"/$_pkghome/conf \
+		"$pkgdir"/$_pkghome/logs \
+		"$pkgdir"/$_pkghome/backup \
+		"$pkgdir"/$_pkghome/cachedata \
+		"$pkgdir"/$_pkghome/admin/tmp \
+		"$pkgdir"/$_pkghome/admin/logs \
+		"$pkgdir"/$_pkghome/Example/logs || return 1
+
+	# install configs
+	install -Dm755 "$srcdir"/$pkgname.initd \
+		"$pkgdir"/etc/init.d/$pkgname || return 1
+	mv "$pkgdir"/$_pkghome/conf \
+		"$pkgdir"/etc/$pkgname || return 1
+	mv "$pkgdir"/$_pkghome/admin/conf \
+		"$pkgdir"/etc/$pkgname/admin || return 1
+	ln -s /etc/$pkgname "$pkgdir"/$_pkghome/conf || return 1
+	ln -s /etc/$pkgname/admin "$pkgdir"/$_pkghome/admin/conf || return 1
+	find "$pkgdir"/etc/$pkgname -type f -print0 | xargs -0 chmod -x || return 1
+
+	# install binary
+	mv "$pkgdir"/$_pkghome/bin/$_pkgreal \
+		"$pkgdir"/usr/sbin/lshttpd || return 1
+	ln -sf /usr/sbin/lshttpd \
+		"$pkgdir"/$_pkghome/bin/$pkgname || return 1
+
+	# install modules
+	for file in $(find "$pkgdir"/$_pkghome/modules -name "*.so"); do
+		mv $file "$pkgdir"/usr/lib/$pkgname/${file##*/} || return 1
+		ln -s /usr/lib/$pkgname/${file##*/} $file || return 1
+	done
+
+	# install logs
+	mv "$pkgdir"/$_pkghome/logs "$pkgdir"/var/log/$pkgname || return 1
+	mv "$pkgdir"/$_pkghome/admin/logs "$pkgdir"/var/log/$pkgname/admin || return 1
+	mv "$pkgdir"/$_pkghome/Example/logs "$pkgdir"/var/log/$pkgname/Example || return 1
+	ln -s /var/log/$pkgname "$pkgdir"/$_pkghome/logs || return 1
+	ln -s /var/log/$pkgname/admin "$pkgdir"/$_pkghome/admin/logs || return 1
+	ln -s /var/log/$pkgname/Example "$pkgdir"/$_pkghome/Example/logs || return 1
+
+	# install backend
+	ln -s /usr/bin/lsphp7 "$pkgdir"/$_pkghome/fcgi-bin/lsphp7 || return 1
+	ln -s /etc/php7/php.ini "$pkgdir"/etc/$pkgname/php.ini || return 1
+	ln -s /etc/php7/php.ini "$pkgdir"/etc/$pkgname/admin/php.ini || return 1
+}
+
+snmp() {
+	pkgdesc="$pkgdesc (snmp monitoring add-on + cacti templates)"
+	depends="$pkgname net-snmp"
+
+	mkdir -p "$subpkgdir"/$_pkghome/add-ons || return 1
+	mv "$pkgdir"/$_pkghome/add-ons/snmp_monitoring \
+		"$subpkgdir"/$_pkghome/add-ons
+}
+
+sha512sums="5f8434d2fef3b8c8b2dcdbfdefdd989edbf9cd08b14f41ac9e2bf18d959b9baf8585ceb94f0fd4fc284fd59378c31e451c6d6c144c3ad2f5cbab33abe73a26fc  openlitespeed-1.4.24.tgz
+2b0299246aaeb885122d8f939437f0e4701f6a79ea976f725ba8765d8b295c2797c0cac30e639d5eda665b9589710ee55acc4d03b078c4b9cc1e564994ccb9f5  litespeed.initd
+9dc0679aa27aa0efefe2ded2776a1269e4e565b5c49d074c40c2121bf5f1cbb8dfe286b97507ea9bdac539bdbb4960fe409ae7d1ed883085c44b592581f4931d  include.patch
+ead0ba0fabfb7d76a087f202d134bf86d909898e5d96e1330716c9288f21386d8b72f9caed34c095994a7ea328d7f8c9ae6d9e51a24e89b209099401ce09f2c5  install.patch
+2211e6c787700fc08eaee56f049c80690ef53d2b14cfcf17099ed0e5dfbd28b76a7b30f0c8814901e3c72bd4fc63732196b6fa0a8231cc10f86ba5130810b3d6  ls_lock.patch
+79e7361805fc94c5edbb2f4fa3b06bf5166015a1b04fd475930c133454e76d599c4c3255750e184a2cd000a16df49ea1199546fe5e38372d8be928704d0c8167  fix_php.patch
+c7775836ee13b082e5c2ce011673b1a30b5ca83765d6d81ff1359110ba970808de6a87cd6d61fd688c9d2037451598154b429d70ad25094b9e9f10938aea00fd  thread.patch
+4566abaf19a8713c7199475d0f5d9c7dd61f9ae330acd02baf4096dddd8833dcb3a746f63ce19658afc9f3c4990663c736947dd90842eee542fd266ef1f30e7c  config.patch"
diff --git a/testing/litespeed/config.patch b/testing/litespeed/config.patch
new file mode 100644
index 0000000000..427b055ab9
--- /dev/null
+++ b/testing/litespeed/config.patch
@@ -0,0 +1,41 @@
+--- a/dist/conf/httpd_config.conf.in
++++ b/dist/conf/httpd_config.conf.in
+@@ -20,7 +20,7 @@
+ indexFiles                       index.html, index.php
+ 
+ errorlog $SERVER_ROOT/logs/error.log {
+-        logLevel             DEBUG
++        logLevel             INFO
+         debugLevel           0
+         rollingSize          10M
+         enableStderrLog      1
+@@ -115,9 +115,9 @@
+ 	deny
+ }
+  
+-extProcessor lsphp5{
++extProcessor lsphp7{
+     type                            lsapi 
+-    address                         uds://tmp/lshttpd/lsphp.sock 
++    address                         uds://tmp/lshttpd/lsphp7.sock 
+     maxConns                        35 
+     env                             PHP_LSAPI_MAX_REQUESTS=500 
+     env                             PHP_LSAPI_CHILDREN=35 
+@@ -127,7 +127,7 @@
+     pcKeepAliveTimeout
+     respBuffer                      0 
+     autoStart                       1 
+-    path                            $SERVER_ROOT/fcgi-bin/lsphp5 
++    path                            $SERVER_ROOT/fcgi-bin/lsphp7 
+     backlog                         100 
+     instances                       1 
+     priority                        0 
+@@ -138,7 +138,7 @@
+ }
+ 
+ scriptHandler{
+-    add lsapi:lsphp5  php
++    add lsapi:lsphp7  php
+ }
+ 
+ railsDefaults{
diff --git a/testing/litespeed/fix_php.patch b/testing/litespeed/fix_php.patch
new file mode 100644
index 0000000000..792c7b7f69
--- /dev/null
+++ b/testing/litespeed/fix_php.patch
@@ -0,0 +1,52 @@
+--- a/dist/add-ons/snmp_monitoring/class.litespeed_snmp_bridge.php
++++ b/dist/add-ons/snmp_monitoring/class.litespeed_snmp_bridge.php
+@@ -1,4 +1,4 @@
+-<?
++<?php
+ 
+ /*----------------------------------------
+ LiteSpeed_Stats to SNMP bridge. Relay stats to SNMPD.
+--- a/dist/add-ons/snmp_monitoring/class.litespeed_stats.php
++++ b/dist/add-ons/snmp_monitoring/class.litespeed_stats.php
+@@ -1,4 +1,4 @@
+-<?
++<?php
+ 
+ /*----------------------------------------
+ LiteSpeed_Stats class and subclasses. Parse Real-Time data for LiteSpeed Products
+--- a/dist/add-ons/snmp_monitoring/sample.php
++++ b/dist/add-ons/snmp_monitoring/sample.php
+@@ -1,4 +1,4 @@
+-<?
++<?php
+ 
+ /*--------------------------------
+ assuming  following entry in /etc/snmp/snmpd.conf
+--- a/dist/admin/html.open/login.php
++++ b/dist/admin/html.open/login.php
+@@ -1,4 +1,4 @@
+-<?
++<?php
+ 
+ require_once('view/inc/global.php');
+ 
+@@ -31,7 +31,9 @@
+ });
+ </script>
+ 
+-<? } ?>
++<?php
++}
++?>
+ 
+ <div class="container">
+ <div style="margin-top:50px"></div>
+@@ -40,7 +42,7 @@
+ 							<form action="login.php"  id="login" method="post" class="smart-form client-form" novalidate="novalidate">
+ 								<header><div class="text-center"><img src="/res/img/product_logo.gif" alt="LiteSpeed"></div></header>
+ 								<fieldset>
+-								<?
++								<?php
+ if ($msg != '') {
+ 	echo "<section><div class=\"note\">$msg</div></section>";
+ }
diff --git a/testing/litespeed/include.patch b/testing/litespeed/include.patch
new file mode 100644
index 0000000000..49938c2e1e
--- /dev/null
+++ b/testing/litespeed/include.patch
@@ -0,0 +1,20 @@
+--- a/src/util/pcutil.cpp
++++ b/src/util/pcutil.cpp
+@@ -21,6 +21,7 @@
+ #include <ctype.h>
+ #include <stdlib.h>
+ #include <unistd.h>
++#include <string.h>
+ 
+ #ifdef __linux
+ #include <sched.h>
+--- a/src/main/lshttpdmain.cpp
++++ b/src/main/lshttpdmain.cpp
+@@ -45,7 +45,6 @@
+ #include <util/stringlist.h>
+ #include <util/signalutil.h>
+ #include <util/vmembuf.h>
+-#include <sys/sysctl.h>
+ 
+ #include <extensions/cgi/cgidworker.h>
+ #include <extensions/registry/extappregistry.h>
diff --git a/testing/litespeed/install.patch b/testing/litespeed/install.patch
new file mode 100644
index 0000000000..5b41b2eea5
--- /dev/null
+++ b/testing/litespeed/install.patch
@@ -0,0 +1,213 @@
+--- a/configure
++++ b/configure
+@@ -15863,7 +15863,7 @@
+ 
+ 
+ if test "$OPENLSWS_BSSL" = no ; then
+-    if test "$OSNAME" = Darwin ; then
++    if test "$OSNAME" = Linux ; then
+         usedynossl=yes
+         CPPFLAGS="$CPPFLAGS -I../../src -I../../include -I/usr/local/include -I/usr/local -I/usr -I/usr/pkg "
+     else
+@@ -16131,7 +16131,7 @@
+ 
+ 
+ 
+-if test "$OSNAME" = Darwin ; then
++if test "$OSNAME" = Linux ; then
+ 
+ 
+ # Check whether --with-openssl was given.
+--- a/dist/install.sh
++++ b/dist/install.sh
+@@ -35,11 +35,7 @@
+     fi
+         
+     if [ "x$OS" = "xLinux" ] ; then
+-        if [ "x$OSTYPE" != "xx86_64" ] ; then
+-            $DLCMD $LSWS_HOME/admin/fcgi-bin/admin_php http://www.litespeedtech.com/packages/lsphp5_bin/i386/lsphp5
+-        else
+-            $DLCMD $LSWS_HOME/admin/fcgi-bin/admin_php http://www.litespeedtech.com/packages/lsphp5_bin/x86_64/lsphp5
+-        fi
++        ln -s /usr/bin/lsphp7 $LSWS_HOME/admin/fcgi-bin/admin_php
+         
+         if [ $? = 0 ] ; then 
+             HASADMINPHP=y
+--- a/dist/functions.sh
++++ b/dist/functions.sh
+@@ -375,7 +375,7 @@
+ 
+ 	if [ $INST_USER = "root" ]; then
+ 		if [ $SUCC -eq "1" ]; then
+-			chown -R "$DIR_OWN" "$LSWS_HOME"
++			: #chown -R "$DIR_OWN" "$LSWS_HOME"
+ 		fi
+ 	fi
+ }
+@@ -626,7 +626,7 @@
+ 	  if [ ! -d "$LSWS_HOME/$arg" ]; then
+ 		  mkdir "$LSWS_HOME/$arg"
+ 	  fi
+-	  chown "$OWNER" "$LSWS_HOME/$arg"
++	  #chown "$OWNER" "$LSWS_HOME/$arg"
+ 	  chmod $PERM  "$LSWS_HOME/$arg"
+ 	done
+ 	
+@@ -643,7 +643,7 @@
+ 	  do
+ 	  if [ -f "$LSINSTALL_DIR/$arg" ]; then 
+ 	    cp -f "$LSINSTALL_DIR/$arg" "$LSWS_HOME/$arg"
+-	    chown "$OWNER" "$LSWS_HOME/$arg"
++	    #chown "$OWNER" "$LSWS_HOME/$arg"
+ 	    chmod $PERM  "$LSWS_HOME/$arg"
+ 	  fi
+ 	done
+@@ -662,7 +662,7 @@
+ 	    cp "$LSINSTALL_DIR/$arg" "$LSWS_HOME/$arg"
+ 	  fi
+ 	  if [ -f "$LSWS_HOME/$arg" ]; then
+-        chown "$OWNER" "$LSWS_HOME/$arg"
++        #chown "$OWNER" "$LSWS_HOME/$arg"
+         chmod $PERM  "$LSWS_HOME/$arg"
+       fi
+ 	done
+@@ -678,7 +678,7 @@
+ 	for arg
+ 	  do
+ 	  cp -R "$LSINSTALL_DIR/$arg/"* "$LSWS_HOME/$arg/"
+-	  chown -R "$OWNER" "$LSWS_HOME/$arg/"*
++	  #chown -R "$OWNER" "$LSWS_HOME/$arg/"*
+       #chmod -R $PERM  $LSWS_HOME/$arg/*
+ 	done
+ }
+@@ -696,7 +696,7 @@
+ 	for arg
+ 	  do
+ 	  cp -R "$LSINSTALL_DIR/$arg/"* "$LSWS_HOME/$arg.$VERSION/"
+-	  chown -R "$OWNER" "$LSWS_HOME/$arg.$VERSION"
++	  #chown -R "$OWNER" "$LSWS_HOME/$arg.$VERSION"
+       $TEST_BIN -L "$LSWS_HOME/$arg"
+       if [ $? -eq 0 ]; then
+ 		  rm -f "$LSWS_HOME/$arg"
+@@ -718,7 +718,7 @@
+ 	for arg
+ 	  do
+ 	  cp -f "$LSINSTALL_DIR/$arg" "$LSWS_HOME/$arg.$VERSION"
+-	  chown "$OWNER" "$LSWS_HOME/$arg.$VERSION"
++	  #chown "$OWNER" "$LSWS_HOME/$arg.$VERSION"
+ 	  chmod $PERM  "$LSWS_HOME/$arg.$VERSION"
+       $TEST_BIN -L "$LSWS_HOME/$arg"
+       if [ $? -eq 0 ]; then
+@@ -735,11 +735,11 @@
+     umask 022
+ 	if [ $INST_USER = "root" ]; then
+ 		SDIR_OWN="root:$ROOTGROUP"
+-        chown $SDIR_OWN $LSWS_HOME
++        #chown $SDIR_OWN $LSWS_HOME
+ 	else
+ 		SDIR_OWN=$DIR_OWN
+ 	fi
+-	sed "s:%LSWS_CTRL%:$LSWS_HOME/bin/lswsctrl:" "$LSINSTALL_DIR/admin/misc/lsws.rc.in" > "$LSINSTALL_DIR/admin/misc/lsws.rc"
++	#sed "s:%LSWS_CTRL%:$LSWS_HOME/bin/lswsctrl:" "$LSINSTALL_DIR/admin/misc/lsws.rc.in" > "$LSINSTALL_DIR/admin/misc/lsws.rc"
+ 
+ 	OWNER=$1
+ 	PERM=$2
+@@ -750,7 +750,7 @@
+ 	  if [ ! -f "$LSWS_HOME/$arg" ]; then
+ 		  cp "$LSINSTALL_DIR/$arg" "$LSWS_HOME/$arg"
+ 	  fi
+-	  chown "$OWNER" "$LSWS_HOME/$arg"
++	  #chown "$OWNER" "$LSWS_HOME/$arg"
+ 	  chmod $PERM  "$LSWS_HOME/$arg"
+ 	done
+ }
+@@ -765,7 +765,7 @@
+ 	for arg
+ 	  do
+ 	  cp -R "$LSINSTALL_DIR/$arg/"* "$LSWS_HOME/$arg/"
+-	  chown -R "$OWNER" "$LSWS_HOME/$arg/"*
++	  #chown -R "$OWNER" "$LSWS_HOME/$arg/"*
+       #chmod -R $PERM  $LSWS_HOME/$arg/*
+ 	done
+ }
+@@ -784,7 +784,7 @@
+ 	  do
+       if [ -d "$LSINSTALL_DIR/$arg" ]; then
+         cp -R "$LSINSTALL_DIR/$arg/"* "$LSWS_HOME/$arg.$VERSION/"
+-        chown -R "$OWNER" "$LSWS_HOME/$arg.$VERSION"
++        #chown -R "$OWNER" "$LSWS_HOME/$arg.$VERSION"
+         $TEST_BIN -L "$LSWS_HOME/$arg"
+         if [ $? -eq 0 ]; then
+ 		  rm -f "$LSWS_HOME/$arg"
+@@ -809,7 +809,7 @@
+ 	  if [ -f "$LSINSTALL_DIR/$arg" ]; then
+ 	  
+         cp -f "$LSINSTALL_DIR/$arg" "$LSWS_HOME/$arg.$VERSION"
+-        chown "$OWNER" "$LSWS_HOME/$arg.$VERSION"
++        #chown "$OWNER" "$LSWS_HOME/$arg.$VERSION"
+         chmod $PERM  "$LSWS_HOME/$arg.$VERSION"
+         $TEST_BIN -L "$LSWS_HOME/$arg"
+         if [ $? -eq 0 ]; then
+@@ -841,11 +841,11 @@
+ 
+ create_lsadm()
+ {
+-    groupadd lsadm 
++    #groupadd lsadm 
+     #1>/dev/null 2>&1
+     lsadm_gid=`grep "^lsadm:" /etc/group | awk -F : '{ print $3; }'`
+-    useradd -g $lsadm_gid -d / -r -s /sbin/nologin lsadm 
+-    usermod -a -G $WS_GROUP lsadm
++    #useradd -g $lsadm_gid -d / -r -s /sbin/nologin lsadm 
++    #usermod -a -G $WS_GROUP lsadm
+     #1>/dev/null 2>&1
+     
+ }
+@@ -880,12 +880,12 @@
+             CONF_OWN="lsadm:lsadm"
+         fi
+ 		SDIR_OWN="root:$ROOTGROUP"
+-        chown $SDIR_OWN $LSWS_HOME
++        #chown $SDIR_OWN $LSWS_HOME
+ 	else
+ 		SDIR_OWN=$DIR_OWN
+ 	fi
+-	sed "s:%LSWS_CTRL%:$LSWS_HOME/bin/lswsctrl:" "$LSINSTALL_DIR/admin/misc/lsws.rc.in" > "$LSINSTALL_DIR/admin/misc/lsws.rc"
+-	sed "s:%LSWS_CTRL%:$LSWS_HOME/bin/lswsctrl:" "$LSINSTALL_DIR/admin/misc/lsws.rc.gentoo.in" > "$LSINSTALL_DIR/admin/misc/lsws.rc.gentoo"
++	#sed "s:%LSWS_CTRL%:$LSWS_HOME/bin/lswsctrl:" "$LSINSTALL_DIR/admin/misc/lsws.rc.in" > "$LSINSTALL_DIR/admin/misc/lsws.rc"
++	#sed "s:%LSWS_CTRL%:$LSWS_HOME/bin/lswsctrl:" "$LSINSTALL_DIR/admin/misc/lsws.rc.gentoo.in" > "$LSINSTALL_DIR/admin/misc/lsws.rc.gentoo"
+     if [ -d "$LSWS_HOME/admin/html.$VERSION" ]; then
+         rm -rf "$LSWS_HOME/admin/html.$VERSION"
+     fi
+@@ -894,10 +894,10 @@
+     util_mkdir "$CONF_OWN" $SDIR_MOD conf conf/cert conf/templates conf/vhosts conf/vhosts/Example admin/conf admin/tmp phpbuild
+     util_mkdir "$SDIR_OWN" $SDIR_MOD admin/cgid admin/cgid/secret
+     util_mkdir "$DIR_OWN" $SDIR_MOD tmp/ocspcache
+-    chgrp  $WS_GROUP $LSWS_HOME/admin/tmp $LSWS_HOME/admin/cgid
++    #chgrp  $WS_GROUP $LSWS_HOME/admin/tmp $LSWS_HOME/admin/cgid
+     chmod  g+x $LSWS_HOME/admin/tmp $LSWS_HOME/admin/cgid 
+-    chown  $CONF_OWN $LSWS_HOME/admin/tmp/sess_* 1>/dev/null 2>&1
+-    chown  $DIR_OWN $LSWS_HOME/cachedata
++    #chown  $CONF_OWN $LSWS_HOME/admin/tmp/sess_* 1>/dev/null 2>&1
++    #chown  $DIR_OWN $LSWS_HOME/cachedata
+     util_mkdir "$SDIR_OWN" $DIR_MOD Example 
+ 
+     find "$LSWS_HOME/admin/tmp" -type s -atime +1 -delete 2>/dev/null
+@@ -919,7 +919,7 @@
+     
+     util_ccpfile "$SDIR_OWN" $EXEC_MOD fcgi-bin/lsperld.fpl fcgi-bin/RackRunner.rb
+     util_cpfile "$SDIR_OWN" $EXEC_MOD  fcgi-bin/RailsRunner.rb  fcgi-bin/RailsRunner.rb.2.3
+-	util_cpfile "$SDIR_OWN" $EXEC_MOD admin/misc/rc-inst.sh admin/misc/admpass.sh admin/misc/rc-uninst.sh admin/misc/uninstall.sh admin/misc/lsws.rc admin/misc/lsws.rc.gentoo admin/misc/enable_phpa.sh admin/misc/mgr_ver.sh admin/misc/gzipStatic.sh admin/misc/fp_install.sh admin/misc/create_admin_keypair.sh admin/misc/awstats_install.sh admin/misc/update.sh admin/misc/cleancache.sh admin/misc/lsup.sh
++	#util_cpfile "$SDIR_OWN" $EXEC_MOD admin/misc/rc-inst.sh admin/misc/admpass.sh admin/misc/rc-uninst.sh admin/misc/uninstall.sh admin/misc/lsws.rc admin/misc/lsws.rc.gentoo admin/misc/enable_phpa.sh admin/misc/mgr_ver.sh admin/misc/gzipStatic.sh admin/misc/fp_install.sh admin/misc/create_admin_keypair.sh admin/misc/awstats_install.sh admin/misc/update.sh admin/misc/cleancache.sh admin/misc/lsup.sh
+     util_cpfile "$SDIR_OWN" $EXEC_MOD admin/misc/ap_lsws.sh.in admin/misc/build_ap_wrapper.sh admin/misc/cpanel_restart_httpd.in admin/misc/build_admin_php.sh admin/misc/convertxml.sh
+ 	util_cpfile "$SDIR_OWN" $DOC_MOD admin/misc/gdb-bt admin/misc/htpasswd.php admin/misc/php.ini admin/misc/genjCryptionKeyPair.php admin/misc/purge_cache_byurl.php
+     util_cpfile "$SDIR_OWN" $DOC_MOD admin/misc/convertxml.php
+@@ -971,7 +971,7 @@
+ 		util_cpdir "$SDIR_OWN" $DOC_MOD Example/html Example/cgi-bin
+ 	fi
+ 
+-    chown -R "$CONF_OWN" "$LSWS_HOME/conf/"
++    #chown -R "$CONF_OWN" "$LSWS_HOME/conf/"
+     chmod -R 0755 "$LSWS_HOME/conf/"
+     chmod 0600 "$LSWS_HOME/conf/httpd_config.conf"
+     chmod 0600 "$LSWS_HOME/conf/vhosts/Example/vhconf.conf"
diff --git a/testing/litespeed/litespeed.initd b/testing/litespeed/litespeed.initd
new file mode 100644
index 0000000000..ee3cf42ecd
--- /dev/null
+++ b/testing/litespeed/litespeed.initd
@@ -0,0 +1,33 @@
+#!/sbin/openrc-run
+
+description="LiteSpeed Web Server"
+
+lshome=/var/lib/litespeed
+
+command=$lshome/bin/lswsctrl
+cfgfile=$lshome/conf/httpd_config.conf
+pidfile=/tmp/lshttpd/lshttpd.pid
+required_files="$cfgfile"
+
+depend() {
+	need net
+	use dns netmount
+}
+
+start() {
+	ebegin "Starting $RC_SVCNAME"
+	$command start >/dev/null
+	eend $?
+}
+
+stop() {
+	ebegin "Stopping $RC_SVCNAME"
+	$command stop >/dev/null
+	eend $?
+}
+
+restart() {
+	ebegin "Restarting $RC_SVCNAME"
+	$command restart >/dev/null
+	eend $?
+}
diff --git a/testing/litespeed/litespeed.pre-install b/testing/litespeed/litespeed.pre-install
new file mode 100644
index 0000000000..eed557467b
--- /dev/null
+++ b/testing/litespeed/litespeed.pre-install
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+addgroup -S litespeed 2>/dev/null
+adduser -S -D -H -h /var/lib/litespeed -s /sbin/nologin -G litespeed -g litespeed litespeed 2>/dev/null
+
+exit 0
diff --git a/testing/litespeed/ls_lock.patch b/testing/litespeed/ls_lock.patch
new file mode 100644
index 0000000000..a41b14cbb9
--- /dev/null
+++ b/testing/litespeed/ls_lock.patch
@@ -0,0 +1,33 @@
+--- a/include/lsr/ls_lock.h
++++ b/include/lsr/ls_lock.h
+@@ -52,16 +52,9 @@
+ extern "C" {
+ #endif
+ 
+-#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__gnu_linux__) \
+-    || defined(__FreeBSD__ ) || defined(__NetBSD__) || defined(__OpenBSD__)
+-#define USE_F_MUTEX
+-#define USE_MUTEX_ADAPTIVE
+-
+-#else
+ #undef USE_F_MUTEX
+ #define USE_MUTEX_LOCK
+ 
+-#endif
+ #define USE_ATOMIC_SPIN
+ 
+ #define MAX_FUTEX_SPINCNT      10
+--- a/src/lsr/ls_lock.c
++++ b/src/lsr/ls_lock.c
+@@ -79,11 +79,7 @@
+ #else  /* defined(USE_MUTEX_ADAPTIVE) */
+     /* pthread_mutexattr_settype(&myAttr, PTHREAD_MUTEX_NORMAL); */
+     pthread_mutexattr_settype(&myAttr,
+-#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__gnu_linux__)
+-                              PTHREAD_MUTEX_ERRORCHECK_NP
+-#else  /* defined(linux) */
+                               PTHREAD_MUTEX_ERRORCHECK
+-#endif  /* defined(linux) */
+                              );
+ #endif  /* defined(USE_MUTEX_ADAPTIVE) */
+     /* pthread_mutexattr_settype(&myAttr, PTHREAD_MUTEX_RECURSIVE); */
diff --git a/testing/litespeed/thread.patch b/testing/litespeed/thread.patch
new file mode 100644
index 0000000000..19efff0976
--- /dev/null
+++ b/testing/litespeed/thread.patch
@@ -0,0 +1,37 @@
+--- a/src/thread/thread.h
++++ b/src/thread/thread.h
+@@ -86,12 +86,6 @@
+ 
+     int timedJoin(void **pRetVal, struct timespec *timeout)
+     {   return pthread_timedjoin_np(m_tid, pRetVal, timeout);    }
+-
+-    int attrSetAffinity(size_t cpusetsize, const cpu_set_t *cpuset)
+-    {   return pthread_attr_setaffinity_np(&m_attr, cpusetsize, cpuset);  }
+-
+-    int attrGetAffinity(size_t cpusetsize, cpu_set_t *pCpuSet)
+-    {   return pthread_attr_getaffinity_np(&m_attr, cpusetsize, pCpuSet);  }
+ #endif
+ 
+     int attrSetDetachState(int detachstate)
+--- a/src/thread/pthreadmutex.cpp
++++ b/src/thread/pthreadmutex.cpp
+@@ -16,19 +16,6 @@
+ *    along with this program. If not, see http://www.gnu.org/licenses/.      *
+ *****************************************************************************/
+ #include "pthreadmutex.h"
+-#if (defined(linux) || defined(__linux) || defined(__linux__) || defined(__gnu_linux__)) && !defined( NDEBUG )
+ 
+-#ifndef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
+-# define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP \
+-    {0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP, __LOCK_INITIALIZER}
+-#endif
+-
+-pthread_mutex_t PThreadMutex::s_proto =
+-    PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;
+-
+-#else
+-
+ pthread_mutex_t PThreadMutex::s_proto = PTHREAD_MUTEX_INITIALIZER;
+-
+-#endif
+ 
-- 
2.11.1

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---