From 237eea1b0c8b24c726902f12e7b5b23ab9176b7f Mon Sep 17 00:00:00 2001 From: Roy Einar Dragseth Date: Fri, 2 May 2014 14:52:30 +0200 Subject: [PATCH] Simple rpm packaging for redhat and clones. --- redhat/Makefile | 25 ++++++++++++++++++++ redhat/novnc.init | 48 +++++++++++++++++++++++++++++++++++++++ redhat/novnc.spec.in | 54 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 127 insertions(+) create mode 100644 redhat/Makefile create mode 100755 redhat/novnc.init create mode 100644 redhat/novnc.spec.in diff --git a/redhat/Makefile b/redhat/Makefile new file mode 100644 index 00000000..88d4357a --- /dev/null +++ b/redhat/Makefile @@ -0,0 +1,25 @@ + +# novnc doesn't seem to have any clear versioning so we just use the checkout date. +VERSION=20140423 +SRCDIR=novnc-${VERSION} + +rpm: createspecfile createtarfile rpmbuild + +rpmbuild: + rpmbuild -ta novnc-${VERSION}.tar.gz + +createspecfile: + mkdir -p ${SRCDIR} + sed 's/%version%/${VERSION}/' novnc.spec.in > ${SRCDIR}/novnc.spec + +createtarfile: + mkdir -p ${SRCDIR}/{utils,redhat} + cp novnc.init ${SRCDIR}/redhat/novnc.init + cp ../utils/{websockify,websocket.py,Makefile,launch.sh} ${SRCDIR}/utils + cp ../{vnc.html,vnc_auto.html,README.md,LICENSE.txt} ${SRCDIR} + cp -r ../include ${SRCDIR} + cp -r ../images ${SRCDIR} + tar zcf novnc-${VERSION}.tar.gz ${SRCDIR} + +clean: + rm -rf ${SRCDIR} novnc-${VERSION}.tar.gz *~ \ No newline at end of file diff --git a/redhat/novnc.init b/redhat/novnc.init new file mode 100755 index 00000000..a51e91ff --- /dev/null +++ b/redhat/novnc.init @@ -0,0 +1,48 @@ +#!/bin/bash +# +# /etc/rc.d/init.d/novnc +# +# Start the novnc vnc to html5 proxy. +# This init script is based on the example found at +# http://www.sensi.org/~alec/unix/redhat/sysvinit.html +# +# chkconfig: 345 99 0 +# description: The novnc proxy. + +# Source function library. +. /etc/rc.d/init.d/functions + +WEBSOCKIFY=/usr/share/novnc/utils/websockify +WEBSOCKIFYARGS="--web /usr/share/novnc/html/ 6080 localhost:5901" + +if [ -e /etc/sysconfig/novnc ]; then + source /etc/sysconfig/novnc +fi + + +case "$1" in + start) + echo -n "Starting novnc services: " + daemon --user nobody $WEBSOCKIFY -D $WEBSOCKIFYARGS + touch /var/lock/subsys/novnc + ;; + stop) + echo -n "Shutting down novnc services: " + ps -ef | grep $WEBSOCKIFY | awk '{print $2}' | xargs kill + rm -f /var/lock/subsys/novnc + echo "[OK]" + ;; + status) + ps -ef | grep websockify + ;; + restart) + $0 stop; $0 start + ;; + reload) + $0 stop; $0 start + ;; + *) + echo "Usage: novnc {start|stop|status|reload|restart" + exit 1 + ;; +esac diff --git a/redhat/novnc.spec.in b/redhat/novnc.spec.in new file mode 100644 index 00000000..91dafccb --- /dev/null +++ b/redhat/novnc.spec.in @@ -0,0 +1,54 @@ +Summary: VNC client using HTML5 (Web Sockets, Canvas) with encryption (wss://) support. +Name: novnc +Version: %version% +Release: 3 +License: MPL 2.0 +Group: Applications/Internet +URL: http://novnc.com +Source0: %{name}-%{version}.tar.gz +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root + +%description +noVNC is a HTML5 VNC client that runs well in any modern browser including mobile browsers (iPhone/iPad and Android). + + +%prep +%setup -q + +%build + +%install +rm -rf $RPM_BUILD_ROOT +target=$RPM_BUILD_ROOT/usr/share/novnc +mkdir -p $target/{utils,html/include,doc} + + +cp vnc.html $target/html +cp vnc_auto.html $target/html +cp README.md $target/doc +cp LICENSE.txt $target/doc +cp utils/Makefile $target/utils +cp utils/launch.sh $target/utils +cp utils/websocket.py $target/utils +cp utils/websockify $target/utils +cp -r images $target/html/ +cp -r include $target/html/ + +mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d +cp redhat/novnc.init $RPM_BUILD_ROOT/etc/rc.d/init.d/novnc + +%clean +rm -rf $RPM_BUILD_ROOT + + +%files +%defattr(-,root,root,-) +%doc /usr/share/novnc/doc/README.md +%dir /usr/share/novnc +/usr/ +/etc/ + +%changelog +* Wed Apr 23 2014 Roy Dragseth - +- Initial build. +