From 56e55646082e02e50686a94c6e526fce373f8741 Mon Sep 17 00:00:00 2001
From: pmwkaa <pmwkaa@gmail.com>
Date: Tue, 28 Feb 2012 15:28:30 +0300
Subject: [PATCH] debian-adapt: tarantool_logrotate fixed, tarantool_instance
 uses logger.pl by default, removed tarantool-client package (moved to main 
 	package)

---
 debian/control                     | 38 ------------------------------
 debian/rules                       |  7 ++----
 debian/scripts/tarantool_instance  |  5 ++--
 debian/scripts/tarantool_logrotate | 17 ++++++++++++-
 debian/tarantool-client.install    |  1 -
 debian/tarantool-client.manpages   |  0
 debian/tarantool-common.logrotate  |  2 +-
 debian/tarantool-common.manpages   |  2 ++
 debian/tarantool.install           |  1 +
 9 files changed, 24 insertions(+), 49 deletions(-)
 delete mode 100644 debian/tarantool-client.install
 delete mode 100644 debian/tarantool-client.manpages

diff --git a/debian/control b/debian/control
index 3fa62c3736..2e6352d2c9 100644
--- a/debian/control
+++ b/debian/control
@@ -69,41 +69,3 @@ Description: high performance key/value storage server
   * stored procedures in Lua are supported
  .
  This package provides debug symbols for all tarantool packages.
-
-Package: tarantool-client
-Architecture: i386 amd64 kfreebsd-i386 kfreebsd-amd64 hurd-i386
-Priority: optional
-Depends: ${shlibs:Depends}, ${misc:Depends}
-Description: high performance key/value storage server
- Tarantool is an open-source NoSQL database, developed by Mail.ru.
- Its key properties include:
- .
-  * all data is maintained in RAM
-  * data persistence is implemented using Write Ahead Log and snapshotting
-  * supports asynchronous replication and hot standby
-  * uses coroutines and asynchronous I/O to implement high-performance
-    lock-free access to data
-  * available on Linux and FreeBSD
-  * stored procedures in Lua are supported
- .
- This package provides readline client for tarantool.
-
-Package: tarantool-client-dbg
-Architecture: i386 amd64 kfreebsd-i386 kfreebsd-amd64 hurd-i386
-Priority: extra
-Section: debug
-Depends: ${shlibs:Depends}, ${misc:Depends},
-    tarantool-client (= ${binary:Version})
-Description: high performance key/value storage server
- Tarantool is an open-source NoSQL database, developed by Mail.ru.
- Its key properties include:
- .
-  * all data is maintained in RAM
-  * data persistence is implemented using Write Ahead Log and snapshotting
-  * supports asynchronous replication and hot standby
-  * uses coroutines and asynchronous I/O to implement high-performance
-    lock-free access to data
-  * available on Linux and FreeBSD
-  * stored procedures in Lua are supported
- .
- This package provides readline client for tarantool.
diff --git a/debian/rules b/debian/rules
index 7051ecb0d9..b1af8bb780 100755
--- a/debian/rules
+++ b/debian/rules
@@ -16,8 +16,8 @@ DEB_CMAKE_NORMAL_ARGS := -DCMAKE_INSTALL_PREFIX="$(DEB_CMAKE_INSTALL_PREFIX)" \
     -DCMAKE_SKIP_RPATH=ON \
     -DCMAKE_VERBOSE_MAKEFILE=ON \
     -DCMAKE_SYSCONF_DIR=/etc/tarantool \
-    -DCMAKE_LOCALSTATE_DIR=/var
-#     -DENABLE_STATIC=ON
+    -DCMAKE_LOCALSTATE_DIR=/var \
+    -DENABLE_STATIC=ON
 #    -DCMAKE_C_COMPILER:FILEPATH="$(CC)" \
 #    -DCMAKE_CXX_COMPILER:FILEPATH="$(CXX)" \
 
@@ -38,9 +38,6 @@ clean::
 install/tarantool-dbg::
 	rm -fr debian/tarantool-dbg/usr/share/doc/tarantool-dbg
 
-install/tarantool-client-dbg::
-	rm -fr debian/tarantool-client-dbg/usr/share/doc/tarantool-client-dbg
-
 install/tarantool::
 #         make -C build-area test-force || /bin/true
 
diff --git a/debian/scripts/tarantool_instance b/debian/scripts/tarantool_instance
index 8fa35dc5f2..e97f9c6ad6 100755
--- a/debian/scripts/tarantool_instance
+++ b/debian/scripts/tarantool_instance
@@ -47,7 +47,6 @@ if ! test -x $BOX; then
     exit 20
 fi
 
