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

agama-project / agama / 12087749792

29 Nov 2024 04:05PM UTC coverage: 70.981% (-0.05%) from 71.031%
12087749792

push

github

web-flow
feat(rust): run postscripts in a chroot (#1792)

## Problem

https://trello.com/c/I8bWv2ZR

The current scripting support does not allow using [AutoYaST chroot-like
scripts](https://doc.opensuse.org/projects/autoyast/#chroot-scripts).
For instance, if you want to enable a system service at the end of the
installation, you need to deal with the chroot yourself.

## Solution

This change extends the post-scripts to run on a chroot on the target
system. A definition like the following will enable the sshd daemon at
the end of the installation:

```jsonnet
scripts: {
  post: [
    { name: 'test', body: '#!/bin/bash\nsystemctl enable sshd', chroot: true },
  ],
}
```

Now, chroot-ed postscripts are the default. Since you most likely want
to run postscripts on a chroot, we are supporting `chroot: false` for
backward compatibility reasons.

## Refactoring

The PR contains a heavy refactoring of the scripts model. Now, we are
using an enum-based approach that makes it easier to cope with the
potential differences between script types, given that not all are
equal. We followed that approach in the network area and it worked quite
well.

By now, the only difference is the `chroot` attribute. However, in the
future, we expect that prescripts and postscripts will get support for
additional features, like progress reporting, that will not be available
for init scripts.

## Testing

- *Tested manually*

41 of 94 new or added lines in 4 files covered. (43.62%)

16953 of 23884 relevant lines covered (70.98%)

35.96 hits per line

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

57.89
/rust/agama-lib/src/scripts/model.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