particle-os-modules/modules/script
2024-02-04 18:18:35 +02:00
..
module.yml fix: switch urls to fetch main branch in module.ymls 2024-02-04 18:18:35 +02:00
README.md refactor: start using module.yml for module metadata (#116) 2024-02-04 16:05:22 +00:00
script.sh fix: Fix flag ordering in set calls in scripts (#99) 2024-01-16 06:12:08 +00:00

script

The script module can be used to run arbitrary scripts at image build time that take no or minimal external configuration (in the form of command line arguments). The scripts, which are run from the config/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.