From 8a6f7fee33f59913f0d5c349b7b5fe404f5a471f Mon Sep 17 00:00:00 2001 From: James Meyer Date: Sat, 15 Dec 2012 16:23:46 -0600 Subject: supplemental-web: add a basic http server/cgi for slaves to run. Split the package into supplemental-web and supplemental-web-slave refs #881 --- abs/core/supplemental-web/PKGBUILD | 89 +++++++++++++++++----- abs/core/supplemental-web/slaveserve.py | 13 ++++ abs/core/supplemental-web/supplemental_slave.rules | 2 + 3 files changed, 83 insertions(+), 21 deletions(-) create mode 100644 abs/core/supplemental-web/slaveserve.py create mode 100644 abs/core/supplemental-web/supplemental_slave.rules diff --git a/abs/core/supplemental-web/PKGBUILD b/abs/core/supplemental-web/PKGBUILD index a032bff..f582cc1 100644 --- a/abs/core/supplemental-web/PKGBUILD +++ b/abs/core/supplemental-web/PKGBUILD @@ -1,30 +1,77 @@ -pkgname=supplemental-web +pkgbase=supplemental-web +pkgname=('supplemental-web' 'supplemental-web-slave') pkgver=1.0 pkgrel=33 arch=('i686' 'x86_64') -MVDIR=$startdir/pkg/usr/MythVantage -install=supplemental-web.install + backup=('extra.cfg.txt') -source=(lighttpd-supplement.conf extra.cfg.txt wakeonlan.sh ) -depends=('lighttpd' 'php' 'fcgi' 'python2' 'xymonserver' 'certmaster' 'func' 'python_aosd' 'LinHES-system>=2-50') - -build() { - cd $startdir/src - mkdir -p $MVDIR/etc - install -m755 -D lighttpd-supplement.conf $pkgdir/etc/gen_light_conf.d/lighttpd-supplement.conf - install -m755 -D wakeonlan.sh $MVDIR/bin/wakeonlan.sh -# install -m755 -D backend_control.sh $MVDIR/bin/backend_control.sh - mkdir -p $startdir/pkg/data/srv/httpd/htdocs/ - cp -rp $startdir/contents/* $startdir/pkg/data/srv/httpd/htdocs - chmod -R 755 $startdir/pkg/data/srv/httpd/htdocs - cd $startdir - mkdir -p $startdir/pkg/data/srv/httpd/ - cp -rp cgi $startdir/pkg/data/srv/httpd/ - cd $startdir/src - install -m755 -D extra.cfg.txt $pkgdir/data/srv/httpd/cgi/extra.cfg.txt +source=(lighttpd-supplement.conf extra.cfg.txt wakeonlan.sh slaveserve.py supplemental_slave.rules ) +build(){ + cd $startdir/src } +# +# build() { +# cd $startdir/src +# mkdir -p $MVDIR/etc +# install -m755 -D lighttpd-supplement.conf $pkgdir/etc/gen_light_conf.d/lighttpd-supplement.conf +# install -m755 -D wakeonlan.sh $MVDIR/bin/wakeonlan.sh +# # install -m755 -D backend_control.sh $MVDIR/bin/backend_control.sh +# mkdir -p $startdir/pkg/data/srv/httpd/htdocs/ +# cp -rp $startdir/contents/* $startdir/pkg/data/srv/httpd/htdocs +# chmod -R 755 $startdir/pkg/data/srv/httpd/htdocs +# cd $startdir +# mkdir -p $startdir/pkg/data/srv/httpd/ +# cp -rp cgi $startdir/pkg/data/srv/httpd/ +# cd $startdir/src +# install -m755 -D extra.cfg.txt $pkgdir/data/srv/httpd/cgi/extra.cfg.txt +# } + +package_supplemental-web() { + pkgdesc="supplemental-web package for master backend" + depends=('lighttpd' 'php' 'fcgi' 'python2' 'xymonserver' 'certmaster' 'func' 'python_aosd' 'LinHES-system>=2-50') + install=supplemental-web.install + + cd $startdir/src + MVDIR=$pkgdir/pkg/usr/MythVantage + mkdir -p $MVDIR/etc + install -m755 -D lighttpd-supplement.conf $pkgdir/etc/gen_light_conf.d/lighttpd-supplement.conf + install -m755 -D wakeonlan.sh $MVDIR/bin/wakeonlan.sh + # install -m755 -D backend_control.sh $MVDIR/bin/backend_control.sh + mkdir -p $pkgdir/data/srv/httpd/htdocs/ + cp -rp $startdir/contents/* $pkgdir/data/srv/httpd/htdocs + chmod -R 755 $pkgdir/data/srv/httpd/htdocs + cd $startdir + mkdir -p $pkgdir/data/srv/httpd/ + cp -rp cgi $pkgdir/data/srv/httpd/ + cd $startdir/src + install -m755 -D extra.cfg.txt $pkgdir/data/srv/httpd/cgi/extra.cfg.txt + } + +package_supplemental-web-slave() { + pkgdesc="supplemental-web package for slave backend" + depends=('python2' 'func' 'python_aosd' 'LinHES-system>=2-50') + conflicts="supplemental-web" + cd $startdir + mkdir -p $pkgdir/data/srv/httpd/ + cp -rp cgi $pkgdir/data/srv/httpd/ + chown -R root:root $pkgdir/data/srv/httpd/ + chmod -R 755 $pkgdir/data/srv/httpd/ + + install -m755 -D $srcdir/slaveserve.py $pkgdir/data/srv/httpd/cgi/slaveserve.py + #sudo rules + install -D -m400 $startdir/src/supplemental_slave.rules $pkgdir/etc/sudoers.d/supplemental_slave + chmod 750 $pkgdir/etc/sudoers.d + + + } + + + + md5sums=('521714803b5a3df529f0fc5f853c0d55' '3d8c7b430c1319d706ca420825918d2a' - '81cdb6ee6804fa36366c6e259a80e7b4') + '81cdb6ee6804fa36366c6e259a80e7b4' + 'fabf825ca07502db40d78f0aae15f90b' + 'b41eeb0f0aa67ea06aedff61e53fa774') diff --git a/abs/core/supplemental-web/slaveserve.py b/abs/core/supplemental-web/slaveserve.py new file mode 100644 index 0000000..c1d9ae7 --- /dev/null +++ b/abs/core/supplemental-web/slaveserve.py @@ -0,0 +1,13 @@ +#!/usr/bin/python2 +import CGIHTTPServer +import BaseHTTPServer + +class Handler(CGIHTTPServer.CGIHTTPRequestHandler): + cgi_directories = ["/"] + +PORT = 1337 + +httpd = BaseHTTPServer.HTTPServer(("", PORT), Handler) +#print "serving at port", PORT +httpd.serve_forever() + diff --git a/abs/core/supplemental-web/supplemental_slave.rules b/abs/core/supplemental-web/supplemental_slave.rules new file mode 100644 index 0000000..4445fd5 --- /dev/null +++ b/abs/core/supplemental-web/supplemental_slave.rules @@ -0,0 +1,2 @@ +#These rules are used by supplemental-web-slave +http ALL = NOPASSWD:/sbin/sv -- cgit v0.12