Skip to content
This repository has been archived by the owner on Nov 20, 2023. It is now read-only.

Commit

Permalink
docs: fix: clarity and grammar updates for scripts docs
Browse files Browse the repository at this point in the history
  • Loading branch information
xynydev authored May 11, 2023
1 parent 8ee9967 commit 2fb860e
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@

You can add custom scripts to this directory and declare them to be run at build time in the `scripts:` section of `recipe.yml`. Custom scripts can be run at either the `pre:` execution phase right after the custom repositories are added, or at the `post:` phase after all of the automatic build steps.

Your scripts will be given exactly one argument when they are executed, which specifies its precise execution phase (`pre` or `post`). The primary purpose of this argument is to streamline the reuse of scripts for multiple stages. This behavior is mirrored both in manually declared scripts and scripts ran by `autorun.sh`.
Your scripts will be given exactly one argument when they are executed, which specifies its precise execution phase (`pre` or `post`). The primary purpose of this argument is to streamline the reuse of scripts for multiple stages. This argument is provided for both manually declared scripts and scripts ran by `autorun.sh`.

## 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, either move it to `scripts/pre/` or `scripts/post/` (if using `autorun.sh`) or declare it in the `recipe.yml`.

All commands from programs installed as rpms should be available when running the script at the `post` execution phase.
All commands from RPMs you've declared in the `recipe.yml` should be available when running scripts at the `post` execution phase.

When creating a script from make sure
When creating a script, please make sure

- its filename ends with `.sh`
- Follows convention for (especially bash) shell scripts
- `autorun.sh` only executes files that match `*.sh`
- it starts with a [shebang](<https://en.wikipedia.org/wiki/Shebang_(Unix)>) like `#!/usr/bin/env bash`
- Ensures the script is ran with the correct interpreter / shell
- it contains the command `set -oue pipefail` near the start
- ...its filename ends with `.sh`.
- This follows convention for (especially bash) shell scripts.
- `autorun.sh` only executes files that match `*.sh`.
- ...it starts with a [shebang](<https://en.wikipedia.org/wiki/Shebang_(Unix)>) like `#!/usr/bin/env bash`.
- This ensures the script is ran with the correct interpreter / shell.
- ...it contains the command `set -oue pipefail` near the start.
- 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.

## `autorun.sh`
Expand Down

0 comments on commit 2fb860e

Please sign in to comment.