mirror of
https://github.com/nicotsx/ironmount.git
synced 2025-12-10 12:10:51 +01:00
feat: exclude specific xattr during restore
This commit is contained in:
@@ -237,6 +237,7 @@ export const restoreSnapshotBody = type({
|
||||
snapshotId: "string",
|
||||
include: "string[]?",
|
||||
exclude: "string[]?",
|
||||
excludeXattr: "string[]?",
|
||||
delete: "boolean?",
|
||||
});
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ const listRepositories = async () => {
|
||||
};
|
||||
|
||||
const encryptConfig = async (config: RepositoryConfig): Promise<RepositoryConfig> => {
|
||||
const encryptedConfig: Record<string, string | boolean> = { ...config };
|
||||
const encryptedConfig: Record<string, string | boolean | number> = { ...config };
|
||||
|
||||
if (config.customPassword) {
|
||||
encryptedConfig.customPassword = await cryptoUtils.encrypt(config.customPassword);
|
||||
@@ -193,7 +193,7 @@ const listSnapshotFiles = async (name: string, snapshotId: string, path?: string
|
||||
const restoreSnapshot = async (
|
||||
name: string,
|
||||
snapshotId: string,
|
||||
options?: { include?: string[]; exclude?: string[]; delete?: boolean },
|
||||
options?: { include?: string[]; exclude?: string[]; excludeXattr?: string[]; delete?: boolean },
|
||||
) => {
|
||||
const repository = await db.query.repositoriesTable.findFirst({
|
||||
where: eq(repositoriesTable.name, name),
|
||||
|
||||
@@ -351,6 +351,7 @@ const restore = async (
|
||||
options?: {
|
||||
include?: string[];
|
||||
exclude?: string[];
|
||||
excludeXattr?: string[];
|
||||
path?: string;
|
||||
delete?: boolean;
|
||||
},
|
||||
@@ -380,11 +381,15 @@ const restore = async (
|
||||
}
|
||||
}
|
||||
|
||||
if (options?.excludeXattr && options.excludeXattr.length > 0) {
|
||||
for (const xattr of options.excludeXattr) {
|
||||
args.push("--exclude-xattr", xattr);
|
||||
}
|
||||
}
|
||||
|
||||
addRepoSpecificArgs(args, config, env);
|
||||
args.push("--json");
|
||||
|
||||
console.log("Restic restore command:", ["restic", ...args].join(" "));
|
||||
|
||||
const res = await $`restic ${args}`.env(env).nothrow();
|
||||
await cleanupTemporaryKeys(config, env);
|
||||
|
||||
@@ -408,6 +413,7 @@ const restore = async (
|
||||
};
|
||||
}
|
||||
|
||||
logger.debug(`Restic restore output last line: ${lastLine}`);
|
||||
const resSummary = JSON.parse(lastLine);
|
||||
const result = restoreOutputSchema(resSummary);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user