BackupPage.hpp

1. Overview

The BackupPage.hpp file is a GTKmm backup and recovery page interface in BastionGuard.

Declares the graphical page used to launch the BastionGuard backup manager and manage the bootable BastionGuard Recovery environment.

The documentation below is generated from the supplied source and covers its API surface, runtime responsibilities, data flow, filesystem or command interactions, concurrency model, and security considerations.


2. Source Inventory

  • Original path: backup/BackupPage.hpp
  • Language: C++
  • Source type: .hpp
  • Line count: 59
  • SHA-256: 09403e82ae9f1c8496abb70700b74e5c8734ecde118bd59ed5beca8c6223f09c

3. Dependencies

The file declares the following compile-time dependencies:

Project

  • ../LifetimeGuard.hpp

GTK/GLib

  • gtkmm.h

C/C++ Runtime

  • string

4. Types and Public Contract

The file declares or implements the following principal types:

  • Class: BackupPage

Declared Public Members

  • BackupPage();
  • ~BackupPage() override;

5. API and Method Inventory

The file contains no out-of-line function implementation. Its behavior is supplied by declarations, inline functions, or associated implementation files.


6. Functional Architecture

Recovery Artifacts and Paths

  • Recovery root: /boot/bastionguard-recovery.
  • SquashFS image: /boot/bastionguard-recovery/live/filesystem.squashfs.
  • Kernel image: /boot/bastionguard-recovery/vmlinuz.
  • GRUB entry: /etc/grub.d/42_bastionguard-recovery.
  • Build and install helpers are loaded from /usr/share/bastionguard-backup/scripts.

Capacity and State Validation

  • Requires at least 2 GiB of free space on /boot before recovery-image construction.
  • Uses statvfs() to calculate available capacity.
  • Checks image, kernel, and GRUB-entry presence and reports their state in markup labels.

Asynchronous Command Streaming

  • Runs commands through /bin/bash -c with separate stdout and stderr pipes.
  • Streams both channels into a monospace GTK log panel.
  • Uses a pulsing progress bar while the child process is active.
  • Uses child-watch and IO callbacks, then restores button sensitivity and refreshes recovery status.

7. Operational Flow

  1. Construct the backup and recovery widgets.
  2. Inspect current recovery image, kernel, GRUB entry, and available boot-partition space.
  3. Launch the requested backup or privileged recovery operation.
  4. Stream subprocess output into the log panel while updating progress.
  5. Interpret the child exit status, restore controls, and refresh the visible state.

8. Filesystem and External Command Surface

No hard-coded absolute filesystem path is declared directly in this file.

Commands or Security Primitives Referenced

  • sh

9. Concurrency and Lifecycle

  • Uses a lifetime guard so delayed callbacks do not access a destroyed widget.

10. Security Considerations

  • Recovery build, GRUB installation, and GRUB removal cross a privilege boundary through pkexec.
  • Scripts and GRUB paths must remain administrator-controlled because they are executed or modified with elevated privileges.
  • Child-process output is treated as diagnostic text and is not interpreted as markup.

11. Implementation Considerations

  • This header defines the public or private class contract; behavior is implemented by the matching .cpp file unless marked inline.

12. Licensing and Branding

The source is distributed under the project license declared by the associated BastionGuard source module.

The source header identifies BastionGuard™ as a trademark and states that the name and branding are not licensed under the GPL.

The software is provided without warranty, including implied warranties of merchantability or fitness for a particular purpose.