From c0c143a1536870d43135df2a19024a48a4c3433c Mon Sep 17 00:00:00 2001
From: Joel Martin <github@martintribe.org>
Date: Thu, 14 Jul 2011 15:57:01 -0500
Subject: [PATCH] Version 0.1, debian packaging, license text.

noVNC version 0.1

Add debian packaging directory loosely based on
http://trac.zentyal.org/browser/trunk/extra/novnc/debian

Show web root directory on startup (pulled from websockify f1c8223).

Lintian fixups:
    - Some license text clarifications.
    - remove executable permission on utils/launch.sh and
      include/web-socket-js/web_socket.js
    - Add executable permission to utils/launch.sh
---
 LICENSE.txt                         | 18 +++++++++++++--
 debian/changelog                    |  5 ++++
 debian/compat                       |  1 +
 debian/control                      | 13 +++++++++++
 debian/copyright                    | 36 +++++++++++++++++++++++++++++
 debian/novnc.install                | 27 ++++++++++++++++++++++
 debian/rules                        | 14 +++++++++++
 docs/VERSION                        |  1 +
 docs/packaging.txt                  | 23 ++++++++++++++++++
 include/web-socket-js/web_socket.js |  0
 utils/launch.sh                     |  0
 utils/websocket.py                  | 11 +++++----
 12 files changed, 143 insertions(+), 6 deletions(-)
 create mode 100644 debian/changelog
 create mode 100644 debian/compat
 create mode 100644 debian/control
 create mode 100644 debian/copyright
 create mode 100644 debian/novnc.install
 create mode 100755 debian/rules
 create mode 100644 docs/VERSION
 create mode 100644 docs/packaging.txt
 mode change 100755 => 100644 include/web-socket-js/web_socket.js
 mode change 100644 => 100755 utils/launch.sh
 mode change 100755 => 100644 utils/websocket.py

diff --git a/LICENSE.txt b/LICENSE.txt
index 6fbbcba..389aac6 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -1,5 +1,11 @@
-noVNC is licensed under the LGPL version 3 (see docs/LICENSE.GPL-3 and
-docs/LICENSE.LGPL-3) with the following exceptions:
+noVNC is Copyright (C) 2011 Joel Martin <github@martintribe.org>
+
+Some portions of noVNC are copyright to their individual authors.
+Please refer to the individual source files and/or to the noVNC commit
+history: https://github.com/kanaka/noVNC/commits/master
+
+noVNC is licensed under the LGPL (GNU Lesser General Public License)
+version 3 with the following exceptions:
 
     include/input.js           : LGPL-2 or any later version
    
@@ -14,3 +20,11 @@ docs/LICENSE.LGPL-3) with the following exceptions:
                                  http://creativecommons.org/licenses/by-sa/3.0/
                                  Uses of the work must be attributed
                                  to the noVNC project.
