switch base os to raspberry pi os

minor fixes

more robust
This commit is contained in:
Aiden McClelland
2022-02-05 00:44:01 -07:00
parent 066b974ca6
commit 79e4c6880a
11 changed files with 59 additions and 36 deletions

View File

@@ -57,7 +57,7 @@ pub async fn init(cfg: &RpcContextConfig, product_key: &str) -> Result<(), Error
.await?;
tracing::info!("Mounted Docker Data");
if should_rebuild {
if should_rebuild || !tmp_docker_exists {
tracing::info!("Loading System Docker Images");
crate::install::load_images("/var/lib/embassy/system-images").await?;
tracing::info!("Loaded System Docker Images");

View File

@@ -104,6 +104,12 @@ impl WritableDrives {
Self::Blue => "/dev/mmcblk0p4",
})
}
fn part_uuid(&self) -> &'static str {
match self {
Self::Green => "cb15ae4d-03",
Self::Blue => "cb15ae4d-04",
}
}
fn as_fs(&self) -> impl FileSystem {
BlockDev::new(self.block_dev())
}
@@ -391,17 +397,22 @@ async fn swap_boot_label(new_label: NewLabel) -> Result<(), Error> {
.invoke(crate::ErrorKind::BlockDevice)
.await?;
let mounted = TmpMountGuard::mount(&new_label.0.as_fs()).await?;
let sedcmd = format!("s/LABEL=\\(blue\\|green\\)/LABEL={}/g", new_label.0.label());
Command::new("sed")
.arg("-i")
.arg(&sedcmd)
.arg(&format!(
"s/LABEL=\\(blue\\|green\\)/LABEL={}/g",
new_label.0.label()
))
.arg(mounted.as_ref().join("etc/fstab"))
.output()
.await?;
mounted.unmount().await?;
Command::new("sed")
.arg("-i")
.arg(&sedcmd)
.arg(&format!(
"s/PARTUUID=cb15ae4d-\\(03\\|04\\)/PARTUUID={}/g",
new_label.0.part_uuid()
))
.arg(Path::new(BOOT_RW_PATH).join("cmdline.txt"))
.output()
.await?;