-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Showing
24 changed files
with
997 additions
and
58 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright (c) [2024] SUSE LLC | ||
// | ||
// All Rights Reserved. | ||
// | ||
// This program is free software; you can redistribute it and/or modify it | ||
// under the terms of the GNU General Public License as published by the Free | ||
// Software Foundation; either version 2 of the License, or (at your option) | ||
// any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, but WITHOUT | ||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
// more details. | ||
// | ||
// You should have received a copy of the GNU General Public License along | ||
// with this program; if not, contact SUSE LLC. | ||
// | ||
// To contact SUSE LLC about this file by physical or electronic mail, you may | ||
// find current contact information at www.suse.com. | ||
|
||
//! Implements support for handling the user-defined scripts. | ||
|
||
mod client; | ||
mod error; | ||
mod model; | ||
mod settings; | ||
mod store; | ||
|
||
pub use error::ScriptError; | ||
pub use model::*; | ||
pub use settings::*; | ||
pub use store::ScriptsStore; |
Oops, something went wrong.