-
 NAME=`basename $CFG .cfg`
 
 PID=$PID_DIR/$NAME.pid
@@ -73,8 +72,8 @@ ulimit -c unlimited
 comment_str="#### - commented by init script"
 sed "s/^[[:space:]]*file_descriptors.*/# & $comment_str/" $CFG > $SCFG
 
-echo "pid_file = $PID"            >> $SCFG
-echo "logger   = \"cat >> $LOG\"" >> $SCFG
+echo "pid_file = $PID"        >> $SCFG
+echo "logger   = \"$LOGGER\"" >> $SCFG
 
 $BOX -c $SCFG -v --check-config
 
diff --git a/debian/scripts/tarantool_logrotate b/debian/scripts/tarantool_logrotate
index c13382ff4f..737a35fd68 100755
--- a/debian/scripts/tarantool_logrotate
+++ b/debian/scripts/tarantool_logrotate
@@ -5,6 +5,12 @@ set -e
 CLI="/usr/bin/tarantool"
 CONFIG_DIR="/var/lib/tarantool/started"
 PID_DIR="/var/run/tarantool"
+PROMPT=`basename $0`
+
+error() {
+	echo "$PROMPT error: $*" 1>&2
+	exit 1
+}
 
 logger_notify() {
 	CFG=$1
@@ -13,21 +19,30 @@ logger_notify() {
 	  | tail -n 1 \
 	  | sed 's/[^[:digit:]]//g'
 	`
+	[ $? -eq 0 ] || error "failed to get primary port"
 	PORT_ADMIN=`grep \
 	  '^[[:space:]]*admin_port[[:space:]]*=[[:space:]]*[[:digit:]]\+' $CFG \
 	  | tail -n 1 \
 	  | sed 's/[^[:digit:]]//g'
 	`
+	[ $? -eq 0 ] || error "failed to get admin port"
 	LOGGER_PID=`${CLI} -p $PORT_PRIMARY -m $PORT_ADMIN "show info" \
 	  | grep 'logger_pid:' \
 	  | sed 's/[^[:digit:]]//g'
 	`
+	[ $? -eq 0 ] || error "failed to get logger pid"
 	kill -USR2 $LOGGER_PID
 }
 
+if ! echo $1|grep -q '^\(start\)$'; then
+	echo "Tarantool log rotation script"
+	echo "Usage: $0 <start>"
+    exit 5
+fi
+
 if test -d ${PID_DIR}; then
 	for file in `ls -1 $PID_DIR`; do
 		INSTANCE=`basename $file .pid`
-		logger_notify "$CONFIG_DIR/$INSTANCE.cfg"
+		logger_notify "$CONFIG_DIR/$INSTANCE"
 	done
 fi
diff --git a/debian/tarantool-client.install b/debian/tarantool-client.install
deleted file mode 100644
index 11adc51c83..0000000000
--- a/debian/tarantool-client.install
+++ /dev/null
@@ -1 +0,0 @@
-usr/bin/tarantool
diff --git a/debian/tarantool-client.manpages b/debian/tarantool-client.manpages
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/debian/tarantool-common.logrotate b/debian/tarantool-common.logrotate
index 74b4e65e62..1dc3e9b24e 100644
--- a/debian/tarantool-common.logrotate
+++ b/debian/tarantool-common.logrotate
@@ -7,6 +7,6 @@
     delaycompress
     create 0640 tarantool adm
     postrotate
-        /usr/sbin/tarantool_logrotate
+        /usr/sbin/tarantool_logrotate start
     endscript
 }
diff --git a/debian/tarantool-common.manpages b/debian/tarantool-common.manpages
index dedf40b3c4..5f67776ab9 100644
--- a/debian/tarantool-common.manpages
+++ b/debian/tarantool-common.manpages
@@ -1,2 +1,4 @@
+build-area/doc/man/tarantool.1
+build-area/doc/man/tarantool_box.1
 build-area/tarantool_instance.1
 build-area/tarantool_logrotate.1
diff --git a/debian/tarantool.install b/debian/tarantool.install
index 6c89b00b93..8e3fa42212 100644
--- a/debian/tarantool.install
+++ b/debian/tarantool.install
@@ -1 +1,2 @@
 usr/bin/tarantool_box
+usr/bin/tarantool
-- 
GitLab