File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -295,6 +295,28 @@ assert_running_as_root() {
295295 fi
296296}
297297
298+ assert_enough_disk_space () {
299+ local SANDSTORM_CONF=" ${SANDSTORM_CONF:-/ opt/ sandstorm/ sandstorm.conf} "
300+ local SANDSTORM_DIR
301+ SANDSTORM_DIR=$( dirname " $SANDSTORM_CONF " )
302+
303+ # df -k reports available space in 1KB blocks; convert to GB for the comparison.
304+ local AVAILABLE_KB
305+ AVAILABLE_KB=$( df -k " $SANDSTORM_DIR " | awk ' NR==2 {print $4}' )
306+
307+ local REQUIRED_KB=$(( 1024 * 1024 )) # 1 GB in KB
308+
309+ if [ " $AVAILABLE_KB " -lt " $REQUIRED_KB " ]; then
310+ local AVAILABLE_MB=$(( AVAILABLE_KB / 1024 ))
311+ fail " E_INSUFFICIENT_DISK_SPACE" \
312+ " Insufficient disk space on the Sandstorm volume ($SANDSTORM_DIR ).
313+ Required: 1024 MB
314+ Available: ${AVAILABLE_MB} MB
315+
316+ Please free up disk space before running this migration."
317+ fi
318+ }
319+
298320assert_user_has_backed_up () {
299321 echo " "
300322 echo " *** IMPORTANT: DATABASE UPGRADE WARNING ***"
@@ -466,6 +488,7 @@ assert_on_terminal
466488assert_dependencies
467489assert_sandstorm_installed
468490assert_running_as_root
491+ assert_enough_disk_space
469492assert_user_has_backed_up
470493assert_valid_bundle_file
471494download_latest_bundle_if_needed
You can’t perform that action at this time.
0 commit comments