Skip to content

Commit 108a6be

Browse files
committed
guix: Check for disk space availability before building
1 parent d7dec89 commit 108a6be

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

contrib/guix/guix-build

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,28 @@ for host in $HOSTS; do
138138
esac
139139
done
140140

141+
################
142+
# VERSION_BASE should have enough space
143+
################
144+
145+
avail_KiB="$(df -Pk "$VERSION_BASE" | sed 1d | tr -s ' ' | cut -d' ' -f4)"
146+
total_required_KiB=0
147+
for host in $HOSTS; do
148+
case "$host" in
149+
*darwin*) required_KiB=440000 ;;
150+
*mingw*) required_KiB=7600000 ;;
151+
*) required_KiB=6400000 ;;
152+
esac
153+
total_required_KiB=$((total_required_KiB+required_KiB))
154+
done
155+
156+
if (( total_required_KiB > avail_KiB )); then
157+
total_required_GiB=$((total_required_KiB / 1048576))
158+
avail_GiB=$((avail_KiB / 1048576))
159+
echo "Performing a Bitcoin Core Guix build for the selected HOSTS requires ${total_required_GiB} GiB, however, only ${avail_GiB} GiB is available. Please free up some disk space before performing the build."
160+
exit 1
161+
fi
162+
141163
################
142164
# Check that we can connect to the guix-daemon
143165
################

0 commit comments

Comments
 (0)