Explorar o código

Add new autoupdate script for hestia.

Raphael Schneeberger %!s(int64=7) %!d(string=hai) anos
pai
achega
11874f68d2
Modificáronse 1 ficheiros con 81 adicións e 0 borrados
  1. 81 0
      bin/v-list-sys-hestia-autoupdate

+ 81 - 0
bin/v-list-sys-hestia-autoupdate

@@ -0,0 +1,81 @@
+#!/bin/bash
+# info: list hestia autoupdate settings
+# options: [FORMAT]
+#
+# The function for obtaining autoupdate setings.
+
+
+#----------------------------------------------------------#
+#                    Variable&Function                     #
+#----------------------------------------------------------#
+
+# Argument definition
+user='admin'
+format=${1-shell}
+
+# Includes
+source $HESTIA/func/main.sh
+
+# JSON list function
+json_list() {
+    echo '['
+    if [ -z "$check_cron" ]; then
+        echo -e  "\t\"Disabled\","
+    else
+        echo -e  "\t\"Enabled\""
+    fi
+    echo "]"
+}
+
+# SHELL list function
+shell_list() {
+    echo -n "AUTOUPDATE:     "
+    if [ -z "$check_cron" ]; then
+        echo "Disabled"
+    else
+        echo "Enabled"
+    fi
+}
+
+# PLAIN list function
+plain_list() {
+    if [ -z "$check_cron" ]; then
+        echo "Disabled"
+    else
+        echo "Enabled"
+    fi
+}
+
+# CSV list function
+csv_list() {
+    echo "AUTOUPDATE"
+    if [ -z "$check_cron" ]; then
+        echo "Disabled"
+    else
+        echo "Enabled"
+    fi
+}
+
+
+#----------------------------------------------------------#
+#                       Action                             #
+#----------------------------------------------------------#
+
+# Check cron tab
+check_cron=$(grep 'v-update-sys-hestia-all' $USER_DATA/cron.conf)
+
+# Listing data
+case $format in
+    json)   json_list ;;
+    plain)  plain_list ;;
+    csv)    csv_list ;;
+    shell)  shell_list;;
+esac
+
+
+
+#----------------------------------------------------------#
+#                       Hestia                             #
+#----------------------------------------------------------#
+
+exit