unbox/utils.sh

27 lines
418 B
Bash
Raw Normal View History

2020-01-29 13:51:37 +00:00
#!/bin/bash
function prefix_time(){
while read LINE; do
echo "["$(date)"] "$LINE
done
}
2020-01-31 10:16:17 +00:00
2020-01-31 14:29:45 +00:00
function export_env(){
if [ $# -lt 2 ]; then
echo not enogh arguments for export_env
exit 1
fi
VAR=${1}
shift
echo ${VAR}=${@} >> ${UNBOX_ENV_FILE}
export ${VAR}=${@}
}
2020-01-31 10:16:17 +00:00
function mem_size(){
echo $(($(cat /proc/meminfo | grep MemTotal | awk '{print $2}')*1024))
}
function dev_size(){
blockdev --getsize64 $1
}