Last active
June 22, 2018 01:59
-
-
Save boondocks-iot/457074c61698897fe75b8fd2a92ea290 to your computer and use it in GitHub Desktop.
Boondocks OS Source Builder helper script.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Boondocks OS Source Builder helper script. | |
# Gist: https://gist.github.com/slimbrd/9dbbb2d4a70b13a0283fde4bca5d93d9 | |
# Raw: https://git.io/f8TlJ | |
# *** Warning: this script can be destructive. Be aware. *** | |
# This script helps automate the manual bits to kick off a Boondocks OS Yocto build. | |
# Assumptions: | |
# - Produces a development build by default | |
# - Kicks off build from directory: boondocks-yocto-scripts/build | |
# - Boondocks OS source repo is cloned as: boondocks-raspberrypi.$RANDOM | |
# Cloning: | |
# - Clone path controlled by command line switch: $2 (repo_root) | |
# - Clone path will be created if it does not exist. | |
# Actions Performed: | |
# 1. Clone a new copy of the source repo | |
# 2. Run: prerequisites.sh | |
# 3. Run: build.sh | |
# Parameter inputs w/default values | |
build_type=${1:-"-d"} | |
repo_root=${2:-"$(pwd)/boondocks-raspberrypi.$RANDOM"} | |
repo_directory=${3:-"boondocks-raspberrypi"} | |
SECONDS=0 | |
# fully qualified path of the source repo. | |
repo_path=$repo_root/$repo_directory | |
echo | |
echo "Boondocks OS Source Builder is starting..." | |
echo "Command Line: $@" | |
echo "Build Type: $build_type" | |
echo "Repo Root: $repo_root" | |
echo "Repo Directory: $repo_directory" | |
echo "Repo Path: $repo_path" | |
echo "You may be prompted for credentials during portions of the build." | |
echo | |
# if the repo path already exists, delete it before cloning. | |
if [ -d "$repo_path" ]; then | |
sudo rm -rf $repo_path | |
echo "Boondocks script deleted previous repo path: $repo_path" | |
echo | |
fi | |
# install dependencies for this script. | |
sudo apt update && sudo apt install -y git | |
# create and change to the source directory. | |
mkdir -p $repo_root | |
cd $repo_root | |
# clone the Boondocks OS source repo into the current directory. | |
git clone --recursive https://github.com/Boondocks/boondocks-raspberrypi.git $repo_directory | |
echo "Boondocks OS cloned to $repo_path". | |
# change directory to the Boondocks build scripts. | |
cd $repo_root/$repo_directory/boondocks-yocto-scripts/build | |
echo "Boondocks script changed to: $(pwd)" | |
# Execute a Boondocks OS source build: | |
# 1. Explicitly install all prerequisites. | |
# 2. Build source as a development image. | |
# Prerequisites. | |
# "prerequisites -h" for help. | |
echo "Boondocks script is going to run: $(pwd)/prerequisites.sh -u -p -n -d]" | |
./prerequisites.sh -u -p -n -d | |
# Build. | |
# "build.sh -h" for help. | |
echo "Boondocks script is going to run: $(pwd)/build.sh -d]" | |
./build.sh $build_type | |
script_duration=$SECONDS | |
echo "Boondocks script duration: $(($script_duration / 60))m $(($script_duration % 60))s." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Execute
bos.sh
Helper ScriptThis helper script automates typical by-hand commands to kick off a new build.
The below examples use
git.io
to shorten the fullgithub
URLs. If you prefer to run this script without using thegit.io
shortened URL, use the direct raw file URL instead:https://gist.githubusercontent.com/boondocks-iot/457074c61698897fe75b8fd2a92ea290/raw/bos.sh
You can also clone this gist and run the
bos.sh
script directly using the below command lines as an example of customizing the build.Production Build
bash -c "$(curl -sL https://git.io/f8TlJ)" --
Development Build, Randomly Named Source Directory
bash -c "$(curl -sL https://git.io/f8TlJ)" -- -d
Development Build, Fixed Directory
If you require the source to be cloned to a specific directory for building, you can specify the root directory for cloning.