+
+The LGPL-3 license text is included at:
+    docs/LICENSE.LGPL-3 and
+    docs/LICENSE.GPL-3
+
+Or alternatively the LGPL-3 license text may be found here:
+    http://www.gnu.org/licenses/lgpl.html and
+    http://www.gnu.org/licenses/gpl.html
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..c96cb76
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,5 @@
+novnc (0.1) maverick; urgency=low
+
+  * First upstream release
+
+ -- Joel Martin <github@martintribe.org>  Tue, 05 Jul 2011 01:00:00 -0600
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000..7f8f011
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+7
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..f7b92d5
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,13 @@
+Source: novnc
+Section: web
+Priority: optional
+Maintainer: Joel Martin <github@martintribe.org>
+Build-Depends: debhelper (>= 7.0.0~)
+Standards-Version: 3.8.3
+Homepage: https://github.com/kanaka/noVNC/
+
+Package: novnc
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, python (>= 2.4)
+Description: HTML5 VNC client
+ VNC client using HTML5 (WebSockets, Canvas) with encryption (wss://) support.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..79444eb
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,36 @@
+Upstream Project: https://github.com/kanaka/noVNC/
+
+--------------------- Original LICENSE.txt ---------------------------
+
+noVNC is Copyright (C) 2011 Joel Martin <github@martintribe.org>
+
+Some portions of noVNC are copyright to their individual authors.
+Please refer to the individual source files and/or to the noVNC commit
+history: https://github.com/kanaka/noVNC/commits/master
+
+noVNC is licensed under the LGPL (GNU Lesser General Public License)
+version 3 with the following exceptions:
+
+    include/input.js           : LGPL-2 or any later version
+   
+    include/base64.js          : Dual GPL-2 or LGPL-2.1
+   
+    incluee/des.js             : Various BSD style licenses
+
+    include/web-socket-js/     : New BSD license. Source code at
+                                 http://github.com/gimite/web-socket-js
+
+    images/                    : Creative Commons Attribution-ShareAlike
+                                 http://creativecommons.org/licenses/by-sa/3.0/
+                                 Uses of the work must be attributed
+                                 to the noVNC project.
+
+----------------------------------------------------------------------
+
+The LGPL-3 license text is located at:
+    /usr/share/common-licenses/LGPL-3 and
+    /usr/share/common-licenses/GPL-3
+
+Or alternatively the LGPL-3 license text may be found here:
+    http://www.gnu.org/licenses/lgpl.html and
+    http://www.gnu.org/licenses/gpl.html
diff --git a/debian/novnc.install b/debian/novnc.install
new file mode 100644
index 0000000..ca4805f
--- /dev/null
+++ b/debian/novnc.install
@@ -0,0 +1,27 @@
+vnc.html	/usr/share/novnc
+vnc_auto.html	/usr/share/novnc
+README.md  /usr/share/doc/novnc
+LICENSE.txt  /usr/share/doc/novnc
+utils/Makefile   /usr/share/novnc/utils
+utils/launch.sh   /usr/share/novnc/utils
+utils/websocket.py   /usr/share/novnc/utils
+utils/websockify   /usr/share/novnc/utils
+utils/wsproxy.py  /usr/share/novnc/utils
+utils/rebind.c  /usr/share/novnc/utils
+utils/rebind.so  /usr/share/novnc/utils
+images/favicon.ico  /usr/share/novnc
+include/base64.js   /usr/share/novnc/include
+include/black.css   /usr/share/novnc/include
+include/des.js   /usr/share/novnc/include
+include/display.js   /usr/share/novnc/include
+include/input.js   /usr/share/novnc/include
+include/logo.js   /usr/share/novnc/include
+include/plain.css   /usr/share/novnc/include
+include/playback.js   /usr/share/novnc/include
+include/rfb.js   /usr/share/novnc/include
+include/ui.js   /usr/share/novnc/include
+include/util.js   /usr/share/novnc/include
+include/vnc.js   /usr/share/novnc/include
+include/websock.js   /usr/share/novnc/include
+include/webutil.js   /usr/share/novnc/include
+include/web-socket-js/*   /usr/share/novnc/include/web-socket-js
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..25b0812
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,14 @@
+#!/usr/bin/make -f
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+clean:
+	make -C utils clean
+	dh clean
+
+build:
+	make -C utils rebind.so
+
+%:
+	dh ${@}
diff --git a/docs/VERSION b/docs/VERSION
new file mode 100644
index 0000000..49d5957
--- /dev/null
+++ b/docs/VERSION
@@ -0,0 +1 @@
+0.1
diff --git a/docs/packaging.txt b/docs/packaging.txt
new file mode 100644
index 0000000..9552454
--- /dev/null
+++ b/docs/packaging.txt
@@ -0,0 +1,23 @@
+noVNC packaging steps for Debian/Ubuntu:
+
+- Update the noVNC version in docs/VERSION and add a new entry for the
+  version in debian/changelog
+
+- Rename the novnc source directory to match the form "novnc-VERSION".
+
+- In the novnc source directory, run the packaging command:
+
+    debuild -I -uc -us
+
+    - The -I option ignores the .git directory when generating the
+      source tarball.
+    - the -uc and -us may be omitted in order to create a signed
+      package.
+
+    - Alternatively, use pbuilder instead of debuild in order to build
+      for other distributions and to guarantee a sanitized package.
+
+- Verify the package and then commit the changes to docs/VERSION and
+  debian/changelog.
+
+- Upload the new package file(s).
diff --git a/include/web-socket-js/web_socket.js b/include/web-socket-js/web_socket.js
old mode 100755
new mode 100644
diff --git a/utils/launch.sh b/utils/launch.sh
old mode 100644
new mode 100755
diff --git a/utils/websocket.py b/utils/websocket.py
old mode 100755
new mode 100644
index 3414f52..36f64ef
--- a/utils/websocket.py
+++ b/utils/websocket.py
@@ -124,7 +124,7 @@ Sec-WebSocket-Accept: %s\r
                 self.listen_host, self.listen_port))
         print("  - Flash security policy server")
         if self.web:
-            print("  - Web server")
+            print("  - Web server. Web root: %s" % self.web)
         if ssl:
             if os.path.exists(self.cert):
                 print("  - SSL/TLS support")
@@ -146,11 +146,14 @@ Sec-WebSocket-Accept: %s\r
     @staticmethod
     def socket(host, port=None, connect=False, prefer_ipv6=False):
         """ Resolve a host (and optional port) to an IPv4 or IPv6
-        address. Create a socket. Bind to it if listen is set. Return
-        a socket that is ready for listen or connect.
+        address. Create a socket. Bind to it if listen is set,
+        otherwise connect to it. Return the socket.
         """
         flags = 0
-        if host == '': host = None
+        if host == '':
+            host = None
+        if connect and not port:
+            raise Exception("Connect mode requires a port")
         if not connect:
             flags = flags | socket.AI_PASSIVE
         addrs = socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM,
-- 
GitLab