Index: www/butterfly/Makefile =================================================================== --- /dev/null +++ www/butterfly/Makefile @@ -0,0 +1,31 @@ +# Created by: Yuri Victorovich +# $FreeBSD$ + +PORTNAME= butterfly +PORTVERSION= 2.0.1 +CATEGORIES= www +MASTER_SITES= CHEESESHOP + +MAINTAINER= yuri@rawbw.com +COMMENT= Web terminal based on websocket and tornado + +LICENSE= GPLv3 + +RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}openssl>0:security/py-openssl \ + ${PYTHON_PKGNAMEPREFIX}tornado>0:www/py-tornado \ + ${PYTHON_PKGNAMEPREFIX}libsass>0:www/py-libsass + +USES= python +USE_PYTHON= autoplist distutils +NO_ARCH= yes +USE_RC_SUBR= butterfly +SUB_FILES= pkg-message +SUB_LIST= PYTHON_CMD=${PYTHON_CMD} + +post-install: + @${REINPLACE_CMD} -i '' -e "s|^butterfly_dir = os.path.join(ev, 'butterfly')|butterfly_dir = '${PREFIX}/etc/butterfly'|g" \ + ${STAGEDIR}${PREFIX}/bin/butterfly.server.py + @${MKDIR} ${STAGEDIR}${PREFIX}/etc/butterfly/ssl + ${INSTALL_DATA} ${WRKSRC}/butterfly/butterfly.conf.default ${STAGEDIR}${ETCDIR}/butterfly.conf.sample + +.include Index: www/butterfly/distinfo =================================================================== --- /dev/null +++ www/butterfly/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1486684509 +SHA256 (butterfly-2.0.1.tar.gz) = 93ecdef71b62e1809a48a706ac2ae86fdbeea6d722970cda99969bccad8ba7ef +SIZE (butterfly-2.0.1.tar.gz) = 1042304 Index: www/butterfly/files/butterfly.in =================================================================== --- /dev/null +++ www/butterfly/files/butterfly.in @@ -0,0 +1,36 @@ +#!/bin/sh +# +# $FreeBSD$ +# +# PROVIDE: butterfly +# REQUIRE: LOGIN +# +# Add the following line to /etc/rc.conf to enable butterfly: +# +# butterfly_enable="YES" +# + +: ${butterfly_enable="NO"} +: ${butterfly_user="root"} +: ${butterfly_args="--unsecure"} + +. /etc/rc.subr + +name=butterfly +rcvar=butterfly_enable +pidfile=/var/run/${name}.pid +start_cmd="start_butterfly" + +load_rc_config $name + +start_butterfly() { + echo "Starting ${name}." + if ! [ -r %%ETCDIR%%/ssl/butterfly_localhost.crt -a %%ETCDIR%%/ssl/butterfly_localhost.key -a %%ETCDIR%%/ssl/butterfly_ca.crt ]; then + %%PREFIX%%/bin/butterfly.server.py --generate-certs --host=localhost && + echo "${name}: generated the ssl certificate in %%ETCDIR%%/ssl" + fi + daemon -p $pidfile -u ${butterfly_user} %%PREFIX%%/bin/butterfly.server.py ${butterfly_args} >/var/log/${name}.log 2>&1 +} + +command="%%PYTHON_CMD%%" +run_rc_command "$1" Index: www/butterfly/files/patch-butterfly.server.py =================================================================== --- /dev/null +++ www/butterfly/files/patch-butterfly.server.py @@ -0,0 +1,29 @@ +--- butterfly.server.py.orig 2017-02-10 00:08:34 UTC ++++ butterfly.server.py +@@ -20,7 +20,7 @@ + import tornado.options + import tornado.ioloop + import tornado.httpserver +-import tornado_systemd ++#import tornado_systemd + import logging + import webbrowser + import uuid +@@ -295,13 +295,13 @@ else: + from butterfly import application + application.butterfly_dir = butterfly_dir + log.info('Starting server') +-http_server = tornado_systemd.SystemdHTTPServer( ++http_server = tornado.httpserver.HTTPServer( + application, ssl_options=ssl_opts) + http_server.listen(port, address=host) + +-if http_server.systemd: +- os.environ.pop('LISTEN_PID') +- os.environ.pop('LISTEN_FDS') ++#if http_server.systemd: ++# os.environ.pop('LISTEN_PID') ++# os.environ.pop('LISTEN_FDS') + + log.info('Starting loop') + Index: www/butterfly/files/pkg-message.in =================================================================== --- /dev/null +++ www/butterfly/files/pkg-message.in @@ -0,0 +1,14 @@ +====================================================================== +You installed butterfly, the web terminal that works through your +browser. + +It is recommended to run butterfly as a service: +# sysrc butterfly_enable="YES" +# service butterfly start + +To access butterfly please navigate to: +http://localhost:57575 + +The port and other parameters can be configured in +%%ETCDIR%%/butterfly.conf +====================================================================== Index: www/butterfly/pkg-descr =================================================================== --- /dev/null +++ www/butterfly/pkg-descr @@ -0,0 +1,17 @@ +Butterfly is a xterm compatible terminal that runs in your browser. + +Features + +* xterm compatible (support for a lot of unused features) +* Native browser scroll and search +* Theming in css/sass (18 preset themes) endless possibilities +* HTML in your terminal, cat images and use +* Multiple sessions support +* Secure authentication with X509 certificates +* 16,777,216 colors support +* Keyboard text selection +* Desktop notifications on terminal output +* Geolocation from browser +* May work on firefox too + +WWW: https://pypi.python.org/pypi/butterfly Index: www/butterfly/pkg-plist =================================================================== --- /dev/null +++ www/butterfly/pkg-plist @@ -0,0 +1,2 @@ +@sample %%ETCDIR%%/butterfly.conf.sample +@dir %%ETCDIR%%/ssl