From e805bff72286ec6aa7284c0f94b9a2b6e48cc5ac Mon Sep 17 00:00:00 2001
From: Dmitry Puzyrkov <dmitry.puzyrkov@demlabs.net>
Date: Thu, 16 Jun 2022 12:43:15 +0000
Subject: [PATCH] [*] buildcript redused for new buildserver enviroment.

---
 build.sh                                      |  38 ++++
 .../android}/conf/environment                 |   0
 .../android}/conf/project_props               |   0
 {android => oldscripts/android}/conf/publish  |   0
 .../android}/conf/version_info                |   0
 .../android}/scripts/compile.sh               |   0
 .../android}/scripts/deploy.sh                |   0
 .../android}/scripts/pack.sh                  |   0
 .../android}/scripts/pre-build.sh             |   0
 .../android}/scripts/test.sh                  |   0
 {general => oldscripts/general}/build.sh      |   0
 .../general}/conf/version_info                |   0
 .../essentials/weblink-latest/.htaccess       |   0
 .../essentials/weblink-latest/index.html      |   0
 {general => oldscripts/general}/post-build.sh |   0
 {general => oldscripts/general}/pre-build.sh  |   0
 {ios => oldscripts/ios}/scripts/compile.sh    |   0
 {ios => oldscripts/ios}/scripts/deploy.sh     |   0
 {ios => oldscripts/ios}/scripts/pack.sh       |   0
 {ios => oldscripts/ios}/scripts/pre-build.sh  |   0
 {ios => oldscripts/ios}/scripts/test.sh       |   0
 .../linux}/debian/conf/dependencies           |   0
 .../linux}/debian/conf/publish                |   0
 .../linux}/debian/essentials/config           |   0
 .../linux}/debian/essentials/postinst         |   0
 .../linux}/debian/essentials/postrm           |   0
 .../linux}/debian/essentials/rules            |   0
 .../linux}/debian/essentials/templates        |   0
 .../linux}/debian/scripts/build.sh            |   0
 .../linux}/debian/scripts/cleanup.sh          |   0
 .../linux}/debian/scripts/compile_and_pack.sh |   0
 .../linux}/debian/scripts/deploy.sh           |   0
 .../linux}/debian/scripts/install_test.sh     |   0
 .../linux}/debian/scripts/pack.sh             |   0
 .../linux}/debian/scripts/post-build.sh       |   0
 .../linux}/debian/scripts/pre-build.sh        |   0
 .../debian/scripts/publish_remote/reprepro.sh |   0
 .../linux}/debian/scripts/test.sh             |   0
 .../linux}/ubuntu/conf/dependencies           |   0
 .../linux}/ubuntu/conf/publish                |   0
 {linux => oldscripts/linux}/ubuntu/essentials |   0
 .../linux}/ubuntu/scripts/build.sh            |   0
 .../linux}/ubuntu/scripts/chroot              |   0
 .../linux}/ubuntu/scripts/cleanup.sh          |   0
 .../linux}/ubuntu/scripts/compile_and_pack.sh |   0
 .../linux}/ubuntu/scripts/deploy.sh           |   0
 .../linux}/ubuntu/scripts/install_test.sh     |   0
 .../linux}/ubuntu/scripts/pack.sh             |   0
 .../linux}/ubuntu/scripts/post-build.sh       |   0
 .../linux}/ubuntu/scripts/pre-build.sh        |   0
 .../linux}/ubuntu/scripts/test.sh             |   0
 {mac => oldscripts/mac}/scripts/compile.sh    |   0
 {mac => oldscripts/mac}/scripts/deploy.sh     |   0
 {mac => oldscripts/mac}/scripts/pack.sh       |   0
 {mac => oldscripts/mac}/scripts/pre-build.sh  |   0
 {mac => oldscripts/mac}/scripts/test.sh       |   0
 {windows => oldscripts/windows}/conf/win_libs |   0
 .../windows}/scripts/compile.bat              |   0
 .../windows}/scripts/compile.sh               |   0
 .../windows}/scripts/deploy.sh                |   0
 .../windows}/scripts/pack.sh                  |   0
 .../windows}/scripts/pre-build.sh             |   0
 .../windows}/scripts/test.sh                  |   0
 pack.sh                                       |  22 ++
 packaging/deb/config                          |  71 +++++++
 packaging/deb/postinst                        | 190 ++++++++++++++++++
 packaging/deb/postrm                          |  17 ++
 packaging/deb/rules                           |  10 +
 packaging/deb/templates                       | 133 ++++++++++++
 69 files changed, 481 insertions(+)
 create mode 100755 build.sh
 rename {android => oldscripts/android}/conf/environment (100%)
 rename {android => oldscripts/android}/conf/project_props (100%)
 rename {android => oldscripts/android}/conf/publish (100%)
 rename {android => oldscripts/android}/conf/version_info (100%)
 rename {android => oldscripts/android}/scripts/compile.sh (100%)
 rename {android => oldscripts/android}/scripts/deploy.sh (100%)
 rename {android => oldscripts/android}/scripts/pack.sh (100%)
 rename {android => oldscripts/android}/scripts/pre-build.sh (100%)
 rename {android => oldscripts/android}/scripts/test.sh (100%)
 rename {general => oldscripts/general}/build.sh (100%)
 rename {general => oldscripts/general}/conf/version_info (100%)
 rename {general => oldscripts/general}/essentials/weblink-latest/.htaccess (100%)
 rename {general => oldscripts/general}/essentials/weblink-latest/index.html (100%)
 rename {general => oldscripts/general}/post-build.sh (100%)
 rename {general => oldscripts/general}/pre-build.sh (100%)
 rename {ios => oldscripts/ios}/scripts/compile.sh (100%)
 rename {ios => oldscripts/ios}/scripts/deploy.sh (100%)
 rename {ios => oldscripts/ios}/scripts/pack.sh (100%)
 rename {ios => oldscripts/ios}/scripts/pre-build.sh (100%)
 rename {ios => oldscripts/ios}/scripts/test.sh (100%)
 rename {linux => oldscripts/linux}/debian/conf/dependencies (100%)
 rename {linux => oldscripts/linux}/debian/conf/publish (100%)
 rename {linux => oldscripts/linux}/debian/essentials/config (100%)
 rename {linux => oldscripts/linux}/debian/essentials/postinst (100%)
 rename {linux => oldscripts/linux}/debian/essentials/postrm (100%)
 rename {linux => oldscripts/linux}/debian/essentials/rules (100%)
 rename {linux => oldscripts/linux}/debian/essentials/templates (100%)
 rename {linux => oldscripts/linux}/debian/scripts/build.sh (100%)
 rename {linux => oldscripts/linux}/debian/scripts/cleanup.sh (100%)
 rename {linux => oldscripts/linux}/debian/scripts/compile_and_pack.sh (100%)
 rename {linux => oldscripts/linux}/debian/scripts/deploy.sh (100%)
 rename {linux => oldscripts/linux}/debian/scripts/install_test.sh (100%)
 rename {linux => oldscripts/linux}/debian/scripts/pack.sh (100%)
 rename {linux => oldscripts/linux}/debian/scripts/post-build.sh (100%)
 rename {linux => oldscripts/linux}/debian/scripts/pre-build.sh (100%)
 rename {linux => oldscripts/linux}/debian/scripts/publish_remote/reprepro.sh (100%)
 rename {linux => oldscripts/linux}/debian/scripts/test.sh (100%)
 rename {linux => oldscripts/linux}/ubuntu/conf/dependencies (100%)
 rename {linux => oldscripts/linux}/ubuntu/conf/publish (100%)
 rename {linux => oldscripts/linux}/ubuntu/essentials (100%)
 rename {linux => oldscripts/linux}/ubuntu/scripts/build.sh (100%)
 rename {linux => oldscripts/linux}/ubuntu/scripts/chroot (100%)
 rename {linux => oldscripts/linux}/ubuntu/scripts/cleanup.sh (100%)
 rename {linux => oldscripts/linux}/ubuntu/scripts/compile_and_pack.sh (100%)
 rename {linux => oldscripts/linux}/ubuntu/scripts/deploy.sh (100%)
 rename {linux => oldscripts/linux}/ubuntu/scripts/install_test.sh (100%)
 rename {linux => oldscripts/linux}/ubuntu/scripts/pack.sh (100%)
 rename {linux => oldscripts/linux}/ubuntu/scripts/post-build.sh (100%)
 rename {linux => oldscripts/linux}/ubuntu/scripts/pre-build.sh (100%)
 rename {linux => oldscripts/linux}/ubuntu/scripts/test.sh (100%)
 rename {mac => oldscripts/mac}/scripts/compile.sh (100%)
 rename {mac => oldscripts/mac}/scripts/deploy.sh (100%)
 rename {mac => oldscripts/mac}/scripts/pack.sh (100%)
 rename {mac => oldscripts/mac}/scripts/pre-build.sh (100%)
 rename {mac => oldscripts/mac}/scripts/test.sh (100%)
 rename {windows => oldscripts/windows}/conf/win_libs (100%)
 rename {windows => oldscripts/windows}/scripts/compile.bat (100%)
 rename {windows => oldscripts/windows}/scripts/compile.sh (100%)
 rename {windows => oldscripts/windows}/scripts/deploy.sh (100%)
 rename {windows => oldscripts/windows}/scripts/pack.sh (100%)
 rename {windows => oldscripts/windows}/scripts/pre-build.sh (100%)
 rename {windows => oldscripts/windows}/scripts/test.sh (100%)
 create mode 100755 pack.sh
 create mode 100755 packaging/deb/config
 create mode 100755 packaging/deb/postinst
 create mode 100755 packaging/deb/postrm
 create mode 100755 packaging/deb/rules
 create mode 100755 packaging/deb/templates

diff --git a/build.sh b/build.sh
new file mode 100755
index 0000000..bfbf4a6
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,38 @@
+#!/bin/bash
+set -e
+
+if [ ${0:0:1} = "/" ]; then
+	HERE=`dirname $0`
+else
+	CMD=`pwd`/$0
+	HERE=`dirname ${CMD}`
+fi
+
+#build architecture 
+#- amd64-darvin
+#- amd64-linux
+#- armhf-linux
+#- armv7-linux
+
+# freebsb? openbsd? netbsd? openwrt
+# ios (ipad/iphone) aarch64-ios-darwin
+
+BUILD_ARCH="${1:-amd64-linux}"
+BUILD_TYPE="${2:-release}"
+BUILD_DIR=${PWD}/build_${BUILD_ARCH}_${BUILD_TYPE}
+
+echo "Build [${BUILD_TYPE}] binaries for [$BUILD_ARCH] architecture in [${BUILD_DIR}] on $(nproc) threads."
+
+#make build directory and cd in 
+mkdir -p ${BUILD_DIR}
+cd ${BUILD_DIR}
+
+#define DEBUG for build if neccessary
+if [ "${BUILD_TYPE}" = "debug" ]; then
+    cmake ../ -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TARGET_ARCH=$BUILD_ARCH
+else
+    cmake ../ -DCMAKE_TARGET_ARCH=$BUILD_ARCH
+fi
+
+#call make to do the build process
+make -j"$(nproc)"
diff --git a/android/conf/environment b/oldscripts/android/conf/environment
similarity index 100%
rename from android/conf/environment
rename to oldscripts/android/conf/environment
diff --git a/android/conf/project_props b/oldscripts/android/conf/project_props
similarity index 100%
rename from android/conf/project_props
rename to oldscripts/android/conf/project_props
diff --git a/android/conf/publish b/oldscripts/android/conf/publish
similarity index 100%
rename from android/conf/publish
rename to oldscripts/android/conf/publish
diff --git a/android/conf/version_info b/oldscripts/android/conf/version_info
similarity index 100%
rename from android/conf/version_info
rename to oldscripts/android/conf/version_info
diff --git a/android/scripts/compile.sh b/oldscripts/android/scripts/compile.sh
similarity index 100%
rename from android/scripts/compile.sh
rename to oldscripts/android/scripts/compile.sh
diff --git a/android/scripts/deploy.sh b/oldscripts/android/scripts/deploy.sh
similarity index 100%
rename from android/scripts/deploy.sh
rename to oldscripts/android/scripts/deploy.sh
diff --git a/android/scripts/pack.sh b/oldscripts/android/scripts/pack.sh
similarity index 100%
rename from android/scripts/pack.sh
rename to oldscripts/android/scripts/pack.sh
diff --git a/android/scripts/pre-build.sh b/oldscripts/android/scripts/pre-build.sh
similarity index 100%
rename from android/scripts/pre-build.sh
rename to oldscripts/android/scripts/pre-build.sh
diff --git a/android/scripts/test.sh b/oldscripts/android/scripts/test.sh
similarity index 100%
rename from android/scripts/test.sh
rename to oldscripts/android/scripts/test.sh
diff --git a/general/build.sh b/oldscripts/general/build.sh
similarity index 100%
rename from general/build.sh
rename to oldscripts/general/build.sh
diff --git a/general/conf/version_info b/oldscripts/general/conf/version_info
similarity index 100%
rename from general/conf/version_info
rename to oldscripts/general/conf/version_info
diff --git a/general/essentials/weblink-latest/.htaccess b/oldscripts/general/essentials/weblink-latest/.htaccess
similarity index 100%
rename from general/essentials/weblink-latest/.htaccess
rename to oldscripts/general/essentials/weblink-latest/.htaccess
diff --git a/general/essentials/weblink-latest/index.html b/oldscripts/general/essentials/weblink-latest/index.html
similarity index 100%
rename from general/essentials/weblink-latest/index.html
rename to oldscripts/general/essentials/weblink-latest/index.html
diff --git a/general/post-build.sh b/oldscripts/general/post-build.sh
similarity index 100%
rename from general/post-build.sh
rename to oldscripts/general/post-build.sh
diff --git a/general/pre-build.sh b/oldscripts/general/pre-build.sh
similarity index 100%
rename from general/pre-build.sh
rename to oldscripts/general/pre-build.sh
diff --git a/ios/scripts/compile.sh b/oldscripts/ios/scripts/compile.sh
similarity index 100%
rename from ios/scripts/compile.sh
rename to oldscripts/ios/scripts/compile.sh
diff --git a/ios/scripts/deploy.sh b/oldscripts/ios/scripts/deploy.sh
similarity index 100%
rename from ios/scripts/deploy.sh
rename to oldscripts/ios/scripts/deploy.sh
diff --git a/ios/scripts/pack.sh b/oldscripts/ios/scripts/pack.sh
similarity index 100%
rename from ios/scripts/pack.sh
rename to oldscripts/ios/scripts/pack.sh
diff --git a/ios/scripts/pre-build.sh b/oldscripts/ios/scripts/pre-build.sh
similarity index 100%
rename from ios/scripts/pre-build.sh
rename to oldscripts/ios/scripts/pre-build.sh
diff --git a/ios/scripts/test.sh b/oldscripts/ios/scripts/test.sh
similarity index 100%
rename from ios/scripts/test.sh
rename to oldscripts/ios/scripts/test.sh
diff --git a/linux/debian/conf/dependencies b/oldscripts/linux/debian/conf/dependencies
similarity index 100%
rename from linux/debian/conf/dependencies
rename to oldscripts/linux/debian/conf/dependencies
diff --git a/linux/debian/conf/publish b/oldscripts/linux/debian/conf/publish
similarity index 100%
rename from linux/debian/conf/publish
rename to oldscripts/linux/debian/conf/publish
diff --git a/linux/debian/essentials/config b/oldscripts/linux/debian/essentials/config
similarity index 100%
rename from linux/debian/essentials/config
rename to oldscripts/linux/debian/essentials/config
diff --git a/linux/debian/essentials/postinst b/oldscripts/linux/debian/essentials/postinst
similarity index 100%
rename from linux/debian/essentials/postinst
rename to oldscripts/linux/debian/essentials/postinst
diff --git a/linux/debian/essentials/postrm b/oldscripts/linux/debian/essentials/postrm
similarity index 100%
rename from linux/debian/essentials/postrm
rename to oldscripts/linux/debian/essentials/postrm
diff --git a/linux/debian/essentials/rules b/oldscripts/linux/debian/essentials/rules
similarity index 100%
rename from linux/debian/essentials/rules
rename to oldscripts/linux/debian/essentials/rules
diff --git a/linux/debian/essentials/templates b/oldscripts/linux/debian/essentials/templates
similarity index 100%
rename from linux/debian/essentials/templates
rename to oldscripts/linux/debian/essentials/templates
diff --git a/linux/debian/scripts/build.sh b/oldscripts/linux/debian/scripts/build.sh
similarity index 100%
rename from linux/debian/scripts/build.sh
rename to oldscripts/linux/debian/scripts/build.sh
diff --git a/linux/debian/scripts/cleanup.sh b/oldscripts/linux/debian/scripts/cleanup.sh
similarity index 100%
rename from linux/debian/scripts/cleanup.sh
rename to oldscripts/linux/debian/scripts/cleanup.sh
diff --git a/linux/debian/scripts/compile_and_pack.sh b/oldscripts/linux/debian/scripts/compile_and_pack.sh
similarity index 100%
rename from linux/debian/scripts/compile_and_pack.sh
rename to oldscripts/linux/debian/scripts/compile_and_pack.sh
diff --git a/linux/debian/scripts/deploy.sh b/oldscripts/linux/debian/scripts/deploy.sh
similarity index 100%
rename from linux/debian/scripts/deploy.sh
rename to oldscripts/linux/debian/scripts/deploy.sh
diff --git a/linux/debian/scripts/install_test.sh b/oldscripts/linux/debian/scripts/install_test.sh
similarity index 100%
rename from linux/debian/scripts/install_test.sh
rename to oldscripts/linux/debian/scripts/install_test.sh
diff --git a/linux/debian/scripts/pack.sh b/oldscripts/linux/debian/scripts/pack.sh
similarity index 100%
rename from linux/debian/scripts/pack.sh
rename to oldscripts/linux/debian/scripts/pack.sh
diff --git a/linux/debian/scripts/post-build.sh b/oldscripts/linux/debian/scripts/post-build.sh
similarity index 100%
rename from linux/debian/scripts/post-build.sh
rename to oldscripts/linux/debian/scripts/post-build.sh
diff --git a/linux/debian/scripts/pre-build.sh b/oldscripts/linux/debian/scripts/pre-build.sh
similarity index 100%
rename from linux/debian/scripts/pre-build.sh
rename to oldscripts/linux/debian/scripts/pre-build.sh
diff --git a/linux/debian/scripts/publish_remote/reprepro.sh b/oldscripts/linux/debian/scripts/publish_remote/reprepro.sh
similarity index 100%
rename from linux/debian/scripts/publish_remote/reprepro.sh
rename to oldscripts/linux/debian/scripts/publish_remote/reprepro.sh
diff --git a/linux/debian/scripts/test.sh b/oldscripts/linux/debian/scripts/test.sh
similarity index 100%
rename from linux/debian/scripts/test.sh
rename to oldscripts/linux/debian/scripts/test.sh
diff --git a/linux/ubuntu/conf/dependencies b/oldscripts/linux/ubuntu/conf/dependencies
similarity index 100%
rename from linux/ubuntu/conf/dependencies
rename to oldscripts/linux/ubuntu/conf/dependencies
diff --git a/linux/ubuntu/conf/publish b/oldscripts/linux/ubuntu/conf/publish
similarity index 100%
rename from linux/ubuntu/conf/publish
rename to oldscripts/linux/ubuntu/conf/publish
diff --git a/linux/ubuntu/essentials b/oldscripts/linux/ubuntu/essentials
similarity index 100%
rename from linux/ubuntu/essentials
rename to oldscripts/linux/ubuntu/essentials
diff --git a/linux/ubuntu/scripts/build.sh b/oldscripts/linux/ubuntu/scripts/build.sh
similarity index 100%
rename from linux/ubuntu/scripts/build.sh
rename to oldscripts/linux/ubuntu/scripts/build.sh
diff --git a/linux/ubuntu/scripts/chroot b/oldscripts/linux/ubuntu/scripts/chroot
similarity index 100%
rename from linux/ubuntu/scripts/chroot
rename to oldscripts/linux/ubuntu/scripts/chroot
diff --git a/linux/ubuntu/scripts/cleanup.sh b/oldscripts/linux/ubuntu/scripts/cleanup.sh
similarity index 100%
rename from linux/ubuntu/scripts/cleanup.sh
rename to oldscripts/linux/ubuntu/scripts/cleanup.sh
diff --git a/linux/ubuntu/scripts/compile_and_pack.sh b/oldscripts/linux/ubuntu/scripts/compile_and_pack.sh
similarity index 100%
rename from linux/ubuntu/scripts/compile_and_pack.sh
rename to oldscripts/linux/ubuntu/scripts/compile_and_pack.sh
diff --git a/linux/ubuntu/scripts/deploy.sh b/oldscripts/linux/ubuntu/scripts/deploy.sh
similarity index 100%
rename from linux/ubuntu/scripts/deploy.sh
rename to oldscripts/linux/ubuntu/scripts/deploy.sh
diff --git a/linux/ubuntu/scripts/install_test.sh b/oldscripts/linux/ubuntu/scripts/install_test.sh
similarity index 100%
rename from linux/ubuntu/scripts/install_test.sh
rename to oldscripts/linux/ubuntu/scripts/install_test.sh
diff --git a/linux/ubuntu/scripts/pack.sh b/oldscripts/linux/ubuntu/scripts/pack.sh
similarity index 100%
rename from linux/ubuntu/scripts/pack.sh
rename to oldscripts/linux/ubuntu/scripts/pack.sh
diff --git a/linux/ubuntu/scripts/post-build.sh b/oldscripts/linux/ubuntu/scripts/post-build.sh
similarity index 100%
rename from linux/ubuntu/scripts/post-build.sh
rename to oldscripts/linux/ubuntu/scripts/post-build.sh
diff --git a/linux/ubuntu/scripts/pre-build.sh b/oldscripts/linux/ubuntu/scripts/pre-build.sh
similarity index 100%
rename from linux/ubuntu/scripts/pre-build.sh
rename to oldscripts/linux/ubuntu/scripts/pre-build.sh
diff --git a/linux/ubuntu/scripts/test.sh b/oldscripts/linux/ubuntu/scripts/test.sh
similarity index 100%
rename from linux/ubuntu/scripts/test.sh
rename to oldscripts/linux/ubuntu/scripts/test.sh
diff --git a/mac/scripts/compile.sh b/oldscripts/mac/scripts/compile.sh
similarity index 100%
rename from mac/scripts/compile.sh
rename to oldscripts/mac/scripts/compile.sh
diff --git a/mac/scripts/deploy.sh b/oldscripts/mac/scripts/deploy.sh
similarity index 100%
rename from mac/scripts/deploy.sh
rename to oldscripts/mac/scripts/deploy.sh
diff --git a/mac/scripts/pack.sh b/oldscripts/mac/scripts/pack.sh
similarity index 100%
rename from mac/scripts/pack.sh
rename to oldscripts/mac/scripts/pack.sh
diff --git a/mac/scripts/pre-build.sh b/oldscripts/mac/scripts/pre-build.sh
similarity index 100%
rename from mac/scripts/pre-build.sh
rename to oldscripts/mac/scripts/pre-build.sh
diff --git a/mac/scripts/test.sh b/oldscripts/mac/scripts/test.sh
similarity index 100%
rename from mac/scripts/test.sh
rename to oldscripts/mac/scripts/test.sh
diff --git a/windows/conf/win_libs b/oldscripts/windows/conf/win_libs
similarity index 100%
rename from windows/conf/win_libs
rename to oldscripts/windows/conf/win_libs
diff --git a/windows/scripts/compile.bat b/oldscripts/windows/scripts/compile.bat
similarity index 100%
rename from windows/scripts/compile.bat
rename to oldscripts/windows/scripts/compile.bat
diff --git a/windows/scripts/compile.sh b/oldscripts/windows/scripts/compile.sh
similarity index 100%
rename from windows/scripts/compile.sh
rename to oldscripts/windows/scripts/compile.sh
diff --git a/windows/scripts/deploy.sh b/oldscripts/windows/scripts/deploy.sh
similarity index 100%
rename from windows/scripts/deploy.sh
rename to oldscripts/windows/scripts/deploy.sh
diff --git a/windows/scripts/pack.sh b/oldscripts/windows/scripts/pack.sh
similarity index 100%
rename from windows/scripts/pack.sh
rename to oldscripts/windows/scripts/pack.sh
diff --git a/windows/scripts/pre-build.sh b/oldscripts/windows/scripts/pre-build.sh
similarity index 100%
rename from windows/scripts/pre-build.sh
rename to oldscripts/windows/scripts/pre-build.sh
diff --git a/windows/scripts/test.sh b/oldscripts/windows/scripts/test.sh
similarity index 100%
rename from windows/scripts/test.sh
rename to oldscripts/windows/scripts/test.sh
diff --git a/pack.sh b/pack.sh
new file mode 100755
index 0000000..1e24690
--- /dev/null
+++ b/pack.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+set -e
+
+if [ ${0:0:1} = "/" ]; then
+	HERE=`dirname $0`
+else
+	CMD=`pwd`/$0
+	HERE=`dirname ${CMD}`
+fi
+
+
+BUILD_ARCH="${1:-x86_64-linux-gnu}"
+BUILD_TYPE="${2:-release}"
+PACKAGE_TYPE="${3:-deb}"
+BUILD_DIR=${PWD}/build_${BUILD_ARCH}_${BUILD_TYPE}
+
+echo "Pack [${BUILD_TYPE}] binaries for [$BUILD_ARCH] architecture from [${BUILD_DIR}] in {$PACKAGE_TYPE} package."
+
+cd ${BUILD_DIR}
+
+#do cpack, it should care all other things and generate a deb file
+cpack .
diff --git a/packaging/deb/config b/packaging/deb/config
new file mode 100755
index 0000000..47ad739
--- /dev/null
+++ b/packaging/deb/config
@@ -0,0 +1,71 @@
+#!/bin/bash -e
+. /usr/share/debconf/confmodule
+
+
+case "$1" in
+reconfigure|configure)
+
+   db_input critical cellframe-node/auto_online || true 
+   db_go || true 
+
+   db_input critical cellframe-node/debug_mode || true 
+   db_go || true 
+
+   db_input critical cellframe-node/server_enabled || true 
+   db_go || true 
+
+   db_input critical cellframe-node/server_addr || true 
+   db_go || true 
+
+   db_input critical cellframe-node/server_port || true 
+   db_go || true 
+
+   db_input critical cellframe-node/notify_srv_addr || true 
+   db_go || true 
+
+   db_input critical cellframe-node/notify_srv_port || true 
+   db_go || true 
+
+   db_input critical cellframe-node/subzero_enabled || true 
+   db_go || true 
+
+   db_get cellframe-node/subzero_enabled
+   if [ "$RET" = "true" ]; then
+      db_input critical cellframe-node/subzero_node_type || true 
+      db_go || true
+   fi
+
+   db_input critical cellframe-node/kelvpn_minkowski_enabled || true 
+   db_go || true 
+
+   db_get cellframe-node/kelvpn_minkowski_enabled
+   if [ "$RET" = "true" ]; then
+      db_input critical cellframe-node/kelvpn_minkowski_node_type || true 
+      db_go || true
+   fi
+
+   db_input critical cellframe-node/backbone_enabled || true 
+   db_go || true 
+
+   db_get cellframe-node/backbone_enabled
+   if [ "$RET" = "true" ]; then
+      db_input critical cellframe-node/backbone_node_type || true 
+      db_go || true
+   fi
+
+   db_input critical cellframe-node/enable_python_plugins || true 
+   db_go || true 
+
+   db_get cellframe-node/enable_python_plugins
+   if [ "$RET" = "true" ]; then
+      db_input critical cellframe-node/python_plugins_path || true 
+      db_go || true
+   fi
+;;
+*)
+   echo "config called with unknown argument \`$1'" >&2
+   exit 1
+;;
+esac
+
+
diff --git a/packaging/deb/postinst b/packaging/deb/postinst
new file mode 100755
index 0000000..0eb6292
--- /dev/null
+++ b/packaging/deb/postinst
@@ -0,0 +1,190 @@
+#!/bin/bash -e
+. /usr/share/debconf/confmodule
+
+DAP_CHAINS_NAME="cellframe"
+DAP_APP_NAME="${DAP_CHAINS_NAME}-node"
+DAP_PREFIX="/opt/${DAP_APP_NAME}"
+
+DAP_CFG_TPL="${DAP_PREFIX}/share/configs/${DAP_APP_NAME}.cfg.tpl"
+
+# Store write config to new if present smth
+DAP_CFG="${DAP_PREFIX}/etc/${DAP_APP_NAME}.cfg"
+
+[ -e "/etc/profile.d/${DAP_APP_NAME}.sh" ] || ln -sf ${DAP_PREFIX}/share/profile.d/${DAP_APP_NAME}.sh /etc/profile.d/${DAP_APP_NAME}.sh
+
+# Init node config
+if [ -e "${DAP_CFG}" ]; then
+    DAP_CFG="${DAP_PREFIX}/etc/${DAP_APP_NAME}.cfg.dpkg-new"
+else
+    DAP_CFG="${DAP_PREFIX}/etc/${DAP_APP_NAME}.cfg"
+fi
+
+cat ${DAP_CFG_TPL} > ${DAP_CFG} || true
+
+sed -i "s/{PREFIX}/\/opt\/${DAP_APP_NAME}/g" ${DAP_CFG}  || true
+
+db_get cellframe-node/debug_mode || true
+sed -i "s/{DEBUG_MODE}/${RET}/g" ${DAP_CFG}  || true
+
+db_get cellframe-node/auto_online || true
+sed -i "s/{AUTO_ONLINE}/${RET}/g" ${DAP_CFG}  || true
+
+db_get cellframe-node/server_enabled || true
+sed -i "s/{SERVER_ENABLED}/${RET}/g" ${DAP_CFG}  || true
+
+db_get cellframe-node/server_port || true
+sed -i "s/{SERVER_PORT}/${RET}/g" ${DAP_CFG}  || true
+
+db_get cellframe-node/server_addr || true
+sed -i "s/{SERVER_ADDR}/${RET}/g" ${DAP_CFG}  || true
+
+db_get cellframe-node/notify_srv_addr || true
+sed -i "s/{NOTIFY_SRV_ADDR}/${RET}/g" ${DAP_CFG}  || true
+
+db_get cellframe-node/notify_srv_port || true
+sed -i "s/{NOTIFY_SRV_PORT}/${RET}/g" ${DAP_CFG}  || true
+
+# Init subzero
+NET_NAME="subzero"
+
+db_get cellframe-node/subzero_enabled || true
+if [ "${RET}" = "true" ]; then
+    DAP_CFG_NET="${DAP_PREFIX}/etc/network/${NET_NAME}.cfg"
+    DAP_CFG_NET_TPL="${DAP_PREFIX}/share/configs/network/${NET_NAME}.cfg.tpl"
+    DAP_NET_CFG=""
+    
+    if [ -e "$DAP_CFG_NET" ]; then
+	DAP_NET_CFG="${DAP_PREFIX}/etc/network/${NET_NAME}.cfg.dpkg-new"
+    else
+	DAP_NET_CFG="${DAP_PREFIX}/etc/network/${NET_NAME}.cfg"
+    fi
+
+    cat ${DAP_CFG_NET_TPL} > ${DAP_NET_CFG} || true
+    db_get cellframe-node/subzero_node_type || true
+    NODE_TYPE=${RET}
+    sed -i "s/{NODE_TYPE}/${NODE_TYPE}/g" ${DAP_NET_CFG}  || true
+    echo "[*] Enabled subzero"
+fi
+
+# Init mileena
+NET_NAME="mileena"
+
+db_get cellframe-node/mileena_enabled || true
+if [ "$RET" = "true" ]; then
+    DAP_CFG_NET="${DAP_PREFIX}/etc/network/${NET_NAME}.cfg"
+    DAP_CFG_NET_TPL="${DAP_PREFIX}/share/configs/network/${NET_NAME}.cfg.tpl"
+    DAP_NET_CFG=""
+    
+    if [ -e "${DAP_CFG_NET}" ]; then
+	DAP_NET_CFG="${DAP_PREFIX}/etc/network/${NET_NAME}.cfg.dpkg-new"
+    else
+	DAP_NET_CFG="${DAP_PREFIX}/etc/network/${NET_NAME}.cfg"
+    fi
+
+    cat ${DAP_CFG_NET_TPL} > ${DAP_NET_CFG} || true
+    db_get cellframe-node/mileena_node_type || true
+    NODE_TYPE=${RET}
+    sed -i "s/{NODE_TYPE}/${NODE_TYPE}/g" ${DAP_NET_CFG}  || true
+    echo "[*] Enabled mileena"
+fi
+
+# Init Minkowski
+NET_NAME="kelvpn-minkowski"
+
+db_get cellframe-node/kelvpn_minkowski_enabled || true
+if [ "${RET}" = "true" ]; then
+    DAP_CFG_NET="${DAP_PREFIX}/etc/network/${NET_NAME}.cfg"
+    DAP_CFG_NET_TPL="${DAP_PREFIX}/share/configs/network/${NET_NAME}.cfg.tpl"
+    DAP_NET_CFG=""
+    
+    if [ -e "$DAP_CFG_NET" ]; then
+	DAP_NET_CFG="${DAP_PREFIX}/etc/network/${NET_NAME}.cfg.dpkg-new"
+    else
+	DAP_NET_CFG="${DAP_PREFIX}/etc/network/${NET_NAME}.cfg"
+    fi
+
+    cat ${DAP_CFG_NET_TPL} > ${DAP_NET_CFG} || true
+    db_get cellframe-node/kelvpn_minkowski_node_type || true
+    NODE_TYPE=${RET}
+    sed -i "s/{NODE_TYPE}/${NODE_TYPE}/g" ${DAP_NET_CFG}  || true
+    echo "[*] Enabled kelvpn-minkowski"
+fi
+
+# Init Backbone
+NET_NAME="Backbone"
+
+db_get cellframe-node/backbone_enabled || true
+if [ "${RET}" = "true" ]; then
+    DAP_CFG_NET="${DAP_PREFIX}/etc/network/${NET_NAME}.cfg"
+    DAP_CFG_NET_TPL="${DAP_PREFIX}/share/configs/network/${NET_NAME}.cfg.tpl"
+    DAP_NET_CFG=""
+    
+    if [ -e "${DAP_CFG_NET}" ]; then
+	DAP_NET_CFG="${DAP_PREFIX}/etc/network/${NET_NAME}.cfg.dpkg-new"
+    else
+	DAP_NET_CFG="${DAP_PREFIX}/etc/network/${NET_NAME}.cfg"
+    fi
+
+    cat ${DAP_CFG_NET_TPL} > ${DAP_NET_CFG} || true
+    db_get cellframe-node/backbone_node_type || true
+    NODE_TYPE=$RET
+    sed -i "s/{NODE_TYPE}/${NODE_TYPE}/g" ${DAP_NET_CFG}  || true
+    echo "[*] Enabled Backbone"
+fi
+
+#Set up Python plugins
+db_get cellframe-node/enable_python_plugins || true
+if [ "${RET}" = "true" ]; then
+    sed -i 's/#\[plugins\]/\[plugins\]/g' ${DAP_CFG} || true
+    sed -i 's/#py_load=.*/py_load=true/g' ${DAP_CFG} || true
+    db_get cellframe-node/python_plugins_path || true
+    sed -i "s|#py_path=.*|py_path=${RET}|g" ${DAP_CFG} || true
+    echo "[*] Enabled Python plugins"
+fi
+
+if [ $(cat /etc/passwd | grep ${DAP_APP_NAME}) ] ; then
+    usermod ${DAP_APP_NAME} -s /bin/false > /dev/null || true # Let's change the default shell just in case
+else
+    echo "[*] Add user ${DAP_APP_NAME}"
+    adduser --system --no-create-home --group --home /opt/${DAP_APP_NAME} ${DAP_APP_NAME} --shell /bin/false > /dev/null || true
+fi
+
+echo "[*] Check /etc/systemd/system/${DAP_APP_NAME}.service file..."
+if [ -e /etc/systemd/system/${DAP_APP_NAME}.service ]; then
+    echo "[*] Restarting ${DAP_APP_NAME} to implement changes"
+    systemctl stop ${DAP_APP_NAME}  >> /dev/null || true
+    echo "[*] Stopped ${DAP_APP_NAME}"
+    systemctl daemon-reload || true
+    systemctl start ${DAP_APP_NAME} || true
+    echo "[*] Started ${DAP_APP_NAME}"
+else
+    echo "[!] Installing ${DAP_APP_NAME} as systemd service"
+    ln -sf $DAP_PREFIX/share/${DAP_APP_NAME}.service /etc/systemd/system/${DAP_APP_NAME}.service || true
+    systemctl enable ${DAP_PREFIX}/share/${DAP_APP_NAME}.service || true
+    echo "[*] Enabling logrotate"
+    ln -sf ${DAP_PREFIX}/share/logrotate/${DAP_APP_NAME} /etc/logrotate.d/${DAP_APP_NAME} || true
+
+    mkdir -p ${DAP_PREFIX}/var/{run,lib/wallet,lib/global_db,lib/plugins,log} || true
+    
+    touch ${DAP_PREFIX}/var/run/${DAP_APP_NAME}.pid || true
+    
+    for filename in $(find ${DAP_PREFIX} | grep -v bugreport); do
+        if [ -d ${filename} ]; then
+            chmod 0775 ${filename} 2>/dev/null || true
+        else
+            chmod 0664 ${filename} 2>/dev/null || true
+        fi
+    done
+
+    chmod 0666 ${DAP_CFG}
+    chmod 0666 ${DAP_CFG_TPL}
+    chmod 0774 ${DAP_PREFIX}/bin/* || true
+
+    #set python permissions    
+    find ${DAP_PREFIX}/bin/python -type d -exec chmod 755 {} +
+    chmod 774 ${DAP_PREFIX}/bin/python/bin/*
+    chown -R ${DAP_APP_NAME}: ${DAP_PREFIX}
+    echo "[*] Starting ${DAP_APP_NAME} service"
+    systemctl start ${DAP_APP_NAME} || true
+    echo "[!] Done"
+fi
diff --git a/packaging/deb/postrm b/packaging/deb/postrm
new file mode 100755
index 0000000..b6cd2eb
--- /dev/null
+++ b/packaging/deb/postrm
@@ -0,0 +1,17 @@
+#! /bin/bash -e
+if [ "$1" == "purge" ] && [ -e /usr/share/debconf/confmodule ] ; then
+. /usr/share/debconf/confmodule
+db_purge
+fi
+GROUP_RM="cellframe-node"
+
+systemctl stop cellframe-node || true
+systemctl disable cellframe-node || true
+
+#for username in `cat /etc/passwd | grep "/home" | cut -d ':' -f1`; do
+#  gpasswd -d $username $GROUP_RM || true
+#done
+#rm -r /opt/cellframe-node || true
+#groupdel cellframe-node || true
+#userdel cellframe-node || true
+
diff --git a/packaging/deb/rules b/packaging/deb/rules
new file mode 100755
index 0000000..8ebdadf
--- /dev/null
+++ b/packaging/deb/rules
@@ -0,0 +1,10 @@
+#!/usr/bin/make -f
+
+override_dh_fixperms:
+    dh_fixperms -X/opt/cellframe-node
+    chmod 777 /opt/cellframe-node/bin/cellframe-node-cli
+override_dh_auto_install:
+    dh_auto_install -- prefix=/opt/cellframe-node
+%:
+#    dh $@  --with=systemd
+    dh $@
diff --git a/packaging/deb/templates b/packaging/deb/templates
new file mode 100755
index 0000000..53d7dd3
--- /dev/null
+++ b/packaging/deb/templates
@@ -0,0 +1,133 @@
+Template: cellframe-node/auto_online
+Default: false
+Choices: true, false
+Type: select
+Description: Auto online
+ Bring up links automatically and go to ONLINE network state
+
+Template: cellframe-node/debug_mode
+Default: false
+Choices: true, false
+Type: select
+Description: Debug mode
+ Debug mode for logs
+
+Template: cellframe-node/server_enabled
+Default: false
+Choices: true, false
+Type: select
+Description: Accept connections
+ Accept connections 
+
+Template: cellframe-node/server_port
+Default: 8079
+Type: string
+Description: Server port
+ Server port to listen on, recommended 8079 
+
+Template: cellframe-node/server_addr
+Default: 0.0.0.0
+Type: string
+Description: Server address
+ Server address to listen on
+
+Template: cellframe-node/notify_srv_addr
+Default: 127.0.0.1
+Type: string
+Description: Notify server address
+ Notify server address to listen on
+
+Template: cellframe-node/notify_srv_port
+Default: 8080
+Type: string
+Description: Notify server port
+ Notify server port to listen on 
+
+Template: cellframe-node/subzero_enabled
+Default: true
+Choices: true, false
+Type: select
+Description: SubZero: Enable network
+ Subzero Testnet: Enable network auto load on start
+
+Template: cellframe-node/subzero_node_type
+Type: select
+Default: full
+Choices: full, light, master, archive, root
+Description: SubZero: Node role
+ Select node role:. 
+ Light - Synchronize only local wallets 
+ full - Sync all its cell
+ master - Allow to store values in chains and take comission, sync all shards that will need to be synced
+ archive - Sync all the network
+ root - Special predefined root nodes, usually produces zerochain and acts like archive as well
+
+Template: cellframe-node/mileena_enabled
+Default: true
+Choices: true, false
+Type: select
+Description: Mileena: Enable network
+ Mileena Testnet: Enable network auto load on start
+
+Template: cellframe-node/mileena_node_type
+Type: select
+Default: full
+Choices: full, light, master, archive, root
+Description: Mileena: Node role
+ Select node role:. 
+ Light - Synchronize only local wallets 
+ full - Sync all its cell
+ master - Allow to store values in chains and take comission, sync all shards that will need to be synced
+ archive - Sync all the network
+ root - Special predefined root nodes, usually produces zerochain and acts like archive as well
+
+Template: cellframe-node/kelvpn_minkowski_enabled
+Default: true
+Choices: true, false
+Type: select
+Description: Kelvpn Minkowski: Enable network
+ Minkowski Testnet: Enable network auto load on start
+
+Template: cellframe-node/kelvpn_minkowski_node_type
+Type: select
+Default: full
+Choices: full, light, master, archive, root
+Description: Kelvpn Minkowski: Node role
+ Select node role:. 
+ Light - Synchronize only local wallets 
+ full - Sync all its cell
+ master - Allow to store values in chains and take comission, sync all shards that will need to be synced
+ archive - Sync all the network
+ root - Special predefined root nodes, usually produces zerochain and acts like archive as well 
+
+Template: cellframe-node/backbone_enabled
+Default: true
+Choices: true, false
+Type: select
+Description: Backbone: Enable network
+ Backbone Mainnet: Enable network auto load on start
+
+Template: cellframe-node/backbone_node_type
+Type: select
+Default: full
+Choices: full, light, master, archive, root
+Description: Backbone: Node role
+ Select node role:. 
+ Light - Synchronize only local wallets 
+ full - Sync all its cell
+ master - Allow to store values in chains and take comission, sync all shards that will need to be synced
+ archive - Sync all the network
+ root - Special predefined root nodes, usually produces zerochain and acts like archive as well
+
+Template: cellframe-node/enable_python_plugins
+Default: false
+Choices: true, false
+Type: select
+Description: Python plugins: Enable Python plugins
+ Python plugins: Enable Python plugins
+
+Template: cellframe-node/python_plugins_path
+Default: /opt/cellframe-node/var/lib/plugins
+Type: string
+Description: Python plugins path
+ Path for Python plugins
\ No newline at end of file
-- 
GitLab