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
5 changes: 4 additions & 1 deletion scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@ Syntax: ./build.sh [start_cmd] [-] [end_cmd]

1. Copy the `default_config.sh` file to `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`. The directories
tree inside `chroot_files` will be reproduced inside chroot (files inside `chroot_files/tmp` will be cleanup).
/!\ `chroot_files/tmp` unix right's should be 1777

## 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.
26 changes: 15 additions & 11 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function check_host() {

# Load configuration values from file
function load_config() {
if [[ -f "$SCRIPT_DIR/config.sh" ]]; then
if [[ -f "$SCRIPT_DIR/config.sh" ]]; then
. "$SCRIPT_DIR/config.sh"
elif [[ -f "$SCRIPT_DIR/default_config.sh" ]]; then
. "$SCRIPT_DIR/default_config.sh"
Expand Down Expand Up @@ -114,21 +114,25 @@ 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
sudo ln -f $SCRIPT_DIR/default_config.sh chroot/tmp/default_config.sh
if [[ -f "$SCRIPT_DIR/config.sh" ]]; then
sudo ln -f $SCRIPT_DIR/config.sh chroot/root/config.sh
fi
sudo ln -f $SCRIPT_DIR/config.sh chroot/tmp/config.sh
fi

# Build chroot_files archive and extract it into chroot directory
tar -czf chroot_files.tar.gz -C chroot_files .
sudo tar --owner root --group root -C chroot -xzf chroot_files.tar.gz
# For an unknown reason tar change chroot ownership so we need this little hack
sudo chown root:root chroot
rm -f chroot_files.tar.gz

# Launch into chroot environment to build install image.
sudo chroot chroot /root/chroot_build.sh -
sudo chroot chroot /tmp/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 chroot/tmp/ -1); do
sudo rm -f chroot/tmp/$i
done

chroot_exit_teardown
}
Expand Down
File renamed without changes.