Browse Source

Dummy module

Ernesto Nicolás Carrea 5 years ago
parent
commit
35efdd8e7b
2 changed files with 50 additions and 0 deletions
  1. 25 0
      bin/module/dummy/install.inc
  2. 25 0
      bin/module/dummy/remove.inc

+ 25 - 0
bin/module/dummy/install.inc

@@ -0,0 +1,25 @@
+#!/bin/sh
+
+hestia_module_dummy_install() {
+    source $HESTIA/bin/module/func.inc
+
+    module_installed=$(hestia_module_isinstalled dummy)
+    if [ "$module_installed" ]; then
+        echo "Dummy module is already installed. See 'hestia module info dummy'."
+        exit 1
+    fi
+
+    echo "Installing Dummy module..."
+
+    osal_kv_write $HESTIA_CONF_MODULES/dummy.conf 'installed' '1'
+    osal_kv_write $HESTIA_CONF_MODULES/dummy.conf 'description' 'Hestia Dummy module'
+    osal_kv_write $HESTIA_CONF_MODULES/dummy.conf 'enabled' '0'
+    osal_kv_write $HESTIA_CONF_MODULES/dummy.conf 'variant' 'crash-test-dummy'
+    osal_kv_write $HESTIA_CONF_MODULES/dummy.conf 'version' '4'
+
+    exit 0
+}
+
+# If this files is _not_ being sourced, act immediately
+# (otherise, wait for hestia cli to call the main function)
+[[ $_ == $0 ]] && hestia_module_dummy_install $@

+ 25 - 0
bin/module/dummy/remove.inc

@@ -0,0 +1,25 @@
+#!/bin/sh
+
+hestia_module_dummy_remove() {
+    source $HESTIA/bin/module/func.inc
+
+    module_installed=$(hestia_module_isinstalled dummy)
+    if [ ! "$module_installed" ]; then
+        echo "Dummy module is not installed. See 'hestia module info dummy'."
+        exit 1
+    fi
+
+    echo "Removing Dummy module..."
+
+    osal_kv_write $HESTIA_CONF_MODULES/dummy.conf 'installed' '0'
+    osal_kv_write $HESTIA_CONF_MODULES/dummy.conf 'description' ''
+    osal_kv_write $HESTIA_CONF_MODULES/dummy.conf 'enabled' '0'
+    osal_kv_write $HESTIA_CONF_MODULES/dummy.conf 'variant' ''
+    osal_kv_write $HESTIA_CONF_MODULES/dummy.conf 'version' '0'
+
+    exit 0
+}
+
+# If this files is _not_ being sourced, act immediately
+# (otherise, wait for hestia cli to call the main function)
+[[ $_ == $0 ]] && hestia_module_dummy_remove $@