Fix/backups (#2659)

* fix master build (#2639)

* feat: Change ts to use rsync
Chore: Update the ts to use types over interface

* feat: Get the rust and the js to do a backup

* Wip: Got the backup working?

* fix permissions

* remove trixie list

* update tokio to fix timer bug

* fix error handling on backup

* wip

* remove idmap

* run restore before init, and init with own version on restore

---------

Co-authored-by: Aiden McClelland <3732071+dr-bonez@users.noreply.github.com>
Co-authored-by: Aiden McClelland <me@drbonez.dev>
This commit is contained in:
Jade
2024-07-17 15:46:27 -06:00
committed by GitHub
parent 95611e9c4b
commit 8f0bdcd172
23 changed files with 445 additions and 380 deletions

View File

@@ -7,6 +7,7 @@ import { RpcResult, matchRpcResult } from "../RpcListener"
import { duration } from "../../Models/Duration"
import { T } from "@start9labs/start-sdk"
import { MainEffects } from "@start9labs/start-sdk/cjs/lib/StartSdk"
import { Volume } from "../../Models/Volume"
export const STARTOS_JS_LOCATION = "/usr/lib/startos/package/index.js"
export class SystemForStartOs implements System {
private onTerm: (() => Promise<void>) | undefined
@@ -151,8 +152,17 @@ export class SystemForStartOs implements System {
return this.abi.getConfig({ effects })
}
case "/backup/create":
return this.abi.createBackup({
effects,
pathMaker: ((options) =>
new Volume(options.volume, options.path).path) as T.PathMaker,
})
case "/backup/restore":
throw new Error("this should be called with the init/unit")
return this.abi.restoreBackup({
effects,
pathMaker: ((options) =>
new Volume(options.volume, options.path).path) as T.PathMaker,
})
case "/actions/metadata": {
return this.abi.actionsMetadata({ effects })
}

View File

@@ -5,7 +5,7 @@ import { hostSystemStartOs } from "../Adapters/HostSystemStartOs"
export type ExecuteResult =
| { ok: unknown }
| { err: { code: number; message: string } }
export interface System {
export type System = {
// init(effects: Effects): Promise<void>
// exit(effects: Effects): Promise<void>
// start(effects: Effects): Promise<void>