Skip to content
This repository was archived by the owner on Aug 2, 2022. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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