Do storage check on root and var
This commit is contained in:
parent
48fbcac160
commit
246ee22a3d
1 changed files with 23 additions and 0 deletions
23
arkdep-build
23
arkdep-build
|
@ -41,6 +41,10 @@ declare -r workdir="$build_image_mountpoint/rootfs"
|
||||||
declare -r variant="$1"
|
declare -r variant="$1"
|
||||||
declare -r build_image_size='15G'
|
declare -r build_image_size='15G'
|
||||||
|
|
||||||
|
# Minimum required storage in KiB
|
||||||
|
declare -r minimum_available_root_storage='31457280' # 30G
|
||||||
|
declare -r minimum_available_var_storage='20971520' # 20G
|
||||||
|
|
||||||
if [[ -v ARKDEP_CONFIGS ]]; then
|
if [[ -v ARKDEP_CONFIGS ]]; then
|
||||||
declare -r configsdir="$ARKDEP_CONFIGS"
|
declare -r configsdir="$ARKDEP_CONFIGS"
|
||||||
else
|
else
|
||||||
|
@ -103,6 +107,25 @@ if [[ ! -d $variantdir ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Run the storage check only if we are not building a migration
|
||||||
|
if [[ $type != 'migraton' ]]; then
|
||||||
|
# Ensure we have the required storage available on both /var/tmp and root
|
||||||
|
declare root_storage_available=($(df --output=avail /))
|
||||||
|
root_storage_available=${root_storage_available[1]}
|
||||||
|
declare var_storage_available=($(df --output=avail /var/tmp))
|
||||||
|
var_storage_available=${root_storage_available[1]}
|
||||||
|
|
||||||
|
if [[ $root_storage_available -lt $minimum_available_root_storage ]]; then
|
||||||
|
printf 'Not enough storage available on root to export image\n'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $var_storage_available -lt $minimum_available_var_storage ]]; then
|
||||||
|
printf 'Not enough storage available on var to create image\n'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
## Variants
|
## Variants
|
||||||
#
|
#
|
||||||
# Build migration type image
|
# Build migration type image
|
||||||
|
|
Loading…
Add table
Reference in a new issue