-
Notifications
You must be signed in to change notification settings - Fork 0
Blueprints Scripts
The Scripts blueprint allows you to execute scripts as part of the configuration process in Rinse, Wash, Repeat (RWR). This blueprint is useful for running custom scripts, setting up environment-specific configurations, or performing any additional tasks that are not covered by other blueprint types.
The Scripts blueprint follows the same structure as other blueprints in RWR. It can be defined in YAML, JSON, or TOML format.
scripts:
- name: example_script
description: "An example script"
source: scripts/example.sh
action: run
elevated: true
- name: another_script
description: "Another example script"
content: |
#!/bin/bash
echo "Hello, World!"
action: run
{
"scripts": [
{
"name": "example_script",
"description": "An example script",
"source": "scripts/example.sh",
"action": "run",
"elevated": true
},
{
"name": "another_script",
"description": "Another example script",
"content": "#!/bin/bash\necho \"Hello, World!\"",
"action": "run"
}
]
}
The Scripts blueprint supports the following fields:
Field | Required | Description |
---|---|---|
|
Yes |
The name of the script. |
|
No |
A description of the script. |
|
No |
The path to the script file. |
|
No |
The inline content of the script. |
|
Yes |
The action to perform with the script. Currently, only |
|
No |
Whether to run the script with elevated privileges. Default is |
Note
|
Either the source or content field must be provided. If both are present, source takes precedence.
|
When the Scripts blueprint is processed, RWR will execute the specified scripts in the order they are defined. The scripts can be provided either as separate files using the source
field or as inline content using the content
field.
RWR supports executing scripts written in various languages, such as Bash, Python, Ruby, and more. The appropriate interpreter will be used based on the shebang line (!/bin/bash
, !/usr/bin/env python
, etc.) or file extension.
If the elevated
field is set to true
, the script will be executed with elevated privileges (e.g., using sudo
on Unix-like systems).
-
Keep your scripts concise and focused on specific tasks.
-
Use descriptive names for your scripts to make their purpose clear.
-
Provide a shebang line at the beginning of your scripts to specify the interpreter.
-
Use the
elevated
field sparingly and only when necessary. -
Consider using variables and templating to make your scripts more dynamic and reusable.
-
Test your scripts thoroughly before including them in your RWR configuration.
If you encounter issues with the Scripts blueprint, consider the following:
-
Ensure that the script files specified in the
source
field exist and have the correct permissions. -
Verify that the required interpreters or dependencies for your scripts are installed on the target system.
-
Check the RWR logs for any error messages or output related to script execution.
-
Use the
--debug
flag when running RWR to enable verbose output and gather more information.
If you need further assistance, please refer to the Troubleshooting section or reach out to the RWR community for support.