Fix YAML linting issues and update system requirements to Debian 13+
- Fix trailing spaces and blank lines in Forgejo workflows - Update system requirements from Ubuntu Jammy/Bookworm to Debian 13+ (Trixie) - Update test treefile to use Debian Trixie instead of Ubuntu Jammy - Update documentation to reflect modern system requirements - Fix yamllint errors for CI/CD functionality - Ensure compatibility with modern OSTree and libapt versions
This commit is contained in:
parent
ec0da91864
commit
3dec23f8f7
85 changed files with 12569 additions and 1088 deletions
708
src/cli.rs
Normal file
708
src/cli.rs
Normal file
|
|
@ -0,0 +1,708 @@
|
|||
use clap::{Parser, Subcommand, Args};
|
||||
|
||||
|
||||
#[derive(Parser)]
|
||||
#[command(name = "apt-ostree")]
|
||||
#[command(about = "Debian/Ubuntu equivalent of rpm-ostree")]
|
||||
#[command(version = "0.1.0")]
|
||||
#[command(propagate_version = true)]
|
||||
pub struct Cli {
|
||||
#[command(subcommand)]
|
||||
pub command: Commands,
|
||||
}
|
||||
|
||||
#[derive(Subcommand)]
|
||||
pub enum Commands {
|
||||
/// Get the version of the booted system
|
||||
Status(StatusArgs),
|
||||
|
||||
/// Perform a system upgrade
|
||||
Upgrade(UpgradeArgs),
|
||||
|
||||
/// Revert to the previously booted tree
|
||||
Rollback(RollbackArgs),
|
||||
|
||||
/// Deploy a specific commit
|
||||
Deploy(DeployArgs),
|
||||
|
||||
/// Switch to a different tree
|
||||
Rebase(RebaseArgs),
|
||||
|
||||
/// Overlay additional packages
|
||||
Install(InstallArgs),
|
||||
|
||||
/// Remove overlayed additional packages
|
||||
Uninstall(UninstallArgs),
|
||||
|
||||
/// Search for packages
|
||||
Search(SearchArgs),
|
||||
|
||||
/// Enable or disable local initramfs regeneration
|
||||
Initramfs(InitramfsArgs),
|
||||
|
||||
/// Add files to the initramfs
|
||||
InitramfsEtc(InitramfsEtcArgs),
|
||||
|
||||
/// Query or modify kernel arguments
|
||||
Kargs(KargsArgs),
|
||||
|
||||
/// Reload configuration
|
||||
Reload(ReloadArgs),
|
||||
|
||||
/// Cancel an active transaction
|
||||
Cancel(CancelArgs),
|
||||
|
||||
/// Manage active transactions
|
||||
Transaction(TransactionArgs),
|
||||
|
||||
/// Commands to compose a tree
|
||||
Compose(ComposeArgs),
|
||||
|
||||
/// Commands to query the package database
|
||||
Db(DbArgs),
|
||||
|
||||
/// Manage base package overrides
|
||||
Override(OverrideArgs),
|
||||
|
||||
/// Remove all mutations
|
||||
Reset(ResetArgs),
|
||||
|
||||
/// Generate package repository metadata
|
||||
RefreshMd(RefreshMdArgs),
|
||||
|
||||
/// Apply pending deployment changes to booted deployment
|
||||
ApplyLive(ApplyLiveArgs),
|
||||
|
||||
/// Apply a transient overlayfs to /usr
|
||||
Usroverlay(UsroverlayArgs),
|
||||
|
||||
/// Clear cached/pending data
|
||||
Cleanup(CleanupArgs),
|
||||
|
||||
/// Unset the finalization locking state and reboot
|
||||
FinalizeDeployment(FinalizeDeploymentArgs),
|
||||
|
||||
/// Display system metrics and performance information
|
||||
Metrics(MetricsArgs),
|
||||
|
||||
/// Start the daemon
|
||||
StartDaemon(StartDaemonArgs),
|
||||
|
||||
/// Experimental features
|
||||
Ex(ExArgs),
|
||||
|
||||
/// Telemetry and usage statistics
|
||||
Countme(CountmeArgs),
|
||||
|
||||
/// Container management
|
||||
Container(ContainerArgs),
|
||||
|
||||
/// Development and debugging tools (hidden)
|
||||
#[command(hide = true)]
|
||||
Testutils(TestutilsArgs),
|
||||
|
||||
/// Shared library backend (hidden)
|
||||
#[command(hide = true)]
|
||||
ShlibBackend(ShlibBackendArgs),
|
||||
|
||||
/// Internal system commands (hidden)
|
||||
#[command(hide = true)]
|
||||
Internals(InternalsArgs),
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
pub struct StatusArgs {
|
||||
/// Pretty print output
|
||||
#[arg(short, long)]
|
||||
pub pretty: bool,
|
||||
|
||||
/// Verbose output
|
||||
#[arg(short, long)]
|
||||
pub verbose: bool,
|
||||
|
||||
/// Output JSON
|
||||
#[arg(long)]
|
||||
pub json: bool,
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
pub struct UpgradeArgs {
|
||||
/// Initiate a reboot after operation is complete
|
||||
#[arg(short, long)]
|
||||
pub reboot: bool,
|
||||
|
||||
/// Just preview package differences (implies --unchanged-exit-77)
|
||||
#[arg(long)]
|
||||
pub preview: bool,
|
||||
|
||||
/// Just check if an upgrade is available (implies --unchanged-exit-77)
|
||||
#[arg(long)]
|
||||
pub check: bool,
|
||||
|
||||
/// Do not download latest ostree and APT data
|
||||
#[arg(short, long)]
|
||||
pub cache_only: bool,
|
||||
|
||||
/// Just download latest ostree and APT data, don't deploy
|
||||
#[arg(long)]
|
||||
pub download_only: bool,
|
||||
|
||||
/// If no new deployment made, exit 77
|
||||
#[arg(long)]
|
||||
pub unchanged_exit_77: bool,
|
||||
|
||||
/// Overlay additional packages
|
||||
#[arg(long, value_delimiter = ',')]
|
||||
pub install: Vec<String>,
|
||||
|
||||
/// Remove overlayed additional packages
|
||||
#[arg(long, value_delimiter = ',')]
|
||||
pub uninstall: Vec<String>,
|
||||
|
||||
/// Additional packages to install
|
||||
#[arg(long)]
|
||||
pub packages: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
pub struct RollbackArgs {
|
||||
/// Initiate a reboot after operation
|
||||
#[arg(short, long)]
|
||||
pub reboot: bool,
|
||||
|
||||
/// Exit 77 if unchanged
|
||||
#[arg(long)]
|
||||
pub unchanged_exit_77: bool,
|
||||
|
||||
/// Deploy index to rollback to
|
||||
#[arg(long)]
|
||||
pub deploy_index: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
pub struct DeployArgs {
|
||||
/// Commit to deploy
|
||||
pub commit: String,
|
||||
|
||||
/// Initiate a reboot after operation
|
||||
#[arg(short, long)]
|
||||
pub reboot: bool,
|
||||
|
||||
/// Lock finalization
|
||||
#[arg(long)]
|
||||
pub lock_finalization: bool,
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
pub struct RebaseArgs {
|
||||
/// Target tree to rebase to
|
||||
pub target: String,
|
||||
|
||||
/// Initiate a reboot after operation
|
||||
#[arg(short, long)]
|
||||
pub reboot: bool,
|
||||
|
||||
/// Lock finalization
|
||||
#[arg(long)]
|
||||
pub lock_finalization: bool,
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
pub struct InstallArgs {
|
||||
/// Packages to install
|
||||
pub packages: Vec<String>,
|
||||
|
||||
/// Initiate a reboot after operation
|
||||
#[arg(short, long)]
|
||||
pub reboot: bool,
|
||||
|
||||
/// Lock finalization
|
||||
#[arg(long)]
|
||||
pub lock_finalization: bool,
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
pub struct UninstallArgs {
|
||||
/// Packages to remove
|
||||
pub packages: Vec<String>,
|
||||
|
||||
/// Initiate a reboot after operation
|
||||
#[arg(short, long)]
|
||||
pub reboot: bool,
|
||||
|
||||
/// Lock finalization
|
||||
#[arg(long)]
|
||||
pub lock_finalization: bool,
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
pub struct SearchArgs {
|
||||
/// Search query
|
||||
pub query: String,
|
||||
|
||||
/// Search in installed packages
|
||||
#[arg(long)]
|
||||
pub installed: bool,
|
||||
|
||||
/// Search in available packages
|
||||
#[arg(long)]
|
||||
pub available: bool,
|
||||
|
||||
/// Output format
|
||||
#[arg(long, default_value = "text")]
|
||||
pub format: String,
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
pub struct InitramfsArgs {
|
||||
/// Enable local initramfs regeneration
|
||||
#[arg(long)]
|
||||
pub enable: bool,
|
||||
|
||||
/// Disable local initramfs regeneration
|
||||
#[arg(long)]
|
||||
pub disable: bool,
|
||||
|
||||
/// Initiate a reboot after operation
|
||||
#[arg(short, long)]
|
||||
pub reboot: bool,
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
pub struct InitramfsEtcArgs {
|
||||
/// Add files to initramfs
|
||||
#[arg(long)]
|
||||
pub add: Vec<String>,
|
||||
|
||||
/// Remove files from initramfs
|
||||
#[arg(long)]
|
||||
pub remove: Vec<String>,
|
||||
|
||||
/// List files in initramfs
|
||||
#[arg(long)]
|
||||
pub list: bool,
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
pub struct KargsArgs {
|
||||
/// Initiate a reboot after operation
|
||||
#[arg(long)]
|
||||
pub reboot: bool,
|
||||
|
||||
/// Lock finalization
|
||||
#[arg(long)]
|
||||
pub lock_finalization: bool,
|
||||
|
||||
/// Exit 77 if unchanged
|
||||
#[arg(long)]
|
||||
pub unchanged_exit_77: bool,
|
||||
|
||||
/// Import from /proc/cmdline
|
||||
#[arg(long)]
|
||||
pub import_proc_cmdline: bool,
|
||||
|
||||
/// Use editor mode
|
||||
#[arg(long)]
|
||||
pub editor: bool,
|
||||
|
||||
/// Deploy index
|
||||
#[arg(long)]
|
||||
pub deploy_index: Option<String>,
|
||||
|
||||
/// Append kernel arguments
|
||||
#[arg(long, value_delimiter = ',')]
|
||||
pub append: Vec<String>,
|
||||
|
||||
/// Replace kernel arguments
|
||||
#[arg(long, value_delimiter = ',')]
|
||||
pub replace: Vec<String>,
|
||||
|
||||
/// Delete kernel arguments
|
||||
#[arg(long, value_delimiter = ',')]
|
||||
pub delete: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
pub struct ReloadArgs {
|
||||
/// Reload configuration
|
||||
#[arg(long)]
|
||||
pub config: bool,
|
||||
|
||||
/// Reload daemon
|
||||
#[arg(long)]
|
||||
pub daemon: bool,
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
pub struct CancelArgs {
|
||||
/// Transaction ID to cancel
|
||||
pub transaction_id: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
pub struct TransactionArgs {
|
||||
#[command(subcommand)]
|
||||
pub subcommand: TransactionSubcommands,
|
||||
}
|
||||
|
||||
#[derive(Subcommand)]
|
||||
pub enum TransactionSubcommands {
|
||||
/// List active transactions
|
||||
List,
|
||||
/// Show transaction details
|
||||
Show { transaction_id: String },
|
||||
/// Wait for transaction completion
|
||||
Wait { transaction_id: String },
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
pub struct ComposeArgs {
|
||||
#[command(subcommand)]
|
||||
pub subcommand: ComposeSubcommands,
|
||||
}
|
||||
|
||||
#[derive(Subcommand)]
|
||||
pub enum ComposeSubcommands {
|
||||
/// Compose a new tree
|
||||
Tree { target: String },
|
||||
/// Compose a container
|
||||
Container { target: String },
|
||||
/// Compose a bootable image
|
||||
Bootable { target: String },
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
pub struct DbArgs {
|
||||
#[command(subcommand)]
|
||||
pub subcommand: DbSubcommands,
|
||||
}
|
||||
|
||||
#[derive(Subcommand)]
|
||||
pub enum DbSubcommands {
|
||||
/// List packages
|
||||
List,
|
||||
/// Show package info
|
||||
Info { package: String },
|
||||
/// Search packages
|
||||
Search { query: String },
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
pub struct OverrideArgs {
|
||||
#[command(subcommand)]
|
||||
pub subcommand: OverrideSubcommands,
|
||||
}
|
||||
|
||||
#[derive(Subcommand)]
|
||||
pub enum OverrideSubcommands {
|
||||
/// Add package override
|
||||
Add { package: String },
|
||||
/// Remove package override
|
||||
Remove { package: String },
|
||||
/// List package overrides
|
||||
List,
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
pub struct ResetArgs {
|
||||
/// Reset to base deployment
|
||||
#[arg(long)]
|
||||
pub base: bool,
|
||||
|
||||
/// Reset all mutations
|
||||
#[arg(long)]
|
||||
pub all: bool,
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
pub struct RefreshMdArgs {
|
||||
/// Force refresh
|
||||
#[arg(short, long)]
|
||||
pub force: bool,
|
||||
|
||||
/// Dry run
|
||||
#[arg(long)]
|
||||
pub dry_run: bool,
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
pub struct ApplyLiveArgs {
|
||||
/// Apply changes immediately
|
||||
#[arg(long)]
|
||||
pub immediate: bool,
|
||||
|
||||
/// Reboot after applying
|
||||
#[arg(short, long)]
|
||||
pub reboot: bool,
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
pub struct UsroverlayArgs {
|
||||
/// Overlay directory
|
||||
pub directory: String,
|
||||
|
||||
/// Mount point
|
||||
#[arg(long)]
|
||||
pub mount_point: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
pub struct CleanupArgs {
|
||||
/// Clean cache
|
||||
#[arg(long)]
|
||||
pub cache: bool,
|
||||
|
||||
/// Clean pending data
|
||||
#[arg(long)]
|
||||
pub pending: bool,
|
||||
|
||||
/// Clean all
|
||||
#[arg(long)]
|
||||
pub all: bool,
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
pub struct FinalizeDeploymentArgs {
|
||||
/// Reboot after finalization
|
||||
#[arg(short, long)]
|
||||
pub reboot: bool,
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
pub struct MetricsArgs {
|
||||
/// Show system metrics
|
||||
#[arg(long)]
|
||||
pub system: bool,
|
||||
|
||||
/// Show performance metrics
|
||||
#[arg(long)]
|
||||
pub performance: bool,
|
||||
|
||||
/// Show all metrics
|
||||
#[arg(long)]
|
||||
pub all: bool,
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
pub struct StartDaemonArgs {
|
||||
/// Debug mode
|
||||
#[arg(short, long)]
|
||||
pub debug: bool,
|
||||
|
||||
/// System root path
|
||||
#[arg(long, default_value = "/")]
|
||||
pub sysroot: String,
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
pub struct ExArgs {
|
||||
#[command(subcommand)]
|
||||
pub subcommand: ExSubcommands,
|
||||
}
|
||||
|
||||
#[derive(Subcommand)]
|
||||
pub enum ExSubcommands {
|
||||
/// Unpack OSTree commit
|
||||
Unpack {
|
||||
commit: String,
|
||||
destination: String,
|
||||
#[arg(long)]
|
||||
force: bool,
|
||||
},
|
||||
/// Show history
|
||||
History {
|
||||
#[arg(long)]
|
||||
verbose: bool,
|
||||
},
|
||||
/// Manage initramfs /etc
|
||||
InitramfsEtc {
|
||||
#[arg(long)]
|
||||
add: Vec<String>,
|
||||
#[arg(long)]
|
||||
remove: Vec<String>,
|
||||
},
|
||||
/// Manage modules
|
||||
Module {
|
||||
#[arg(long)]
|
||||
enable: String,
|
||||
#[arg(long)]
|
||||
disable: String,
|
||||
},
|
||||
/// Rebuild system
|
||||
Rebuild {
|
||||
#[arg(long)]
|
||||
force: bool,
|
||||
},
|
||||
/// Deploy from self
|
||||
DeployFromSelf {
|
||||
#[arg(long)]
|
||||
force: bool,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
pub struct CountmeArgs {
|
||||
/// Force countme
|
||||
#[arg(short, long)]
|
||||
pub force: bool,
|
||||
|
||||
/// Dry run
|
||||
#[arg(long)]
|
||||
pub dry_run: bool,
|
||||
|
||||
/// Verbose output
|
||||
#[arg(short, long)]
|
||||
pub verbose: bool,
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
pub struct ContainerArgs {
|
||||
#[command(subcommand)]
|
||||
pub subcommand: ContainerSubcommands,
|
||||
}
|
||||
|
||||
#[derive(Subcommand)]
|
||||
pub enum ContainerSubcommands {
|
||||
/// Install container
|
||||
Install { image: String },
|
||||
/// Uninstall container
|
||||
Uninstall { name: String },
|
||||
/// List containers
|
||||
List,
|
||||
/// Show container info
|
||||
Info { name: String },
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
pub struct TestutilsArgs {
|
||||
#[command(subcommand)]
|
||||
pub subcommand: TestutilsSubcommands,
|
||||
}
|
||||
|
||||
#[derive(Subcommand)]
|
||||
pub enum TestutilsSubcommands {
|
||||
/// Inject package list metadata into OSTree commits
|
||||
InjectPkglist(InjectPkglistArgs),
|
||||
|
||||
/// Run scripts in bubblewrap containers
|
||||
ScriptShell(ScriptShellArgs),
|
||||
|
||||
/// Generate synthetic OS updates by modifying ELF files
|
||||
GenerateSyntheticUpgrade(GenerateSyntheticUpgradeArgs),
|
||||
|
||||
/// Run integration tests on booted machine
|
||||
IntegrationReadOnly,
|
||||
|
||||
/// Run C unit tests
|
||||
CUnits,
|
||||
|
||||
/// Test command for development verification
|
||||
Moo,
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
pub struct InjectPkglistArgs {
|
||||
/// Repository path
|
||||
pub repo: String,
|
||||
|
||||
/// OSTree reference
|
||||
pub refspec: String,
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
pub struct ScriptShellArgs {
|
||||
/// Script or command to execute
|
||||
pub script: String,
|
||||
|
||||
/// Arguments for the script
|
||||
pub args: Vec<String>,
|
||||
|
||||
/// Root path for script execution
|
||||
#[arg(long, default_value = "/")]
|
||||
pub rootpath: String,
|
||||
|
||||
/// Run in read-only mode
|
||||
#[arg(long)]
|
||||
pub read_only: bool,
|
||||
|
||||
/// User to run as
|
||||
#[arg(long)]
|
||||
pub user: Option<String>,
|
||||
|
||||
/// Group to run as
|
||||
#[arg(long)]
|
||||
pub group: Option<String>,
|
||||
|
||||
/// Working directory
|
||||
#[arg(long)]
|
||||
pub cwd: Option<String>,
|
||||
|
||||
/// Environment variables (format: KEY=VALUE)
|
||||
#[arg(long)]
|
||||
pub env: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
pub struct GenerateSyntheticUpgradeArgs {
|
||||
/// Repository path
|
||||
#[arg(long)]
|
||||
pub repo: String,
|
||||
|
||||
/// Source reference
|
||||
#[arg(long = "srcref")]
|
||||
pub src_ref: Option<String>,
|
||||
|
||||
/// OSTree reference
|
||||
#[arg(long = "ref")]
|
||||
pub ostref: String,
|
||||
|
||||
/// Percentage of binaries to modify
|
||||
#[arg(long, default_value = "30")]
|
||||
pub percentage: u32,
|
||||
|
||||
/// Commit version
|
||||
#[arg(long)]
|
||||
pub commit_version: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
pub struct ShlibBackendArgs {
|
||||
#[command(subcommand)]
|
||||
pub subcommand: ShlibBackendSubcommands,
|
||||
}
|
||||
|
||||
#[derive(Subcommand)]
|
||||
pub enum ShlibBackendSubcommands {
|
||||
/// Get base architecture
|
||||
GetBasearch,
|
||||
|
||||
/// Variable substitution for architecture
|
||||
VarsubstBasearch {
|
||||
/// Source string for substitution
|
||||
source: String,
|
||||
},
|
||||
|
||||
/// Extract package list from OSTree commit
|
||||
PackagelistFromCommit {
|
||||
/// Commit hash
|
||||
commit: String,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
pub struct InternalsArgs {
|
||||
#[command(subcommand)]
|
||||
pub subcommand: InternalsSubcommands,
|
||||
}
|
||||
|
||||
#[derive(Subcommand)]
|
||||
pub enum InternalsSubcommands {
|
||||
/// Internal system diagnostics
|
||||
Diagnostics,
|
||||
|
||||
/// System state validation
|
||||
ValidateState,
|
||||
|
||||
/// Debug information dump
|
||||
DebugDump,
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue