From 4734a8b5a04d3be06c7d9134466f0a17a7b8e7cb Mon Sep 17 00:00:00 2001
From: "aleksandr.vodianov" <aleksandr.vodianov@demlabs.net>
Date: Fri, 26 Nov 2021 11:18:23 +0300
Subject: [PATCH] add subzero net

---
 linux/debian/essentials/config    |  6 ++++++
 linux/debian/essentials/postinst  | 21 +++++++++++++++++++++
 linux/debian/essentials/templates | 18 ++++++++++++++++++
 3 files changed, 45 insertions(+)

diff --git a/linux/debian/essentials/config b/linux/debian/essentials/config
index acbf1b4..c42114c 100755
--- a/linux/debian/essentials/config
+++ b/linux/debian/essentials/config
@@ -30,6 +30,12 @@ reconfigure|configure)
    db_go || true 
 
    db_input critical cellframe-node/kelvin_testnet_node_type || true 
+   db_go || true
+
+   db_input critical cellframe-node/subzero_enabled || true 
+   db_go || true 
+
+   db_input critical cellframe-node/subzero_node_type || true 
    db_go || true 
 
 ;;
diff --git a/linux/debian/essentials/postinst b/linux/debian/essentials/postinst
index 29e13ad..36deecf 100755
--- a/linux/debian/essentials/postinst
+++ b/linux/debian/essentials/postinst
@@ -87,6 +87,27 @@ if [ "$RET" = "true" ]; then
     echo "[*] Enabled kelvin testnet"
 fi
 
+# 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
+
 mkdir -p $DAP_PREFIX/var/log     || true
 mkdir -p $DAP_PREFIX/var/plugins || true
 
diff --git a/linux/debian/essentials/templates b/linux/debian/essentials/templates
index 2aaf3d0..7306194 100755
--- a/linux/debian/essentials/templates
+++ b/linux/debian/essentials/templates
@@ -71,3 +71,21 @@ Description: Kelvin Testnet: Node role
  archive - Sync all the network
  root - Special predefined root nodes, usualy produces zerochain and act like archive as well 
 
+Template: cellframe-node/subzero_enabled
+Default: true
+Choices: true, false
+Type: select
+Description: SubZero: Enable network
+ Kelvin 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 - syncronize 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, usualy produces zerochain and act like archive as well 
-- 
GitLab