• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

agama-project / agama / 11403686465

18 Oct 2024 12:27PM UTC coverage: 71.629% (-0.2%) from 71.821%
11403686465

push

github

web-flow
feat: add support to run pre/post scripts (#1673)

This is the first implementation of pre/post-installation scripts. They
are not as capable as their AutoYaST counterparts, but the idea is to
evolve them in the future.

## Specifying a script

> [!WARNING]
> JSON does not support multiline values (a.k.a. blocks) but Jsonnet
does it. Perhaps we should consider using Jsonnet in the `agama config
edit` command.

```jsonnet
{
  scripts: {
    pre: [
      {
         name: "say-hi",
         body: |||
           #!/bin/bash
           echo "before starting the installation"
         |||
      }
    ]
  }
}
```

> [!NOTE]
> What about having a plain list where each script has a `type` (or
`group`) like `pre`, `post`, etc.?

## When scripts get executed

* Pre-scripts: when loading a profile. We plan to do [some
improvements](https://trello.com/c/PiOGzXSn/584-agama-running-pre-scripts-in-the-right-place)
to support the single-product case properly.
* Post-scripts: after the installation.

## Implementation details

The scripting support is written in Rust and does not use the YaST
scripts code anymore. We will rewrite the Manager in Rust (at least the
Agama-specific part) in the future, and the scripting support will be
part of that.

## Future

Agama scripts will gain additional features soon:

* Running in a `chroot`.
* Better error handling if the shebang line is not present.
* Running after the first boot.

## Pending tasks

- [x] Extend the JSON schema
- [x] Copy the resulting files to the installed system
- [x] Add some logging
- [x] Clean-up the old scripts when reloading a profile

73 of 148 new or added lines in 11 files covered. (49.32%)

4 existing lines in 3 files now uncovered.

16873 of 23556 relevant lines covered (71.63%)

34.93 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/rust/agama-server/src/scripts/web.rs


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc