binary updater, no errors ffrom fastdu

This commit is contained in:
2017-12-18 15:09:55 +02:00
parent f3634ce68a
commit 752a7ca645
2 changed files with 30 additions and 13 deletions

View File

@@ -55,7 +55,7 @@ function processfolder() {
}
function countfiles() {
SIZE=$( find "$@" -type f -printf %s"\n" | awk '{ sum += 1 } END { print int(sum)+0 }' )
SIZE=$( find "$@" -type f -printf %s"\n" 2>/dev/null | awk '{ sum += 1 } END { print int(sum)+0 }' )
[[ "$HUMAN" -eq 1 ]] && {
SIZE=$( siprefix "$SIZE" )
}
@@ -63,7 +63,7 @@ function countfiles() {
}
function displaysize() {
SIZE=$( find "$@" -type f -printf %s"\n" | awk '{ sum += $1 } END { print int(sum)+0 }' )
SIZE=$( find "$@" -type f -printf %s"\n" 2>/dev/null | awk '{ sum += $1 } END { print int(sum)+0 }' )
[[ "$HUMAN" -eq 1 ]] && {
SIZE=$( filesize "$SIZE" )
}

17
rc
View File

@@ -14,11 +14,13 @@ PATH=$PATH:"$QTOOLSPATH"/bin
. "$QTOOLSPATH"/qcd_function
path_remove_duplicates
[[ -f "$QTOOLSPATH"/tsv/tsvkit.sh ]] && . "$QTOOLSPATH"/tsv/tsvkit.sh &>/dev/null
function _q-tools-reload {
# reload self
[[ -z "$QTOOLSPATH" ]] && return
source "$QTOOLSPATH"/rc
}
function _q-tools-update {
# update self
[[ -z "$QTOOLSPATH" ]] && return
@@ -27,6 +29,21 @@ function _q-tools-update {
_q-tools-reload
}
function _q-tools-update-binary {
# update self
[[ -z "$QTOOLSPATH" ]] && return
[[ -w "$QTOOLSPATH" ]] || return
[[ -f "$QTOOLSPATH"/.hg_archival.txt ]] || return
local foo
echo "Updating with binary deletes the existing folder! sure? y/N"
read foo
[[ "$foo" = y ]] || return
rm -rf "$QTOOLSPATH"
mkdir -p "$QTOOLSPATH"
curl https://bitbucket.org/MoonQ/tools/get/tip.tar.gz | \
tar xz --strip 1 -C "$QTOOLSPATH"
_q-tools-reload
}
function _self_update() {
touch "$QTOOLSPATH"/.lastupdate