Skip to content

Commit 2582a90

Browse files
committed
wip: rename mold -> os
1 parent 88484d8 commit 2582a90

File tree

51 files changed

+111
-91
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+111
-91
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ jobs:
8888
export RUST_BACKTRACE=1
8989
export RUST_LOG=debug
9090
chmod +x linux-amd64/goldboot
91-
linux-amd64/goldboot init --mold Goldboot
91+
linux-amd64/goldboot init --os Goldboot
9292
linux-amd64/goldboot cast --output goldboot-linux-x86_64.gb .
9393
9494
- uses: actions/upload-artifact@v4

CONTRIBUTING.md

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ taken from the field of metallurgy.
2424

2525
An image foundry is a configuration object that knows how to build goldboot images.
2626

27-
#### Mold
27+
#### OS
2828

2929
An image mold takes an image source and refines it according to built-in rules.
3030
For example, the `ArchLinux` mold knows how to take Arch Linux install media (in
@@ -42,26 +42,25 @@ is converted into a final goldboot image (.gb).
4242

4343
#### Alloys
4444

45-
An alloy is an image made from more than one mold (also known as multi-boot).
45+
An alloy is a multi-boot image.
4646

4747
#### Fabricators
4848

4949
Operates on images at the end of the casting process. For example, the shell
5050
fabricator runs shell commands on the image which can be useful in many cases.
5151

52-
## Adding new molds
52+
## Adding new operating systems
5353

5454
If `goldboot` doesn't already support your operating system, it should be possible
5555
to add it relatively easily.
5656

57-
Start by finding a mold similar to your operating system in the `goldboot::foundry::molds`
58-
module.
57+
Start by finding an OS similar to yours in the `goldboot::foundry::os` module.
5958

6059
TODO
6160

62-
## Mold maintenance
61+
## OS maintenance
6362

64-
Molds often need constant maintenance as new upstream releases are made and old
63+
OS support often need constant maintenance as new upstream releases are made and old
6564
ones are retired. Typically this involves adding new versions and marking some
6665
as deprecated, but occasionally upstream changes may cause breakages for us.
6766

@@ -84,8 +83,5 @@ pub enum AlpineRelease {
8483
}
8584
```
8685

87-
In the future, we may designate "official maintainers" for molds that change
88-
frequently to handle the burden.
89-
9086
## Testing
9187
TODO

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -154,16 +154,16 @@ schedule against the latest version of `goldboot`.
154154

155155
| Linux | Windows | macos |
156156
| ----- | ------- | ----- |
157-
| ![Alpine](goldboot/src/foundry/molds/alpine/icon.png) ![x86_64](https://github.com/fossable/goldboot-examples/workflows/Alpine/badge.svg) | ![Windows 10](goldboot/src/foundry/molds/windows_10/icon.png) ![x86_64](https://github.com/fossable/goldboot-examples/workflows/Windows10/badge.svg) | ![macOS](goldboot/src/foundry/molds/arch_linux/mac_os.png) ![x86_64](https://github.com/fossable/goldboot-examples/workflows/Macos/badge.svg) |
158-
| ![Arch Linux](goldboot/src/foundry/molds/arch_linux/icon.png) ![x86_64](https://github.com/fossable/goldboot-examples/workflows/ArchLinux/badge.svg) | |
159-
| ![Debian](goldboot/src/foundry/molds/debian/icon.png) ![x86_64](https://github.com/fossable/goldboot-examples/workflows/Debian/badge.svg) | |
160-
| ![Pop!_OS](goldboot/src/foundry/molds/pop_os/icon.png) ![x86_64](https://github.com/fossable/goldboot-examples/workflows/Pop!_OS/badge.svg) | |
161-
| ![Steam Deck](goldboot/src/foundry/molds/steam_deck/icon.png) ![x86_64](https://github.com/fossable/goldboot-examples/workflows/SteamDeck/badge.svg) | |
162-
| ![Steam OS](goldboot/src/foundry/molds/steam_os/icon.png) ![x86_64](https://github.com/fossable/goldboot-examples/workflows/SteamOs/badge.svg) | |
157+
| ![Alpine](goldboot/src/foundry/os/alpine/icon.png) ![x86_64](https://github.com/fossable/goldboot-examples/workflows/Alpine/badge.svg) | ![Windows 10](goldboot/src/foundry/os/windows_10/icon.png) ![x86_64](https://github.com/fossable/goldboot-examples/workflows/Windows10/badge.svg) | ![macOS](goldboot/src/foundry/os/arch_linux/mac_os.png) ![x86_64](https://github.com/fossable/goldboot-examples/workflows/Macos/badge.svg) |
158+
| ![Arch Linux](goldboot/src/foundry/os/arch_linux/icon.png) ![x86_64](https://github.com/fossable/goldboot-examples/workflows/ArchLinux/badge.svg) | |
159+
| ![Debian](goldboot/src/foundry/os/debian/icon.png) ![x86_64](https://github.com/fossable/goldboot-examples/workflows/Debian/badge.svg) | |
160+
| ![Pop!_OS](goldboot/src/foundry/os/pop_os/icon.png) ![x86_64](https://github.com/fossable/goldboot-examples/workflows/Pop!_OS/badge.svg) | |
161+
| ![Steam Deck](goldboot/src/foundry/os/steam_deck/icon.png) ![x86_64](https://github.com/fossable/goldboot-examples/workflows/SteamDeck/badge.svg) | |
162+
| ![Steam OS](goldboot/src/foundry/os/steam_os/icon.png) ![x86_64](https://github.com/fossable/goldboot-examples/workflows/SteamOs/badge.svg) | |
163163

164164
## Example walkthrough
165165

166-
Let's build a basic Arch Linux ![ArchLinux](goldboot/src/foundry/molds/arch_linux/icon.png)
166+
Let's build a basic Arch Linux ![ArchLinux](goldboot/src/foundry/os/arch_linux/icon.png)
167167
image to prove we're _real_ Linux users.
168168

169169
First, create a directory to hold our configuration (which can later be tracked
@@ -178,7 +178,7 @@ Initialize the directory and choose `ArchLinux` to start with:
178178
```sh
179179
goldboot init \
180180
--name Test \
181-
--mold ArchLinux \
181+
--os ArchLinux \
182182
--size 10G \
183183
--format json
184184
```
@@ -190,7 +190,7 @@ be tweaked to suit your needs. For example:
190190
{
191191
"alloy": [
192192
{
193-
"mold": {
193+
"os": {
194194
"ArchLinux": {
195195
"hostname": "YeahIUseArch",
196196
"root_password": {

goldboot/src/cli/cmd/init.rs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ use strum::IntoEnumIterator;
88
use tracing::{error, info};
99

1010
use crate::cli::prompt::Prompt;
11-
use crate::foundry::molds::DefaultSource;
11+
use crate::foundry::os::DefaultSource;
1212
use crate::foundry::ImageElement;
13-
use crate::foundry::{molds::ImageMold, Foundry, FoundryConfigPath};
13+
use crate::foundry::{os::Os, Foundry, FoundryConfigPath};
1414

1515
fn print_banner() {
1616
if console::colors_enabled() {
@@ -28,7 +28,7 @@ pub fn run(cmd: super::Commands) -> ExitCode {
2828
match cmd {
2929
super::Commands::Init {
3030
name,
31-
mold,
31+
os,
3232
format,
3333
size,
3434
mimic_hardware: _,
@@ -43,8 +43,8 @@ pub fn run(cmd: super::Commands) -> ExitCode {
4343
foundry.size = size;
4444
}
4545

46-
if mold.len() > 0 {
47-
// If a mold name was given, use the default
46+
if os.len() > 0 {
47+
// If an OS was given, use the default
4848
if let Some(name) = name {
4949
foundry.name = name;
5050
} else {
@@ -54,11 +54,11 @@ pub fn run(cmd: super::Commands) -> ExitCode {
5454
}
5555
}
5656

57-
for m in mold {
57+
for m in os {
5858
if let Ok(source) = m.default_source(foundry.arch) {
5959
foundry.alloy.push(ImageElement {
6060
source,
61-
mold: m,
61+
os: m,
6262
fabricators: None,
6363
pref_size: None,
6464
});
@@ -70,7 +70,7 @@ pub fn run(cmd: super::Commands) -> ExitCode {
7070
// Generate QEMU flags for this hardware
7171
//config.qemuargs = generate_qemuargs()?;
7272
} else {
73-
// If no mold was given, begin interactive config
73+
// If no OS was given, begin interactive config
7474
print_banner();
7575

7676
let theme = ColorfulTheme {
@@ -136,44 +136,44 @@ pub fn run(cmd: super::Commands) -> ExitCode {
136136
foundry.arch = architectures[choice_index];
137137
}
138138

139-
// Prompt mold
139+
// Prompt OS
140140
loop {
141-
// Find molds suitable for the architecture
142-
let mut molds: Vec<ImageMold> = ImageMold::iter()
143-
.filter(|mold| mold.architectures().contains(&foundry.arch))
144-
.filter(|mold| foundry.alloy.len() == 0 || mold.alloy())
141+
// Find operating systems suitable for the architecture
142+
let mut supported_os: Vec<Os> = Os::iter()
143+
.filter(|os| os.architectures().contains(&foundry.arch))
144+
.filter(|os| foundry.alloy.len() == 0 || os.alloy())
145145
.collect();
146146

147147
let choice_index = Select::with_theme(&theme)
148-
.with_prompt("Image mold?")
149-
.items(&molds)
148+
.with_prompt("Operating system?")
149+
.items(&supported_os)
150150
.interact()
151151
.unwrap();
152152

153-
let mold = &mut molds[choice_index];
153+
let os = &mut supported_os[choice_index];
154154

155155
if Confirm::with_theme(&theme)
156-
.with_prompt("Edit mold configuration?")
156+
.with_prompt("Edit OS configuration?")
157157
.interact()
158158
.unwrap()
159159
{
160160
// TODO show some kind of banner
161-
mold.prompt(&foundry, Box::new(ColorfulTheme::default()))
161+
os.prompt(&foundry, Box::new(ColorfulTheme::default()))
162162
.unwrap();
163163
}
164164

165-
if let Ok(source) = mold.default_source(foundry.arch) {
165+
if let Ok(source) = os.default_source(foundry.arch) {
166166
foundry.alloy.push(ImageElement {
167167
source,
168-
mold: mold.to_owned(),
168+
os: os.to_owned(),
169169
fabricators: None,
170170
pref_size: None,
171171
});
172172
} else {
173173
return ExitCode::FAILURE;
174174
}
175175

176-
if !mold.alloy()
176+
if !os.alloy()
177177
|| !Confirm::with_theme(&theme)
178178
.with_prompt("Create an alloy image (multiboot)?")
179179
.interact()

goldboot/src/cli/cmd/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::foundry::{molds::ImageMold, FoundryConfigPath};
1+
use crate::foundry::{os::Os, FoundryConfigPath};
22

33
pub mod cast;
44
pub mod deploy;
@@ -67,9 +67,9 @@ pub enum Commands {
6767
#[clap(long)]
6868
name: Option<String>,
6969

70-
/// Base mold(s)
70+
/// Base operating system(s)
7171
#[clap(long, value_enum)]
72-
mold: Vec<ImageMold>,
72+
os: Vec<Os>,
7373

7474
#[clap(long, default_value_t, value_enum)]
7575
format: FoundryConfigPath,

goldboot/src/cli/prompt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use enum_dispatch::enum_dispatch;
55
use crate::foundry::Foundry;
66

77
/// Prompt the user for additional information on the command line.
8-
#[enum_dispatch(ImageMold)]
8+
#[enum_dispatch(Os)]
99
pub trait Prompt {
1010
fn prompt(&mut self, foundry: &Foundry, theme: Box<dyn Theme>) -> Result<()>;
1111
}

goldboot/src/foundry/fabricators/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ pub mod exe;
1313
pub mod shell;
1414

1515
/// A `Fabricator` performs some custom operation on an image at the very end of
16-
/// the casting process. When the various options in a `Mold` are not sufficient,
17-
/// fabricators can be used to compensate.
16+
/// the casting process.
1817
#[enum_dispatch(Fabricator)]
1918
pub trait Fabricate {
2019
fn run(&self, ssh: &mut SshConnection) -> Result<()>;

goldboot/src/foundry/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use self::qemu::{detect_accel, Accel};
2-
use self::{fabricators::Fabricator, molds::ImageMold, sources::ImageSource};
3-
use crate::foundry::molds::CastImage;
2+
use self::{fabricators::Fabricator, os::Os, sources::ImageSource};
3+
use crate::foundry::os::CastImage;
44
use crate::{cli::progress::ProgressBar, library::ImageLibrary};
55

66
use anyhow::Result;
@@ -24,8 +24,8 @@ use validator::Validate;
2424

2525
pub mod fabricators;
2626
pub mod http;
27-
pub mod molds;
2827
pub mod options;
28+
pub mod os;
2929
pub mod ovmf;
3030
pub mod qemu;
3131
pub mod sources;
@@ -36,7 +36,7 @@ pub mod vnc;
3636
#[derive(Clone, Serialize, Deserialize, Validate, Default, Debug)]
3737
pub struct ImageElement {
3838
pub fabricators: Option<Vec<Fabricator>>,
39-
pub mold: ImageMold,
39+
pub os: Os,
4040
#[serde(skip_serializing_if = "Option::is_none")]
4141
pub pref_size: Option<String>,
4242
pub source: ImageSource,
@@ -113,7 +113,7 @@ pub struct Foundry {
113113

114114
/// Handles more sophisticated validation of a [`Foundry`].
115115
pub fn custom_foundry_validator(_f: &Foundry) -> Result<(), validator::ValidationError> {
116-
// If there's more than one mold, they must all support alloy
116+
// If there's more than one OS, they must all support alloy
117117
// if f.alloy.len() > 1 {
118118
// for template in &self.config.templates {
119119
// //if !template.is_multiboot() {
@@ -282,7 +282,7 @@ impl FoundryWorker {
282282
self.start_time = Some(SystemTime::now());
283283
Qcow3::create(&self.qcow_path, self.qcow_size)?;
284284

285-
self.element.mold.cast(&self)?;
285+
self.element.os.cast(&self)?;
286286
info!(
287287
duration = ?self.start_time.unwrap().elapsed()?,
288288
"Build completed",

goldboot/src/foundry/options/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
//! This module contains common configuration options available to image molds.
2-
31
pub mod hostname;
42
pub mod luks;
53
pub mod timezone;
File renamed without changes.

0 commit comments

Comments
 (0)