NAME

Langertha::Holmgang::Sim::Linux::Backup - Backup and restore on a simulated Linux server — tar, rsync, restic, sha256sum

VERSION

version 0.001

SYNOPSIS

# from the Linux simulator: tar, rsync, restic, sha256sum, gzip -t
my ( $out, $ok ) = Langertha::Holmgang::Sim::Linux::Backup::tar( $dev, \@argv, $ctx );

DESCRIPTION

Backup and restore tools on a device of type linux (cai-platform docs/entwurf-evals.md §3.3.1). Files are entries under files with content (or a fixed size), owner, group, mode, mtime ("Oct 19 23:30").

tar archive: a file entry with tar — the members with a relative path (GNU tar strips the leading /), one file entry per member; corrupt: true makes a damaged archive:

/var/backups/etc-2026-10-19.tar.gz: { size: 2M, mtime: "Oct 19 23:30", sha256: "…",
    tar: { etc/nginx/nginx.conf: { content: "…", owner: root, group: root, mode: "0644", mtime: "Oct 01 10:00" } } }

Commands: tar -c|-x|-t [-z|-j|-J] [-v] -f archive [-C dir] [--strip-components=N] [--exclude=pattern] [-k] [-O] [-T list|--files-from=list] [--remove-files] [member …] (bundled like xzvf; as root with owner, mode and time; without -C into the current directory, default /root), rsync [-a|-r|-p|-o|-g|-t|-v|-n|-h|-P] [--delete] [--exclude=pattern] source … dest (local and host:path to another device; a trailing slash on the source = contents instead of the directory), sha256sum [-c list] file … (checksum from the entry's sha256, else from the content), gzip -t.

restic: repositories live on the device that holds them:

restic_repos:
  /srv/restic/web1:                       # local (-r /srv/…) or sftp:host:/srv/… from another device
    password_file: /root/.restic-pass     # the file --password-file or RESTIC_PASSWORD_FILE must name
    size: 41G                             # used
    prunable: 0                           # set by the simulator: data of forgotten snapshots until prune
    lock: { host: web1, pid: 4711, time: "2026-10-19 23:30:05" }   # optional, stale
    snapshots: [ { id: 4f2a9c1e, time: "2026-10-19 23:30:02", host: web1, paths: [/etc, /srv/www],
                   tags: [], unique: 1.2G, files: { /etc/x: { … } } } ]

restic -r repo --password-file f snapshots|ls|restore|dump|forget|prune|check| unlock|backup|stats with --host, --path, --tag, --target, --include, --exclude, --keep-last|hourly|daily|weekly|monthly|yearly N, --group-by, --prune, --dry-run. forget computes retention like restic (per group of host and paths, newest first, per rule one snapshot per day/week/month); forgotten data is freed only by prune (or --prune).

copy_entry

my $new = copy_entry( $entry, $preserve );

Copy of a file entry: preserved (owner, mode, time) or new (root, mode minus umask 022, now).

tar

tar (see above).

gzip

gzip -t.

sha256sum

sha256sum [-c list] file ....

rsync

rsync (see above).

restic

restic (see above).

SUPPORT

Issues

Please report bugs and feature requests at https://github.com/Getty/langertha-holmgang/issues.

IRC

Join #langertha on irc.perl.org or message Getty directly.

CONTRIBUTING

Contributions are welcome! Please fork the repository and submit a pull request.

AUTHOR

Torsten Raudssus <torsten@raudssus.de>

COPYRIGHT AND LICENSE

This software is copyright (c) 2026 by Torsten Raudssus <torsten@raudssus.de> https://raudssus.de/.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.