particle-os-modules/modules/script
fiftydinar 189048b119
chore: Remove usage of yq in favor of jq (#369)
* chore: Remove usage of `yq` in favor of `jq`

* fix: Missed bracket in `default-flatpaks`

* fix: `get_json_array` complaining about unpopulated arrays

* fix(files): Forgot to input `-r` flag for some `jq` calls

* fix(gschema-overrides): Use `try` in `get_json_array`

* chore(default-flatpaks): Replace `yq` with `jq` in run-time setup binaries

* chore: Switch to simplified `jq` syntax without brackets

* chore(default-flatpaks): Switch `repo-info` file from `yml` to `json`

* fix(default-flatpaks): Some `yq` calls

* chore: Revert back to bracket syntax for more reliable `jq` parsing

* chore(files): Missed bracket syntax

* chore: Approve bot suggestion about quoting

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update modules/files/files.sh

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* fix(yafti): Populating custom flatpaks

It's populated in reverse order compared to the format in recipe, but it works

* fix(fonts): Variable substitution is needed

* fix: Typo

* fix(fonts): Forgot to assign FONTS variable

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-12-02 19:02:13 +00: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 feat: add typespec schemas for modules (#233) 2024-07-09 16:25:31 +00: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.