particle-os-modules/modules/script
2025-01-31 18:28:33 -05:00
..
module.yml chore: remove raw github URLs from module.ymls (unneeded after recent refactor) 2024-07-26 16:02:32 +03:00
README.md docs: Update documentation to reflect change from config/ to files/ (#283) 2024-07-21 19:21:28 +00:00
script.sh chore: Remove usage of yq in favor of jq (#369) 2024-12-02 19:02:13 +00:00
script.tsp fix: Separate models required for separate schema files 2025-01-31 18:28:33 -05:00

script

The script module can be used to run arbitrary bash snippets and scripts at image build time. This is intended for running commands that need no YAML configuration.

The snippets, which are run in a bash subshell, are declared under snippets:.
The scripts, which are run from the files/scripts/ directory, are declared under scripts:.

Creating a Script

Look at example.sh for an example shell script. You can rename and copy the file for your own purposes. In order for the script to be executed, declare it in the recipe

When creating a script, please make sure

  • ...its filename ends with .sh.
    • This follows convention for (especially bash) shell scripts.
  • ...it starts with a shebang like #!/usr/bin/env bash.
    • This ensures the script is ran with the correct interpreter / shell.
  • ...it contains the command set -euo pipefail right after the shebang.
    • This will make the image build fail if your script fails. If you do not care if your script works or not, you can omit this line.