mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 20:14:49 +00:00
misc fixes
This commit is contained in:
committed by
Aiden McClelland
parent
73d7d3f855
commit
ccf505d0d3
@@ -48,6 +48,13 @@ async fn init(cfg_path: Option<&str>) -> Result<(), Error> {
|
|||||||
false,
|
false,
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
// cp -r "/var/lib/docker", "/tmp/docker-data"
|
||||||
|
embassy::disk::util::bind(
|
||||||
|
"/tmp/docker-data",
|
||||||
|
"/var/lib/journal",
|
||||||
|
false,
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
embassy::ssh::sync_keys_from_db(todo!(), "/root/.ssh/authorized_keys").await?;
|
embassy::ssh::sync_keys_from_db(todo!(), "/root/.ssh/authorized_keys").await?;
|
||||||
todo!("sync wifi");
|
todo!("sync wifi");
|
||||||
embassy::hostname::sync_hostname().await?;
|
embassy::hostname::sync_hostname().await?;
|
||||||
@@ -92,8 +99,6 @@ async fn inner_main(cfg_path: Option<&str>) -> Result<(), Error> {
|
|||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
.with_kind(embassy::ErrorKind::Network)?;
|
.with_kind(embassy::ErrorKind::Network)?;
|
||||||
} else {
|
|
||||||
embassy::sound::MARIO_COIN.play().await?;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
@@ -200,6 +200,8 @@ async fn inner_main(cfg_path: Option<&str>) -> Result<Option<Shutdown>, Error> {
|
|||||||
rpc_ctx.shutdown.subscribe(),
|
rpc_ctx.shutdown.subscribe(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
embassy::sound::MARIO_COIN.play().await?;
|
||||||
|
|
||||||
futures::try_join!(
|
futures::try_join!(
|
||||||
server.map_err(|e| Error::new(e, ErrorKind::Network)),
|
server.map_err(|e| Error::new(e, ErrorKind::Network)),
|
||||||
revision_cache_task.map_err(|e| Error::new(
|
revision_cache_task.map_err(|e| Error::new(
|
||||||
|
|||||||
@@ -61,9 +61,10 @@ impl RpcContextConfig {
|
|||||||
.unwrap_or_else(|| Cow::Owned(Path::new("/").join(self.zfs_pool_name())))
|
.unwrap_or_else(|| Cow::Owned(Path::new("/").join(self.zfs_pool_name())))
|
||||||
}
|
}
|
||||||
pub async fn db(&self) -> Result<PatchDb, Error> {
|
pub async fn db(&self) -> Result<PatchDb, Error> {
|
||||||
PatchDb::open(self.datadir().join("main").join("embassy.db"))
|
let db_path = self.datadir().join("main").join("embassy.db");
|
||||||
|
PatchDb::open(&db_path)
|
||||||
.await
|
.await
|
||||||
.map_err(Error::from)
|
.with_ctx(|_| (crate::ErrorKind::Filesystem, db_path.display().to_string()))
|
||||||
}
|
}
|
||||||
pub async fn secret_store(&self) -> Result<SqlitePool, Error> {
|
pub async fn secret_store(&self) -> Result<SqlitePool, Error> {
|
||||||
let secret_store_url = format!(
|
let secret_store_url = format!(
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ pub async fn create_fs(cfg: &RpcContextConfig) -> Result<(), Error> {
|
|||||||
.arg("-o")
|
.arg("-o")
|
||||||
.arg("keylocation=file:///etc/embassy/password")
|
.arg("keylocation=file:///etc/embassy/password")
|
||||||
.arg("-o")
|
.arg("-o")
|
||||||
.arg("keyformat=password")
|
.arg("keyformat=passphrase")
|
||||||
.arg(format!("{}/main", cfg.zfs_pool_name()))
|
.arg(format!("{}/main", cfg.zfs_pool_name()))
|
||||||
.invoke(crate::ErrorKind::Zfs)
|
.invoke(crate::ErrorKind::Zfs)
|
||||||
.await?;
|
.await?;
|
||||||
@@ -62,7 +62,7 @@ pub async fn create_fs(cfg: &RpcContextConfig) -> Result<(), Error> {
|
|||||||
.arg("-o")
|
.arg("-o")
|
||||||
.arg("keylocation=file:///etc/embassy/password")
|
.arg("keylocation=file:///etc/embassy/password")
|
||||||
.arg("-o")
|
.arg("-o")
|
||||||
.arg("keyformat=password")
|
.arg("keyformat=passphrase")
|
||||||
.arg(format!("{}/package-data", cfg.zfs_pool_name()))
|
.arg(format!("{}/package-data", cfg.zfs_pool_name()))
|
||||||
.invoke(crate::ErrorKind::Zfs)
|
.invoke(crate::ErrorKind::Zfs)
|
||||||
.await?;
|
.await?;
|
||||||
@@ -177,6 +177,11 @@ pub async fn mount(cfg: &RpcContextConfig, password: &str) -> Result<(), Error>
|
|||||||
.arg(format!("{}/main", cfg.zfs_pool_name()))
|
.arg(format!("{}/main", cfg.zfs_pool_name()))
|
||||||
.invoke(crate::ErrorKind::Zfs)
|
.invoke(crate::ErrorKind::Zfs)
|
||||||
.await?;
|
.await?;
|
||||||
|
Command::new("zfs")
|
||||||
|
.arg("load-key")
|
||||||
|
.arg(format!("{}/package-data", cfg.zfs_pool_name()))
|
||||||
|
.invoke(crate::ErrorKind::Zfs)
|
||||||
|
.await?;
|
||||||
tokio::fs::remove_file(PASSWORD_PATH)
|
tokio::fs::remove_file(PASSWORD_PATH)
|
||||||
.await
|
.await
|
||||||
.with_ctx(|_| (crate::ErrorKind::Filesystem, PASSWORD_PATH))?;
|
.with_ctx(|_| (crate::ErrorKind::Filesystem, PASSWORD_PATH))?;
|
||||||
|
|||||||
@@ -511,6 +511,10 @@ pub async fn install_s9pk<R: AsyncRead + AsyncSeek + Unpin>(
|
|||||||
.await?;
|
.await?;
|
||||||
log::info!("Install {}@{}: Unpacked Docker Images", pkg_id, version,);
|
log::info!("Install {}@{}: Unpacked Docker Images", pkg_id, version,);
|
||||||
|
|
||||||
|
log::info!("Install {}@{}: Unpacking Assets", pkg_id, version);
|
||||||
|
// TODO
|
||||||
|
log::info!("Install {}@{}: Unpacked Assets", pkg_id, version);
|
||||||
|
|
||||||
progress.unpack_complete.store(true, Ordering::SeqCst);
|
progress.unpack_complete.store(true, Ordering::SeqCst);
|
||||||
|
|
||||||
progress_model.put(&mut ctx.db.handle(), &progress).await?;
|
progress_model.put(&mut ctx.db.handle(), &progress).await?;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ use crate::{Error, ErrorKind, ResultExt as _};
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn random_key() {
|
fn random_key() {
|
||||||
println!("'0x{}'", hex::encode(TorSecretKeyV3::generate().as_bytes()));
|
println!("x'{}'", hex::encode(TorSecretKeyV3::generate().as_bytes()));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[command(subcommands(list_services))]
|
#[command(subcommands(list_services))]
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ impl Shutdown {
|
|||||||
Command::new("reboot").spawn().unwrap().wait().unwrap();
|
Command::new("reboot").spawn().unwrap().wait().unwrap();
|
||||||
} else {
|
} else {
|
||||||
Command::new("shutdown")
|
Command::new("shutdown")
|
||||||
|
.arg("-h")
|
||||||
.arg("now")
|
.arg("now")
|
||||||
.spawn()
|
.spawn()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ lazy_static::lazy_static! {
|
|||||||
static ref SOUND_MUTEX: Mutex<Option<fd_lock_rs::FdLock<tokio::fs::File>>> = Mutex::new(None);
|
static ref SOUND_MUTEX: Mutex<Option<fd_lock_rs::FdLock<tokio::fs::File>>> = Mutex::new(None);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const SOUND_LOCK_FILE: &'static str = "/TODO/AIDEN/CHANGEME";
|
pub const SOUND_LOCK_FILE: &'static str = "/etc/embassy/sound.lock";
|
||||||
|
|
||||||
struct SoundInterface(Option<MutexGuard<'static, Option<fd_lock_rs::FdLock<tokio::fs::File>>>>);
|
struct SoundInterface(Option<MutexGuard<'static, Option<fd_lock_rs::FdLock<tokio::fs::File>>>>);
|
||||||
impl SoundInterface {
|
impl SoundInterface {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
"ng": "ng",
|
"ng": "ng",
|
||||||
"start": "ng serve",
|
"start": "ng serve",
|
||||||
"build": "ng build",
|
"build": "ng build",
|
||||||
"build-prod": "ng build --prod && tsc postprocess.ts && node postprocess.js && git log | head -n1 > www/git-hash.txt",
|
"build-prod": "ng build --configuration production && tsc postprocess.ts && node postprocess.js && git log | head -n1 > www/git-hash.txt",
|
||||||
"lint": "ng lint"
|
"lint": "ng lint"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
Reference in New Issue
Block a user