This commit is contained in:
Aiden McClelland
2025-12-17 12:17:22 -07:00
parent 9567bcec1b
commit e33ab39b85
6 changed files with 48 additions and 25 deletions

View File

@@ -378,10 +378,13 @@ cargo-deps/aarch64-unknown-linux-musl/release/pi-beep: ./build-cargo-dep.sh
ARCH=aarch64 ./build-cargo-dep.sh pi-beep ARCH=aarch64 ./build-cargo-dep.sh pi-beep
cargo-deps/$(RUST_ARCH)-unknown-linux-musl/release/tokio-console: ./build-cargo-dep.sh cargo-deps/$(RUST_ARCH)-unknown-linux-musl/release/tokio-console: ./build-cargo-dep.sh
ARCH=$(ARCH) PREINSTALL="apk add musl-dev pkgconfig" ./build-cargo-dep.sh tokio-console ARCH=$(ARCH) ./build-cargo-dep.sh tokio-console
touch $@
cargo-deps/$(RUST_ARCH)-unknown-linux-musl/release/startos-backup-fs: ./build-cargo-dep.sh cargo-deps/$(RUST_ARCH)-unknown-linux-musl/release/startos-backup-fs: ./build-cargo-dep.sh
ARCH=$(ARCH) PREINSTALL="apk add fuse3 fuse3-dev fuse3-static musl-dev pkgconfig" ./build-cargo-dep.sh --git https://github.com/Start9Labs/start-fs.git startos-backup-fs ARCH=$(ARCH) ./build-cargo-dep.sh --git https://github.com/Start9Labs/start-fs.git startos-backup-fs
touch $@
cargo-deps/$(RUST_ARCH)-unknown-linux-musl/release/flamegraph: ./build-cargo-dep.sh cargo-deps/$(RUST_ARCH)-unknown-linux-musl/release/flamegraph: ./build-cargo-dep.sh
ARCH=$(ARCH) PREINSTALL="apk add musl-dev pkgconfig" ./build-cargo-dep.sh flamegraph ARCH=$(ARCH) ./build-cargo-dep.sh flamegraph
touch $@

View File

@@ -25,5 +25,5 @@ RUSTFLAGS="-C target-feature=+crt-static"
rust-zig-builder cargo-zigbuild install $* --target-dir /workdir/cargo-deps/ --target=$RUST_ARCH-unknown-linux-musl rust-zig-builder cargo-zigbuild install $* --target-dir /workdir/cargo-deps/ --target=$RUST_ARCH-unknown-linux-musl
if [ "$(ls -nd "cargo-deps/$RUST_ARCH-unknown-linux-musl/release/${!#}" | awk '{ print $3 }')" != "$UID" ]; then if [ "$(ls -nd "cargo-deps/$RUST_ARCH-unknown-linux-musl/release/${!#}" | awk '{ print $3 }')" != "$UID" ]; then
rust-zig-builder sh -c "chown -R $UID:$UID core/target && chown -R $UID:$UID /usr/local/cargo" rust-zig-builder sh -c "chown -R $UID:$UID cargo-deps && chown -R $UID:$UID /usr/local/cargo"
fi fi

View File

@@ -389,12 +389,19 @@ impl RpcContext {
.as_entries()? .as_entries()?
.into_iter() .into_iter()
.map(|(_, pde)| { .map(|(_, pde)| {
Ok(pde.as_tasks().as_entries()?.into_iter().map(|(_, r)| { Ok(pde
Ok::<_, Error>(( .as_tasks()
r.as_task().as_package_id().de()?, .as_entries()?
r.as_task().as_action_id().de()?, .into_iter()
)) .map(|(_, r)| {
})) let t = r.as_task();
Ok::<_, Error>(if t.as_input().transpose_ref().is_some() {
Some((t.as_package_id().de()?, t.as_action_id().de()?))
} else {
None
})
})
.filter_map_ok(|a| a))
}) })
.flatten_ok() .flatten_ok()
.map(|a| a.and_then(|a| a)) .map(|a| a.and_then(|a| a))

View File

@@ -298,7 +298,8 @@ impl Service {
return Ok(None); return Ok(None);
}; };
let s9pk_path = entry.as_s9pk().de()?; let s9pk_path = entry.as_s9pk().de()?;
match entry.as_state_info().as_match() { let state = entry.as_state_info().as_match();
match state {
PackageStateMatchModelRef::Installing(_) => { PackageStateMatchModelRef::Installing(_) => {
if disposition == LoadDisposition::Retry { if disposition == LoadDisposition::Retry {
if let Ok(s9pk) = S9pk::open(&s9pk_path, Some(id)).await.map_err(|e| { if let Ok(s9pk) = S9pk::open(&s9pk_path, Some(id)).await.map_err(|e| {
@@ -432,11 +433,10 @@ impl Service {
} }
} }
if disposition == LoadDisposition::Retry { if disposition == LoadDisposition::Retry
ctx.db || matches!(state, PackageStateMatchModelRef::Restoring(_))
.mutate(|v| v.as_public_mut().as_package_data_mut().remove(id)) {
.await cleanup(ctx, id, false).await?;
.result?;
} }
Ok(None) Ok(None)
@@ -493,11 +493,16 @@ impl Service {
.as_entries()? .as_entries()?
.into_iter() .into_iter()
.map(|(_, r)| { .map(|(_, r)| {
Ok::<_, Error>(if r.as_task().as_package_id().de()? == manifest.id { let t = r.as_task();
Some(r.as_task().as_action_id().de()?) Ok::<_, Error>(
} else { if t.as_package_id().de()? == manifest.id
None && t.as_input().transpose_ref().is_some()
}) {
Some(t.as_action_id().de()?)
} else {
None
},
)
}) })
.filter_map_ok(|a| a)) .filter_map_ok(|a| a))
}) })
@@ -515,7 +520,9 @@ impl Service {
{ {
if let Some(input) = service if let Some(input) = service
.get_action_input(procedure_id.clone(), action_id.clone()) .get_action_input(procedure_id.clone(), action_id.clone())
.await? .await
.log_err()
.flatten()
.and_then(|i| i.value) .and_then(|i| i.value)
{ {
action_input.insert(action_id, input); action_input.insert(action_id, input);
@@ -589,7 +596,7 @@ impl Service {
.send( .send(
Guid::new(), Guid::new(),
transition::backup::Backup { transition::backup::Backup {
path: guard.path().to_owned(), path: guard.path().join("data"),
}, },
) )
.await??; .await??;

View File

@@ -35,6 +35,12 @@ impl Model<StatusInfo> {
pub fn started(&mut self) -> Result<(), Error> { pub fn started(&mut self) -> Result<(), Error> {
self.as_started_mut() self.as_started_mut()
.map_mutate(|s| Ok(Some(s.unwrap_or_else(|| Utc::now()))))?; .map_mutate(|s| Ok(Some(s.unwrap_or_else(|| Utc::now()))))?;
self.as_desired_mut().map_mutate(|s| {
Ok(match s {
DesiredStatus::Restarting => DesiredStatus::Running,
a => a,
})
})?;
Ok(()) Ok(())
} }
pub fn stop(&mut self) -> Result<(), Error> { pub fn stop(&mut self) -> Result<(), Error> {

View File

@@ -205,11 +205,11 @@ async function runRsync(rsyncOptions: {
const spawned = child_process.spawn(command, args, { detached: true }) const spawned = child_process.spawn(command, args, { detached: true })
let percentage = 0.0 let percentage = 0.0
spawned.stdout.on("data", (data: unknown) => { spawned.stdout.on("data", (data: unknown) => {
const lines = String(data).replace("\r", "\n").split("\n") const lines = String(data).replace(/\r/g, "\n").split("\n")
for (const line of lines) { for (const line of lines) {
const parsed = /$([0-9.]+)%/.exec(line)?.[1] const parsed = /$([0-9.]+)%/.exec(line)?.[1]
if (!parsed) { if (!parsed) {
console.log(parsed) console.log(line)
continue continue
} }
percentage = Number.parseFloat(parsed) percentage = Number.parseFloat(parsed)