]> Frank Brehm's Git Trees - pixelpark/pp-admin-tools.git/commitdiff
Moving some often used functions into scripts/functions.rc
authorFrank Brehm <frank@brehm-online.com>
Wed, 31 Aug 2022 15:09:18 +0000 (17:09 +0200)
committerFrank Brehm <frank@brehm-online.com>
Wed, 31 Aug 2022 15:09:18 +0000 (17:09 +0200)
scripts/backup-pdns.sh
scripts/functions.rc

index 08c24c715588a609f190ffbbd8889580df6029f1..2ff8e53a95b2462978a0e2d5b528ccd6a49e8158 100755 (executable)
@@ -223,54 +223,6 @@ get_options() {
 
 }
 
-#########################################
-# Some often used funktions
-
-#------------------------------------------------------------------------------
-MKDIR() {
-    local cmd="mkdir"
-    if [[ "${VERBOSE}" == "y" ]] ; then
-        cmd+=" --verbose"
-    fi
-    eval ${cmd} "$@"
-}
-
-#------------------------------------------------------------------------------
-MV() {
-    local cmd="mv"
-    if [[ "${VERBOSE}" == "y" ]] ; then
-        cmd+=" --verbose"
-    fi
-    eval ${cmd} "$@"
-}
-
-#------------------------------------------------------------------------------
-RMDIR() {
-    local cmd="rmdir"
-    if [[ "${VERBOSE}" == "y" ]] ; then
-        cmd+=" --verbose"
-    fi
-    eval ${cmd} "$@"
-}
-
-#------------------------------------------------------------------------------
-empty_line() {
-#    if [[ "${QUIET}" == "y" ]] ; then
-#        return 0
-#    fi
-    echo
-}
-
-#------------------------------------------------------------------------------
-check_for_root() {
-    local my_id=$( id -u )
-    if [[ "${my_id}" != "0" ]] ; then
-        error "You must be ${RED}root${NORMAL} to execute this script."
-        echo >&2
-        exit 1
-    fi
-}
-
 ################################################################################
 
 prepare_dirs() {
index 9fbbf1ddf038c853253d8a5d869ba57f9597b8aa..f44977d3460f9df25699b693bebaad84de0c10de 100644 (file)
@@ -323,6 +323,19 @@ check_for_root() {
     fi
 }
 
+#------------------------------------------------------------------------------
+MV() {
+    local cmd="mv"
+    if [[ "${VERBOSE}" == "y" ]] ; then
+        cmd+=" --verbose"
+    fi
+    if [[ "${SIMULATE}" == "y" ]] ; then
+        info "Executing: ${cmd} $*"
+        return
+    fi
+    eval ${cmd} "$@"
+}
+
 #------------------------------------------------------------------------------
 RM() {
 
@@ -364,6 +377,19 @@ MKDIR_forced() {
     eval ${cmd}
 }
 
+#------------------------------------------------------------------------------
+RMDIR() {
+    local cmd="rmdir"
+    if [[ "${VERBOSE}" == "y" ]] ; then
+        cmd+=" --verbose"
+    fi
+    if [[ "${SIMULATE}" == "y" ]] ; then
+        info "Executing: ${cmd} $*"
+        return
+    fi
+    eval ${cmd} "$@"
+}
+
 #------------------------------------------------------------------------------
 CHOWN() {