Skip to content

Instantly share code, notes, and snippets.

@staberas
Created June 8, 2023 10:32
Show Gist options
  • Save staberas/e35fa5be296fbc06f6865b22c76df5cc to your computer and use it in GitHub Desktop.
Save staberas/e35fa5be296fbc06f6865b22c76df5cc to your computer and use it in GitHub Desktop.
Licheepi4a build fixer
#!/bin/bash
# Define the minimum required free space in MB
MIN_FREE_SPACE=2000
# Define the filesystem to check
FILESYSTEM="/dev/root"
# Get the current directory
BUILD_DIR=$(pwd)
# Get the available space on the filesystem
AVAILABLE_SPACE=$(df -BM "$FILESYSTEM" | awk 'NR==2{print $4}' | sed 's/[^0-9]*//g')
# Compare the available space with the minimum required space
if [ "$AVAILABLE_SPACE" -gt "$MIN_FREE_SPACE" ]; then
echo "There is enough space on the filesystem. Starting the build process."
# Set the temporary directory
export TMPDIR="$BUILD_DIR/tmp"
# Create the temporary directory if it doesn't exist
if [ ! -d "$TMPDIR" ]; then
mkdir -p "$TMPDIR"
fi
# Your build commands go here
echo " Completed fixes u can now use the cmake command "
echo " # cmake -DCMAKE_INSTALL_PREFIX='$BUILD_DIR' .."
else
echo "There is not enough space on the filesystem. The build process cannot start."
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment