Alias clash fix.

This commit is contained in:
Dmitry Voronin 2024-01-27 20:05:17 +03:00
parent 5dcd9b2f63
commit b8b53a259d
3 changed files with 12 additions and 8 deletions

View file

@ -22,7 +22,7 @@ function archive() {
[[ -f "${target}/.archiveignore" ]] && exclude="--exclude-from=${target}/.archiveignore" [[ -f "${target}/.archiveignore" ]] && exclude="--exclude-from=${target}/.archiveignore"
# create archive. # create archive.
local hash=$(tar ${exclude} -c ${target} | pv -s $(du -sb ${target} | awk '{print $1}') | xz -9e | tee ${name}.txz | sha1sum | cut -d\ -f1) local hash=$(tar ${exclude} -c ${target} | pv -s $(/usr/bin/env du -sb ${target} | awk '{print $1}') | xz -9e | tee ${name}.txz | sha1sum | cut -d\ -f1)
# append hash to target name. # append hash to target name.
local new_name="${name}_${date}-${hash}.txz" local new_name="${name}_${date}-${hash}.txz"
@ -57,7 +57,7 @@ function archive_mt() {
local mem_limit=$((mem_free*3/4)) local mem_limit=$((mem_free*3/4))
# create archive. # create archive.
local hash=$(tar ${exclude} -c ${target} | pv -s $(du -sb ${target} | awk '{print $1}') | xz -9e --threads=0 --memlimit=${mem_limit}MiB | tee ${name}.txz | sha1sum | cut -d\ -f1) local hash=$(tar ${exclude} -c ${target} | pv -s $(/usr/bin/env du -sb ${target} | awk '{print $1}') | xz -9e --threads=0 --memlimit=${mem_limit}MiB | tee ${name}.txz | sha1sum | cut -d\ -f1)
# append hash to target name. # append hash to target name.
local new_name="${name}_${date}-${hash}.txz" local new_name="${name}_${date}-${hash}.txz"
@ -89,7 +89,7 @@ function archive_fast() {
[[ -f "${target}/.archiveignore" ]] && exclude="--exclude-from=${target}/.archiveignore" [[ -f "${target}/.archiveignore" ]] && exclude="--exclude-from=${target}/.archiveignore"
# create archive. # create archive.
local hash=$(tar ${exclude} -c "${target}" | pv -s $(du -sb "${target}" | awk '{print $1}') | gzip -1 | tee "${name}".tgz | sha1sum | cut -d\ -f1) local hash=$(tar ${exclude} -c "${target}" | pv -s $(/usr/bin/env du -sb "${target}" | awk '{print $1}') | gzip -1 | tee "${name}".tgz | sha1sum | cut -d\ -f1)
# append hash to target name. # append hash to target name.
local new_name="${name}_${date}-${hash}.tgz" local new_name="${name}_${date}-${hash}.tgz"

View file

@ -1,7 +1,11 @@
# Show only physical drives info. # Show only physical drives info.
alias df="df --si | sed -e '1p' -e '/^\/dev\//!d'" function df() {
df --si | sed -e '1p' -e '/^\/dev\//!d'
}
# Show combined size in SI. # Show combined size in SI.
# Current dir by default. # Current dir by default.
# Usage: du [DIRS] # Usage: du [DIRS]
alias du="du -sh --si" function du() {
du -sh --si
}

View file

@ -111,15 +111,15 @@ function _pack_zip() {
} }
function _pack_tgz() { function _pack_tgz() {
tar -c "${@:2}" | pv -s $(du -csb "${@:2}" | sed -n -e '$p' | awk '{print $1}') | gzip -1 > "${1}" tar -c "${@:2}" | pv -s $(/usr/bin/env du -csb "${@:2}" | sed -n -e '$p' | awk '{print $1}') | gzip -1 > "${1}"
} }
function _pack_txz() { function _pack_txz() {
tar -c "${@:2}" | pv -s $(du -csb "${@:2}" | sed -n -e '$p' | awk '{print $1}') | xz -9e > "${1}" tar -c "${@:2}" | pv -s $(/usr/bin/env du -csb "${@:2}" | sed -n -e '$p' | awk '{print $1}') | xz -9e > "${1}"
} }
function _pack_tar() { function _pack_tar() {
tar -c "${@:2}" | pv -s $(du -csb "${@:2}" | sed -n -e '$p' | awk '{print $1}') > "${1}" tar -c "${@:2}" | pv -s $(/usr/bin/env du -csb "${@:2}" | sed -n -e '$p' | awk '{print $1}') > "${1}"
} }
function _pack_gz() { function _pack_gz() {