Skip to content
Open
Show file tree
Hide file tree
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
14 changes: 14 additions & 0 deletions install.ps1
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,20 @@ Test-GitVersion

$force = $args -contains "--force"

# Check if there is enough free space
$requiredSpace = 1100MB # 1100 MiB as bytes
$installDrive = (Split-Path -Qualifier $installDirectory).TrimEnd(':') # Drive letter install directory
$freeSpace = (Get-PSDrive -Name $installDrive).Free # Free space in bytes
if ($freeSpace -lt $requiredSpace) {
if ($force) {
Write-Output "Attempting Shorebird install with less than 1100 MiB of free space."
}
else {
Write-Output "Error: Not enough free space. At least 1100 MiB is required. Use --force to install anyway."
exit 1
}
}

if (Test-Path $installDirectory) {
if ($force) {
Write-Output "Existing Shorebird installation detected. Overwriting..."
Expand Down
13 changes: 13 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,19 @@ if [ $GIT_VERSION_COMPARISON -eq 2 ]; then
exit 1
fi

# Check if there is enough free space
REQUIRED_SPACE=$((1100 * 1024)) # 1100 MiB in KiB
INSTALL_VOLUME="$(dirname "$(install_dir)")" # Location of the install directory
FREE_SPACE=$(df -k $INSTALL_VOLUME | tail -1 | awk '{print $4}') # Free space in KiB
if [ $FREE_SPACE -lt $REQUIRED_SPACE ]; then
if [ "$FORCE" = true ]; then
echo "Attempting Shorebird install with less than 1100 MiB of free space."
else
echo >&2 "Error: Not enough free space. At least 1100 MiB is required. Use --force to install anyway."
exit 1
fi
fi

# Check if install_dir already exists
if [ -d "$(install_dir)" ]; then
if [ "$FORCE" = true ]; then
Expand Down