Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add buildroot arguments #146

Merged
merged 1 commit into from
Mar 9, 2025
Merged
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
39 changes: 37 additions & 2 deletions buildroot.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,40 @@
#!/bin/bash

docker-compose pull
docker-compose run --rm buildroot
POSITIONAL_ARGS=()
CONTAINER_NAME="buildroot"

print_help () {
echo "Buildroot help..."
echo " -h --help Displays this help message"
echo " -l --latest Displays this help message"
}

for var in "$@"
do
case $1 in
-h|--help)
print_help
exit 0
;;
-l|--latest)
echo "Running latest version of buildroot"
CONTAINER_NAME+="-latest"
;;
-*|--*) # catch any unknown args and exit
echo "Unknown option $1"
print_help
exit 1
;;
*)
POSITIONAL_ARGS+=("$1") # save positional arg
shift # past argument
;;
esac
done

set -- "${POSITIONAL_ARGS[@]}" # restore positional parameters
# one day we can do things here with positional args or params
# for now, just always start the container
docker-compose pull $CONTAINER_NAME
docker-compose up -d
docker-compose run --rm $CONTAINER_NAME
5 changes: 4 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
services:
buildroot:
buildroot: &buildroot
image: ghcr.io/concordia-fsae/containers/ubuntu-noble-lts:v1.0.0
container_name: buildroot
hostname: builder
Expand All @@ -12,3 +12,6 @@ services:
devices:
# map host's usb buses to container's buses for st-link programmer
- "/dev/bus/usb/:/dev/bus/usb/"
buildroot-latest:
<<: *buildroot
image: ghcr.io/concordia-fsae/containers/ubuntu-noble-lts:latest