Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
7 changes: 5 additions & 2 deletions scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,15 @@ Syntax: ./build.sh [start_cmd] [-] [end_cmd]

## How to Customize

1. Copy the `default_config.sh` file to `config.sh` in the scripts directory.
1. Copy the `chroot_files/default_config.sh` file to `chroot_files/config.sh` in the scripts directory.
2. Make any necessary edits there, the script will pick up `config.sh` over `default_config.sh`.
3. If you need to copy some files to the chroot environment, you can put them in `chroot_files` directory
and retrieve these files in `/root` directory inside the chroot (the files will be purged after the chroot
script was executed).

## How to Update

The configuration script is versioned with the variable CONFIG_FILE_VERSION. Any time that the configuration
format is changed in `default_config.sh`, this value is bumped. Once this happens `config.sh` must be updated manually
from the default file to ensure the new/changed variables are as desired. Once the merge is complete the `config.sh` file's
CONFIG_FILE_VERSION should match the default and the build will run.
CONFIG_FILE_VERSION should match the default and the build will run.
24 changes: 10 additions & 14 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ function check_host() {

# Load configuration values from file
function load_config() {
if [[ -f "$SCRIPT_DIR/config.sh" ]]; then
. "$SCRIPT_DIR/config.sh"
elif [[ -f "$SCRIPT_DIR/default_config.sh" ]]; then
if [[ -f "$SCRIPT_DIR/chroot_files/config.sh" ]]; then
. "$SCRIPT_DIR/chroot_files/config.sh"
elif [[ -f "$SCRIPT_DIR/chroot_files/default_config.sh" ]]; then
. "$SCRIPT_DIR/default_config.sh"
else
>&2 echo "Unable to find default config file $SCRIPT_DIR/default_config.sh, aborting."
>&2 echo "Unable to find default config file $SCRIPT_DIR/chroot_files/default_config.sh, aborting."
exit 1
fi
}
Expand Down Expand Up @@ -114,21 +114,17 @@ function run_chroot() {
chroot_enter_setup

# Setup build scripts in chroot environment
sudo ln -f $SCRIPT_DIR/chroot_build.sh chroot/root/chroot_build.sh
sudo ln -f $SCRIPT_DIR/default_config.sh chroot/root/default_config.sh
if [[ -f "$SCRIPT_DIR/config.sh" ]]; then
sudo ln -f $SCRIPT_DIR/config.sh chroot/root/config.sh
fi
for i in $(ls $SCRIPT_DIR/chroot_files -1); do
sudo ln -f $SCRIPT_DIR/chroot_files/$i chroot/root/$i
done

# Launch into chroot environment to build install image.
sudo chroot chroot /root/chroot_build.sh -

# Cleanup after image changes
sudo rm -f chroot/root/chroot_build.sh
sudo rm -f chroot/root/default_config.sh
if [[ -f "chroot/root/config.sh" ]]; then
sudo rm -f chroot/root/config.sh
fi
for i in $(ls $SCRIPT_DIR/chroot_files -1); do
sudo rm -f chroot/root/$i
done

chroot_exit_teardown
}
Expand Down
File renamed without changes.
File renamed without changes.