diff --git a/backend/src/sound.rs b/backend/src/sound.rs index 5c0905056..b10612001 100644 --- a/backend/src/sound.rs +++ b/backend/src/sound.rs @@ -1,6 +1,6 @@ use std::cmp::Ordering; use std::path::Path; -use std::time::Duration; +use std::time::{Duration, Instant}; use divrem::DivRem; use proptest_derive::Arbitrary; @@ -37,6 +37,10 @@ impl SoundInterface { } }) .with_ctx(|_| (ErrorKind::SoundError, EXPORT_FILE.to_string_lossy()))?; + let instant = Instant::now(); + while tokio::fs::metadata(&*PERIOD_FILE).await.is_err() + && instant.elapsed() < Duration::from_secs(1) + {} Ok(SoundInterface(Some(guard))) } #[instrument(skip(self))] diff --git a/backend/src/update/mod.rs b/backend/src/update/mod.rs index 33dc0c4ec..44f6952f8 100644 --- a/backend/src/update/mod.rs +++ b/backend/src/update/mod.rs @@ -1,5 +1,5 @@ use std::future::Future; -use std::path::{Path, PathBuf}; +use std::path::Path; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc; use std::time::Duration; @@ -10,7 +10,7 @@ use digest::Digest; use emver::Version; use futures::Stream; use lazy_static::lazy_static; -use patch_db::{DbHandle, Revision}; +use patch_db::{DbHandle, LockType, Revision}; use regex::Regex; use reqwest::Url; use rpc_toolkit::command; @@ -25,7 +25,7 @@ use tracing::instrument; use crate::context::RpcContext; use crate::db::model::{ServerStatus, UpdateProgress}; use crate::db::util::WithRevision; -use crate::disk::mount::filesystem::label::Label; +use crate::disk::mount::filesystem::block_dev::BlockDev; use crate::disk::mount::filesystem::FileSystem; use crate::disk::mount::guard::TmpMountGuard; use crate::disk::BOOT_RW_PATH; @@ -98,11 +98,14 @@ impl WritableDrives { Self::Blue => "blue", } } - fn block_dev(&self) -> PathBuf { - Path::new("/dev/disk/by-label").join(self.label()) + fn block_dev(&self) -> &'static Path { + Path::new(match self { + Self::Green => "/dev/mmcblk0p3", + Self::Blue => "/dev/mmcblk0p4", + }) } fn as_fs(&self) -> impl FileSystem { - Label::new(self.label()) + BlockDev::new(self.block_dev()) } } @@ -132,6 +135,10 @@ async fn maybe_do_update(ctx: RpcContext) -> Result>, Error .await .with_kind(ErrorKind::Network)? .version; + crate::db::DatabaseModel::new() + .server_info() + .lock(&mut db, LockType::Write) + .await?; let current_version = crate::db::DatabaseModel::new() .server_info() .version() diff --git a/build/rip-image.sh b/build/rip-image.sh index a2d74a404..f18957df6 100755 --- a/build/rip-image.sh +++ b/build/rip-image.sh @@ -93,3 +93,6 @@ if ! [[ "$(cat $INPUT_HASH)" == "$(cat $OUTPUT_HASH)" ]]; then fi rm $INPUT_HASH $OUTPUT_HASH echo "Verification Succeeded" + +sudo e2label update.img red +echo "Image Relabeled to \"red\""