Skip to content

Commit

Permalink
Merge pull request #8963 from EOSIO/fix-df-invocation-2.0
Browse files Browse the repository at this point in the history
Make /bin/df ignore $BLOCKSIZE
  • Loading branch information
revl authored Apr 17, 2020
2 parents 3f69e24 + f4bb825 commit e303192
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions scripts/helpers/general.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,21 +64,14 @@ function set_system_vars() {
export OS_MIN=$(echo "${OS_VER}" | cut -d'.' -f2)
export OS_PATCH=$(echo "${OS_VER}" | cut -d'.' -f3)
export MEM_GIG=$(($(sysctl -in hw.memsize) / 1024 / 1024 /1024))
export DISK_INSTALL=$(df -h . | tail -1 | tr -s ' ' | cut -d\ -f1 || cut -d' ' -f1)
export blksize=$(df . | head -1 | awk '{print $2}' | cut -d- -f1)
export gbfactor=$(( 1073741824 / blksize ))
export total_blks=$(df . | tail -1 | awk '{print $2}')
export avail_blks=$(df . | tail -1 | awk '{print $4}')
export DISK_TOTAL=$((total_blks / gbfactor ))
export DISK_AVAIL=$((avail_blks / gbfactor ))
else
export DISK_INSTALL=$( df -h . | tail -1 | tr -s ' ' | cut -d\ -f1 )
export DISK_TOTAL_KB=$( df . | tail -1 | awk '{print $2}' )
export DISK_AVAIL_KB=$( df . | tail -1 | awk '{print $4}' )
export MEM_GIG=$(( ( ( $(cat /proc/meminfo | grep MemTotal | awk '{print $2}') / 1000 ) / 1000 ) ))
export DISK_TOTAL=$(( DISK_TOTAL_KB / 1048576 ))
export DISK_AVAIL=$(( DISK_AVAIL_KB / 1048576 ))
fi
local IFS=' '
set `df -k . | tail -1`
export DISK_INSTALL=$1
export DISK_TOTAL=$(($2 / 1024 / 1024))
export DISK_AVAIL=$(($4 / 1024 / 1024))
export JOBS=${JOBS:-$(( MEM_GIG > CPU_CORES ? CPU_CORES : MEM_GIG ))}
}

Expand Down

0 comments on commit e303192

Please sign in to comment.