]> Frank Brehm's Git Trees - pixelpark/admin-tools.git/commitdiff
Changing some functions
authorFrank Brehm <frank@brehm-online.com>
Mon, 19 Apr 2021 10:32:32 +0000 (12:32 +0200)
committerFrank Brehm <frank@brehm-online.com>
Mon, 19 Apr 2021 10:32:32 +0000 (12:32 +0200)
lib/functions.rc

index 43edcc60f3a99291f351050bdb22e52294b6fa6a..657003e93f893015b70cc9dbd3ff4042f7faa8a7 100644 (file)
@@ -348,10 +348,15 @@ purge() {
 #------------------------------------------------------------------------------
 CP() {
 
+    local cmd="cp $*"
+    if [[ "${VERBOSE}" != "y" ]] ; then
+        cmd="cp --verbose $*"
+    fi
     if [[ "${SIMULATE}" == "y" ]] ; then
-        debug "Simulated copying of: $*"
+        info "Executing: ${cmd}"
         return
     fi
+    debug "Executing: ${cmd}"
     if [[ "${VERBOSE}" != "y" ]] ; then
         cp "$@"
     else
@@ -363,10 +368,15 @@ CP() {
 #------------------------------------------------------------------------------
 MV() {
 
+    local cmd="mv $*"
+    if [[ "${VERBOSE}" != "y" ]] ; then
+        cmd="mv --verbose $*"
+    fi
     if [[ "${SIMULATE}" == "y" ]] ; then
-        debug "Simulated moving of: $*"
+        info "Executing: ${cmd}"
         return
     fi
+    debug "Executing: ${cmd}"
     if [[ "${VERBOSE}" != "y" ]] ; then
         mv "$@"
     else
@@ -378,10 +388,15 @@ MV() {
 #------------------------------------------------------------------------------
 CHOWN() {
 
+    local cmd="chown $*"
+    if [[ "${VERBOSE}" != "y" ]] ; then
+        cmd="chown --verbose $*"
+    fi
     if [[ "${SIMULATE}" == "y" ]] ; then
-        debug "Simulated chowning of $*"
+        info "Executing: ${cmd}"
         return
     fi
+    debug "Executing: ${cmd}"
     if [[ "${VERBOSE}" != "y" ]] ; then
         chown "$@"
     else
@@ -390,13 +405,38 @@ CHOWN() {
 
 }
 
+#------------------------------------------------------------------------------
+CHMOD() {
+
+    local cmd="chmod $*"
+    if [[ "${VERBOSE}" != "y" ]] ; then
+        cmd="chmod --verbose $*"
+    fi
+    if [[ "${SIMULATE}" == "y" ]] ; then
+        info "Executing: ${cmd}"
+        return
+    fi
+    debug "Executing: ${cmd}"
+    if [[ "${VERBOSE}" != "y" ]] ; then
+        chmod "$@"
+    else
+        chmod --verbose "$@"
+    fi
+
+}
+
 #------------------------------------------------------------------------------
 LN() {
 
+    local cmd="ln $*"
+    if [[ "${VERBOSE}" != "y" ]] ; then
+        cmd="ln --verbose $*"
+    fi
     if [[ "${SIMULATE}" == "y" ]] ; then
-        debug "Simulating: ln $*"
+        info "Executing: ${cmd}"
         return
     fi
+    debug "Executing: ${cmd}"
     if [[ "${VERBOSE}" != "y" ]] ; then
         ln "$@"
     else