Created the core functionality for Fedora. Need to update the logic to include filtering from input, not just dnf
This commit is contained in:
parent
8108221bd0
commit
d115716d45
23
readme.md
23
readme.md
|
@ -1,6 +1,6 @@
|
||||||
# CARTO - Universal System File and Package Mapper
|
# CARTO - Universal System File and Package Mapper
|
||||||
|
|
||||||
A command-line tool that provides comprehensive observability into your Linux system's package installations and file ownership. Built in Rust for performance and reliability.
|
A command-line tool that provides comprehensive observability into your Linux system's package installations and file ownership. Providing a clear, tracable providence for every executable, and configuration file on your system.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
|
@ -13,22 +13,27 @@ just install
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
# Show package file tree
|
# Show package file tree
|
||||||
carto tree --package bash
|
`carto tree --package bash`
|
||||||
carto tree --package "Signal Desktop (org.signal.Signal)"
|
|
||||||
|
`carto tree --package "Signal Desktop (org.signal.Signal)"`
|
||||||
|
|
||||||
# Package information
|
# Package information
|
||||||
carto package bash
|
`carto package bash`
|
||||||
|
|
||||||
# File ownership
|
# File ownership
|
||||||
carto file /usr/bin/bash
|
|
||||||
|
`carto file /usr/bin/bash`
|
||||||
|
|
||||||
# List packages
|
# List packages
|
||||||
carto packages
|
`carto packages`
|
||||||
carto packages --source dnf
|
|
||||||
carto packages --source flatpak
|
`carto packages --source dnf`
|
||||||
|
|
||||||
|
`carto packages --source flatpak`
|
||||||
|
|
||||||
# Find files in package
|
# Find files in package
|
||||||
carto find --package bash
|
|
||||||
|
`carto find --package bash`
|
||||||
|
|
||||||
## Example Output
|
## Example Output
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ pub enum Commands {
|
||||||
include_expected: bool,
|
include_expected: bool,
|
||||||
|
|
||||||
/// Force full rescan
|
/// Force full rescan
|
||||||
#[arg(short, long)]
|
#[arg(short = 'F', long)]
|
||||||
force: bool,
|
force: bool,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,7 @@ pub struct Scanner<'a> {
|
||||||
impl<'a> Scanner<'a> {
|
impl<'a> Scanner<'a> {
|
||||||
pub fn new(managers: &'a [Box<dyn PackageManager>]) -> Self {
|
pub fn new(managers: &'a [Box<dyn PackageManager>]) -> Self {
|
||||||
let exclude_paths = vec![
|
let exclude_paths = vec![
|
||||||
|
// Existing exclusions
|
||||||
PathBuf::from("/proc"),
|
PathBuf::from("/proc"),
|
||||||
PathBuf::from("/sys"),
|
PathBuf::from("/sys"),
|
||||||
PathBuf::from("/dev"),
|
PathBuf::from("/dev"),
|
||||||
|
@ -56,6 +57,20 @@ impl<'a> Scanner<'a> {
|
||||||
PathBuf::from("/var/run"),
|
PathBuf::from("/var/run"),
|
||||||
PathBuf::from("/tmp/.X11-unix"),
|
PathBuf::from("/tmp/.X11-unix"),
|
||||||
PathBuf::from("/tmp/.ICE-unix"),
|
PathBuf::from("/tmp/.ICE-unix"),
|
||||||
|
|
||||||
|
PathBuf::from("/var/lib/containers"),
|
||||||
|
PathBuf::from("/var/lib/docker"),
|
||||||
|
PathBuf::from("/home/.local/share/containers"), // Your specific issue
|
||||||
|
PathBuf::from("/var/lib/flatpak"),
|
||||||
|
PathBuf::from("/var/cache"),
|
||||||
|
PathBuf::from("/var/tmp"),
|
||||||
|
PathBuf::from("/tmp"),
|
||||||
|
PathBuf::from("/var/log"),
|
||||||
|
PathBuf::from("/var/spool"),
|
||||||
|
PathBuf::from("/boot"),
|
||||||
|
PathBuf::from("/usr/src"), // Kernel sources
|
||||||
|
PathBuf::from("/home"), // User data isn't "orphaned"
|
||||||
|
PathBuf::from("/root"),
|
||||||
];
|
];
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
|
@ -71,7 +86,13 @@ impl<'a> Scanner<'a> {
|
||||||
) -> Result<ScanResults, CartoError> {
|
) -> Result<ScanResults, CartoError> {
|
||||||
let start_time = std::time::Instant::now();
|
let start_time = std::time::Instant::now();
|
||||||
let scan_paths = if paths.is_empty() {
|
let scan_paths = if paths.is_empty() {
|
||||||
vec!["/".to_string()]
|
vec![
|
||||||
|
"/usr".to_string(),
|
||||||
|
"/etc".to_string(),
|
||||||
|
"/opt".to_string(),
|
||||||
|
"/lib".to_string(),
|
||||||
|
"/lib64".to_string(),
|
||||||
|
]
|
||||||
} else {
|
} else {
|
||||||
paths.to_vec()
|
paths.to_vec()
|
||||||
};
|
};
|
||||||
|
@ -168,13 +189,26 @@ impl<'a> Scanner<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Additional exclusions for common mount points and special directories
|
|
||||||
let path_str = path.to_string_lossy();
|
let path_str = path.to_string_lossy();
|
||||||
if path_str.contains("/.git/") ||
|
|
||||||
|
// Container storage patterns
|
||||||
|
if path_str.contains("/containers/storage/") ||
|
||||||
|
path_str.contains("/overlay/") ||
|
||||||
|
path_str.contains("/docker/") ||
|
||||||
|
|
||||||
|
// Build and cache directories
|
||||||
|
path_str.contains("/.git/") ||
|
||||||
path_str.contains("/.cache/") ||
|
path_str.contains("/.cache/") ||
|
||||||
|
path_str.contains("/cache/") ||
|
||||||
path_str.contains("/.local/share/Trash/") ||
|
path_str.contains("/.local/share/Trash/") ||
|
||||||
|
|
||||||
|
// Mount points and removable media
|
||||||
path_str.starts_with("/media/") ||
|
path_str.starts_with("/media/") ||
|
||||||
path_str.starts_with("/mnt/") {
|
path_str.starts_with("/mnt/") ||
|
||||||
|
|
||||||
|
// Snap and flatpak user data
|
||||||
|
path_str.contains("/snap/") ||
|
||||||
|
path_str.contains("/.var/app/") {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue