Fix rpm-ostree compatibility and postinst script issues
- Add --version and --help flags for rpm-ostree compatibility - Fix postinst script to handle 'triggered' argument properly - Maintain subcommand interface while adding flag support - Improve error messages and help text
This commit is contained in:
parent
86b2c1b4ea
commit
5fe7b0a519
3 changed files with 125 additions and 25 deletions
17
debian/apt-ostree.postinst
vendored
17
debian/apt-ostree.postinst
vendored
|
|
@ -127,6 +127,23 @@ EOF
|
|||
echo "Aborting $PACKAGE configuration..."
|
||||
;;
|
||||
|
||||
triggered)
|
||||
# Handle trigger activation (e.g., man page updates, shell completion)
|
||||
echo "Handling $PACKAGE triggers..."
|
||||
|
||||
# Update shell completion caches
|
||||
if command -v update-bash-completion >/dev/null 2>&1; then
|
||||
update-bash-completion apt-ostree || true
|
||||
fi
|
||||
|
||||
# Update man page database
|
||||
if command -v mandb >/dev/null 2>&1; then
|
||||
mandb -q || true
|
||||
fi
|
||||
|
||||
echo "$PACKAGE triggers handled successfully"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "postinst called with unknown argument \`$1'" >&2
|
||||
exit 1
|
||||
|
|
|
|||
74
src/main.rs
74
src/main.rs
|
|
@ -18,23 +18,26 @@ async fn main() -> AptOstreeResult<()> {
|
|||
|
||||
let args: Vec<String> = env::args().collect();
|
||||
if args.len() < 2 {
|
||||
println!("Usage: {} <command> [options]", args[0]);
|
||||
println!("Commands:");
|
||||
println!(" search <query> - Search for packages");
|
||||
println!(" list - List all packages");
|
||||
println!(" installed - List installed packages");
|
||||
println!(" info <package> - Show package information");
|
||||
println!(" install <package> - Install package (atomic)");
|
||||
println!(" remove <package> - Remove package (atomic)");
|
||||
println!(" upgrade - Upgrade system (atomic)");
|
||||
println!(" status - Show system status");
|
||||
println!(" rollback - Rollback to previous deployment");
|
||||
println!(" help - Show this help");
|
||||
show_help(&args[0]);
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let command = &args[1];
|
||||
|
||||
// Handle rpm-ostree compatible flags first
|
||||
match command.as_str() {
|
||||
"--version" | "-V" => {
|
||||
show_version();
|
||||
return Ok(());
|
||||
}
|
||||
"--help" | "-h" => {
|
||||
show_help(&args[0]);
|
||||
return Ok(());
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
// Handle subcommands (rpm-ostree style)
|
||||
match command.as_str() {
|
||||
"search" => {
|
||||
if args.len() < 3 {
|
||||
|
|
@ -84,7 +87,32 @@ async fn main() -> AptOstreeResult<()> {
|
|||
rollback_system().await?;
|
||||
}
|
||||
"help" => {
|
||||
println!("apt-ostree - Debian/Ubuntu equivalent of rpm-ostree");
|
||||
show_help(&args[0]);
|
||||
}
|
||||
"version" => {
|
||||
show_version();
|
||||
}
|
||||
_ => {
|
||||
error!("Unknown command: {}", command);
|
||||
println!("Try '{} --help' for more information.", args[0]);
|
||||
return Err(AptOstreeError::InvalidArgument(format!("Unknown command: {}", command)));
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Show version information (rpm-ostree compatible)
|
||||
fn show_version() {
|
||||
println!("apt-ostree {}", env!("CARGO_PKG_VERSION"));
|
||||
println!("Debian/Ubuntu equivalent of rpm-ostree");
|
||||
println!("Copyright (C) 2025 Robojerk");
|
||||
println!("License GPL-3.0-or-later: <https://www.gnu.org/licenses/gpl-3.0.html>");
|
||||
}
|
||||
|
||||
/// Show help information (rpm-ostree compatible)
|
||||
fn show_help(program_name: &str) {
|
||||
println!("Usage: {} <command> [options]", program_name);
|
||||
println!("");
|
||||
println!("Commands:");
|
||||
println!(" search <query> - Search for packages");
|
||||
|
|
@ -97,14 +125,18 @@ async fn main() -> AptOstreeResult<()> {
|
|||
println!(" status - Show system status");
|
||||
println!(" rollback - Rollback to previous deployment");
|
||||
println!(" help - Show this help");
|
||||
}
|
||||
_ => {
|
||||
error!("Unknown command: {}", command);
|
||||
return Err(AptOstreeError::InvalidArgument(format!("Unknown command: {}", command)));
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
println!(" version - Show version information");
|
||||
println!("");
|
||||
println!("Options:");
|
||||
println!(" --version, -V - Show version information");
|
||||
println!(" --help, -h - Show this help");
|
||||
println!("");
|
||||
println!("Examples:");
|
||||
println!(" {} --version", program_name);
|
||||
println!(" {} --help", program_name);
|
||||
println!(" {} status", program_name);
|
||||
println!(" {} info apt", program_name);
|
||||
println!(" {} install vim", program_name);
|
||||
}
|
||||
|
||||
async fn search_packages(query: &str) -> AptOstreeResult<()> {
|
||||
|
|
|
|||
51
todo
Normal file
51
todo
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
# TODO: apt-ostree Integration and Testing
|
||||
|
||||
## Current Status
|
||||
- [x] CI pipeline working perfectly in apt-ostree repository
|
||||
- [x] New package built: apt-ostree_0.1.0+build86.a0d386ed_amd64.deb
|
||||
- [x] Package successfully published to Forgejo Debian Registry
|
||||
- [x] Package structure analyzed and understood
|
||||
|
||||
## apt-ostree Package Compatibility Issue - SOLVED! 🎉
|
||||
|
||||
### Problem Identified
|
||||
The **new CI-built package** has a completely different command interface than the old testing package:
|
||||
|
||||
| Aspect | Old Package | New CI Package |
|
||||
|--------|-------------|----------------|
|
||||
| **Version Check** | `apt-ostree --version` ✅ | `apt-ostree help` ✅ |
|
||||
| **Command Style** | Flag-based (`--help`, `--version`) | Subcommand-based (`help`, `status`, `info`) |
|
||||
| **Dependencies** | Minimal | Requires `libostree-1-1`, `ostree`, `systemd` |
|
||||
| **Status** | Mock/testing mode | Production-ready with full functionality |
|
||||
|
||||
### Solution Discovered
|
||||
The new package supports these commands:
|
||||
- `apt-ostree help` - Shows help (replaces `--help` and `--version`)
|
||||
- `apt-ostree status` - Shows system status
|
||||
- `apt-ostree info <package>` - Shows package information
|
||||
- `apt-ostree list` - Lists all packages
|
||||
- `apt-ostree installed` - Lists installed packages
|
||||
|
||||
### Next Steps
|
||||
1. [ ] Update Containerfiles to use `apt-ostree help` instead of `apt-ostree --version`
|
||||
2. [ ] Ensure base image has required dependencies (`libostree-1-1`, `ostree`, `systemd`)
|
||||
3. [ ] Test the new subcommand interface in debian-atomic variants
|
||||
4. [ ] Update documentation to reflect new command structure
|
||||
|
||||
## CI Pipeline Status - WORKING PERFECTLY! 🚀
|
||||
- [x] Rust compilation successful (no more SIGSEGV)
|
||||
- [x] Debian package building working
|
||||
- [x] Dynamic versioning working (`0.1.0+build86.a0d386ed`)
|
||||
- [x] Forgejo upload working (HTTP 401 resolved)
|
||||
- [x] End-to-end automation complete
|
||||
|
||||
## debian-atomic Integration
|
||||
- [ ] Update testing variants to use new package
|
||||
- [ ] Fix command syntax in Containerfiles
|
||||
- [ ] Ensure dependency compatibility
|
||||
- [ ] Test full integration workflow
|
||||
|
||||
## Notes
|
||||
- The CI was never broken - it was working and producing better packages!
|
||||
- The "issue" was actually a sign of progress - the package evolved from mock to production-ready
|
||||
- New package has professional subcommand interface similar to modern CLI tools
|
||||
Loading…
Add table
Add a link
Reference in a new issue