56 lines
616 B
Plaintext
56 lines
616 B
Plaintext
|
#!/bin/bash
|
||
|
|
||
|
reset='\e[0m'
|
||
|
bold='\e[1m'
|
||
|
green='\e[92m'
|
||
|
red='\e[91m'
|
||
|
yellow='\e[93m'
|
||
|
cyan='\e[96m'
|
||
|
|
||
|
status(){
|
||
|
echo -e "$yellow$@$reset"
|
||
|
}
|
||
|
|
||
|
ok() {
|
||
|
echo -e " [ $green${bold}OK$reset ]"
|
||
|
}
|
||
|
|
||
|
error(){
|
||
|
echo -e "$red - $@$reset"
|
||
|
}
|
||
|
|
||
|
failure(){
|
||
|
echo -e "$red - $@$reset"
|
||
|
exit
|
||
|
}
|
||
|
|
||
|
info(){
|
||
|
echo -e "$cyan$@$reset"
|
||
|
}
|
||
|
|
||
|
infon(){
|
||
|
echo -ne "$cyan$@$reset"
|
||
|
}
|
||
|
|
||
|
|
||
|
drawexit(){
|
||
|
[ $1 -eq 0 ] && ok || error "Failed!"
|
||
|
}
|
||
|
|
||
|
filelen(){
|
||
|
wc -c $1 | cut -d' ' -f1
|
||
|
}
|
||
|
|
||
|
wraperr(){
|
||
|
$@ && rc=0 || rc=$?
|
||
|
if [ $rc -eq 0 ]
|
||
|
then
|
||
|
ok 2>&1
|
||
|
else
|
||
|
error "Command failed: \"$@\"" 2>&1
|
||
|
error "Return code: $rc" 2>&1
|
||
|
exit $rc
|
||
|
fi
|
||
|
}
|
||
|
|