summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2008-08-02 18:20:35 +0200
committerDaniel Friesel <derf@derf.homelinux.org>2008-08-02 18:20:35 +0200
commit0d5828e2069c51260677df1cc9e24e64a162acd6 (patch)
tree7ef099abec3f3d7f79185f8acd4a646a75d7a67a /bin
parent1048d5520ff30a561c2304b9b5cb433a5d1dd2fd (diff)
bin/pkg: Added $SILENT
Diffstat (limited to 'bin')
-rwxr-xr-xbin/pkg15
1 files changed, 9 insertions, 6 deletions
diff --git a/bin/pkg b/bin/pkg
index e9848c6..83c43f3 100755
--- a/bin/pkg
+++ b/bin/pkg
@@ -6,7 +6,7 @@
##
info () {
- echo -ne "${info}$*${reset}"
+ [[ $SILENT = 1 ]] || echo -ne "${info}$*${reset}"
}
warn () {
@@ -44,6 +44,7 @@ if [[ -f $HOME/.pkg.conf ]] {
[[ -n $PDIR ]] || PDIR="$HOME/packages"
[[ -n $PKG_ROOT ]] || PKG_ROOT="ssh://derf.homelinux.org/~/var/packages_root"
[[ -n $CL_OPTIONS ]] || CL_OPTIONS=(-q)
+[[ -n $SILENT ]] || SILENT=0
info=$'\e[0;36m'
error=$'\e[0;31m'
reset=$'\e[0m'
@@ -128,7 +129,7 @@ progress () {
desc2=$4
currentper=$[$[$current*100]/$max]
say () {
- echo -ne $*
+ [[ $SILENT = 1 ]] || echo -ne $*
}
item () {
for j in {0..$1}; {
@@ -391,19 +392,21 @@ update_provides () {
wrap () {
function=$1
+ arg=$2
+ progress=$3
if [[ -n $2 ]] {
$function $2
} else {
cd $PDIR
- [[ -n $3 ]] && all=$(wc -l < $PDIR/.list)
- [[ -n $3 ]] && current=0
+ [[ -n $progress ]] && all=$(wc -l < $PDIR/.list)
+ [[ -n $progress ]] && current=0
for i in *(/); {
current=$[$current+1]
- [[ -n $3 ]] && progress $current $all $3 $i
+ [[ -n $progress ]] && progress $current $all $progress $i
$function $i
}
- [[ -n $3 ]] && clear_line
+ [[ -n $progress ]] && clear_line
}
}