Created
October 16, 2025 12:51
-
-
Save planetis-m/f60e50954a1eb00d4bea21f1f9d446a0 to your computer and use it in GitHub Desktop.
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 | |
| # Custom toolbox container for ESP-IDF development | |
| # From: https://discussion.fedoraproject.org/t/creating-toolbx-with-custom-settings/37067 | |
| # Configuration | |
| toolbox_name="esp-42-dev" | |
| toolbox_hostname="esp-dev" | |
| toolbox_home=$HOME | |
| toolbox_user=$USER | |
| toolbox_shell=$SHELL | |
| UID=$(id -u) | |
| GID=$(id -g) | |
| # Base image | |
| base_image="registry.fedoraproject.org/fedora-toolbox:42" | |
| # Container arguments - based on standard toolbox but with ESP additions | |
| args=( | |
| --name $toolbox_name | |
| --hostname $toolbox_hostname | |
| --cgroupns host | |
| --dns none | |
| --env TOOLBOX_PATH=/usr/bin/toolbox | |
| --env XDG_RUNTIME_DIR=/run/user/$UID | |
| --ipc host | |
| --label com.github.containers.toolbox=true | |
| --mount type=devpts,destination=/dev/pts | |
| --network host | |
| --no-hosts | |
| --pid host | |
| --privileged | |
| --security-opt label=disable | |
| --ulimit host | |
| --userns keep-id | |
| --user root:root | |
| --volume /:/run/host:rslave | |
| --volume /dev:/dev:rslave | |
| --volume /run/dbus/system_bus_socket:/run/dbus/system_bus_socket | |
| --volume $toolbox_home:$toolbox_home:rslave | |
| --volume /usr/bin/toolbox:/usr/bin/toolbox:ro | |
| --volume /run/user/$UID:/run/user/$UID | |
| --volume /run/avahi-daemon/socket:/run/avahi-daemon/socket | |
| --volume /run/.heim_org.h5l.kcm-socket:/run/.heim_org.h5l.kcm-socket | |
| --volume /media:/media:rslave | |
| --volume /mnt:/mnt:rslave | |
| --volume /run/pcscd/pcscd.comm:/run/pcscd/pcscd.comm | |
| --volume /run/media:/run/media:rslave | |
| --volume /etc/profile.d/toolbox.sh:/etc/profile.d/toolbox.sh:ro | |
| # ESP-IDF specific additions | |
| --device /dev/ttyACM0 | |
| --volume /run/udev:/run/udev:ro | |
| --volume /etc/group:/etc/group:ro | |
| --group-add keep-groups | |
| ) | |
| # Create the container | |
| toolbox_create_command=( | |
| podman | |
| --log-level error | |
| create ${args[@]} | |
| $base_image | |
| toolbox | |
| --log-level debug | |
| init-container | |
| --home $toolbox_home | |
| --shell $toolbox_shell | |
| --user $toolbox_user | |
| --uid $UID | |
| --gid $GID | |
| ) | |
| # Execute the creation command | |
| echo "Creating ESP toolbox container..." | |
| "${toolbox_create_command[@]}" | |
| echo "ESP toolbox container created!" | |
| echo "Enter with: toolbox enter esp-42-dev" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment