From 928c625e2cc3c5ee59dd5843a4f23a76511eb1c8 Mon Sep 17 00:00:00 2001
From: Adam Ierymenko <adam.ierymenko@gmail.com>
Date: Wed, 29 Jun 2016 09:45:02 -0700
Subject: [PATCH] docs

---
 doc/README.md |  4 +++-
 doc/build.sh  | 25 +++++++++++++++----------
 ext/README.md | 11 ++++++++++-
 3 files changed, 28 insertions(+), 12 deletions(-)

diff --git a/doc/README.md b/doc/README.md
index c82b54920..707c64a9a 100644
--- a/doc/README.md
+++ b/doc/README.md
@@ -1,4 +1,6 @@
 Manual Pages and Other Documentation
 =====
 
-Use "./build.sh" to build the manual pages. You'll need NodeJS and npm installed.
+Use "./build.sh" to build the manual pages.
+
+You'll need either NodeJS/npm installed (script will then automatically install the npm *marked-man* package) or */usr/bin/ronn*. The latter is a Ruby program packaged on some distributions as *rubygem-ronn* or *ruby-ronn* or installable as *gem install ronn*. The Node *marked-man* package and *ronn* from rubygems are two roughly equivalent alternatives for compiling MarkDown into roff/man format.
diff --git a/doc/build.sh b/doc/build.sh
index 5a2c77cb4..9df72a333 100755
--- a/doc/build.sh
+++ b/doc/build.sh
@@ -9,24 +9,29 @@ fi
 rm -f *.1 *.2 *.8
 
 if [ -e /usr/bin/ronn -o -e /usr/local/bin/ronn ]; then
+	# Use 'ronn' which is available as a package on many distros including Debian
 	ronn -r zerotier-cli.1.md
 	ronn -r zerotier-idtool.1.md
 	ronn -r zerotier-one.8.md
 else
-	if [ ! -f /usr/bin/node -a ! -f /usr/bin/nodejs ]; then
-		echo 'Unable to build man pages: no /usr/bin/ronn or /usr/bin/node / nodejs!'
-		exit 0
+	# Use 'marked-man' from npm
+	NODE=/usr/bin/node
+	if [ ! -e $NODE ]; then
+		if [ -e /usr/bin/nodejs ]; then
+			NODE=/usr/bin/nodejs
+		elif [ -e /usr/local/bin/node ]; then
+			NODE=/usr/local/bin/node
+		elif [ -e /usr/local/bin/nodejs ]; then
+			NODE=/usr/local/bin/nodejs
+		else
+			echo 'Unable to find ronn or node/npm -- cannot build man pages!'
+			exit 1
+		fi
 	fi
 
 	if [ ! -f node_modules/marked-man/bin/marked-man ]; then
-		echo 'Installing MarkDown to ROFF converter...'
+		echo 'Installing npm package "marked-man" -- MarkDown to ROFF converter...'
 		npm install marked-man
-		echo
-	fi
-
-	NODE=/usr/bin/node
-	if [ -e /usr/bin/nodejs ]; then
-		NODE=/usr/bin/nodejs
 	fi
 
 	$NODE node_modules/marked-man/bin/marked-man zerotier-cli.1.md >zerotier-cli.1
diff --git a/ext/README.md b/ext/README.md
index f296fa55c..be9484c51 100644
--- a/ext/README.md
+++ b/ext/README.md
@@ -1 +1,10 @@
-The ext/ folder contains third party code, drivers, installation support files, etc.
\ No newline at end of file
+Miscellaneous Stuff
+======
+
+This subfolder contains:
+
+ * Bundled third party libraries that are compiled into the binary on platforms and Linux distributions where they are not available on the system.
+
+ * Pre-compiled binaries for some platforms, such as pre-built and signed drivers for Mac and Windows.
+
+ * Miscellaneous files used by installers and packages on various platform targets.