Skip to content

Commit

Permalink
install.sh: Fix use of "du" to always use -k
Browse files Browse the repository at this point in the history
Fixes the case where on some systems "du" prints the summary with the
unit (K) appended, causing an error like the following:

    ./install.sh: 213: [: Illegal number: 6593020K
  • Loading branch information
mato committed Dec 12, 2017
1 parent 08e4fa4 commit 146d394
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion shell/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ if [ -d "$OPAMROOT" ]; then
echo "Please move it away or run with --no-backup"
fi
FREE=$(df -k "$OPAMROOT" | awk 'NR>1 {print $4}')
NEEDED=$(du -s "$OPAMROOT" | awk '{print $1}')
NEEDED=$(du -sk "$OPAMROOT" | awk '{print $1}')
if ! [ $NEEDED -lt $FREE ]; then
echo "Error: not enough free space to backup. You can retry with --no-backup,"
echo "--fresh, or remove '$OPAMROOT'"
Expand Down

0 comments on commit 146d394

Please sign in to comment.