From 974996c69df1c56568e0b8291bbe82f3155b5388 Mon Sep 17 00:00:00 2001
From: "Dmitry E. Oboukhov" <unera@debian.org>
Date: Thu, 25 Sep 2014 13:00:58 +0400
Subject: [PATCH] Add manpage of tarantoolctl.

---
 debian/rules                     | 22 +++-------
 debian/tarantool-common.manpages |  1 +
 extra/dist/dist.lua              | 70 ++++++++++++++++++++++++++++++++
 3 files changed, 76 insertions(+), 17 deletions(-)

diff --git a/debian/rules b/debian/rules
index de1f870a3a..1ba99320c4 100755
--- a/debian/rules
+++ b/debian/rules
@@ -58,23 +58,11 @@ clean::
 	rm -f doc/tnt.ent
 	rm -f www-data.in/download
 
-# install/tarantool-dbg::
-#         rm -fr debian/tarantool-dbg/usr/share/doc/tarantool-dbg
-
 install/tarantool::
-# 	pod2man -c 'tarantar' \
-# 		debian/tarantar.pod > build-area/tarantar.1
-#         make -C build-area test-force || /bin/true
 
 
-# install/tarantool-common::
-# 	pod2man -c 'tarantool instances control' \
-# 	    debian/tarantool_instance.pod > build-area/tarantool_instance.1
-# 	pod2man -c 'tarantool log rotation' \
-# 	    debian/scripts/tarantool_logrotate \
-# 	    	 > build-area/tarantool_logrotate.1
-# 	pod2man -c 'snapshot rotate' \
-# 	    debian/scripts/tarantool_snapshot_rotate \
-# 	    	> build-area/tarantool_snapshot_rotate.1
-# 	install -m0755 extra/logger.pl \
-# 	    debian/tarantool-common/usr/lib/tarantool/logger
+install/tarantool-common::
+	sed 's/dist.lua/tarantoolctl/g' extra/dist/dist.lua \
+	    > ${DEB_BUILDDIR}/tarantoolctl
+	pod2man -c 'tarantoolctl instances control' \
+	    ${DEB_BUILDDIR}/tarantoolctl > ${DEB_BUILDDIR}/tarantoolctl.1
diff --git a/debian/tarantool-common.manpages b/debian/tarantool-common.manpages
index e69de29bb2..58d0e39064 100644
--- a/debian/tarantool-common.manpages
+++ b/debian/tarantool-common.manpages
@@ -0,0 +1 @@
+build-area/tarantoolctl.1
diff --git a/extra/dist/dist.lua b/extra/dist/dist.lua
index d48317b28f..e103a2de90 100755
--- a/extra/dist/dist.lua
+++ b/extra/dist/dist.lua
@@ -1,5 +1,75 @@
 #!/usr/bin/env tarantool
 
+--[[
+
+=head1 NAME
+
+dist.lua - an utility to control tarantool instances
+
+=head1 SYNOPSIS
+
+    vim /etc/tarantool/instances.enabled/my_instance.lua
+    dist.lua start my_instance
+    dist.lua stop  my_instance
+    dist.lua logrotate my_instance
+
+=head1 DESCRIPTION
+
+The script is read C</etc/sysconfig/tarantool> or C</etc/default/tarantool>.
+The file contains common default instances options:
+
+    $ cat /etc/default/tarantool
+
+
+    -- Options for Tarantool
+    default_cfg = {
+        -- will become pid_file .. instance .. '.pid'
+        pid_file    =   "/var/run/tarantool",
+        
+        -- will become wal_dir/instance/
+        wal_dir     =   "/var/lib/tarantool",
+        
+        -- snap_dir/instance/
+        snap_dir    =   "/var/lib/tarantool",
+        
+        -- logger/instance .. '.log'
+        logger      =   "/var/log/tarantool",
+
+        username    =   "tarantool",
+    }
+
+    instance_dir = "/etc/tarantool/instances.enabled"
+
+
+The file defines C<instance_dir> where user can place his
+applications (instances).
+
+Each instance can be controlled by C<dist.lua>:
+
+=head2 Starting instance
+
+    dist.lua start instance_name
+
+=head2 Stopping instance
+
+    dist.lua stop instance_name
+
+=head2 Logrotate instance's log
+
+    dist.lua logrotate instance_name
+
+
+=head1 COPYRIGHT
+
+Copyright (C) 2010-2013 Tarantool AUTHORS:
+please see AUTHORS file.
+
+
+
+=cut
+
+]]
+
 local fio = require 'fio'
 local log = require 'log'
 local errno = require 'errno'
-- 
GitLab