feat: add the possibility to put unwanted packages to lists and update gnome extra list

This commit is contained in:
2025-05-02 00:18:01 +02:00
parent 2924d921dc
commit ad6935b82c
2 changed files with 40 additions and 4 deletions

View File

@@ -1,8 +1,18 @@
gnome-firmware gnome-firmware
gnome-tweaks gnome-tweaks
gnome-extensions-app gnome-extensions-app
gnome-sound-recorder
gnome-usage
decibels
fragments
gnome-shell-extension-appindicator gnome-shell-extension-appindicator
gnome-shell-extension-dash-to-dock gnome-shell-extension-dash-to-dock
gnome-shell-extension-caffeine gnome-shell-extension-caffeine
gnome-shell-extension-gsconnect gnome-shell-extension-gsconnect
gnome-shell-extension-system-monitor gnome-shell-extension-system-monitor
# Unwanted packages
-rhythmbox
-transmission-gtk
-gnome-tour
-yelp

View File

@@ -238,15 +238,15 @@ fn manage_list(list: String, remove: bool) -> Result<()> {
let packages = list let packages = list
.lines() .lines()
.map(|line| line.trim()) .map(|line| line.trim())
.filter(|line| !line.is_empty()) .filter(|line| !line.is_empty() && !line.starts_with('#') && !line.starts_with('-'))
.collect::<Vec<_>>(); .collect::<Vec<_>>();
let mut dnf_cmd = std::process::Command::new("dnf"); let mut dnf_cmd = std::process::Command::new("dnf");
if remove { if remove {
log::info!("Removing common list..."); log::info!("Removing wanted list's packages...");
dnf_cmd.arg("remove"); dnf_cmd.arg("remove");
} else { } else {
log::info!("Installing common list..."); log::info!("Installing wanted list's packages...");
dnf_cmd.arg("install").arg("--allowerasing"); dnf_cmd.arg("install").arg("--allowerasing");
} }
@@ -256,6 +256,32 @@ fn manage_list(list: String, remove: bool) -> Result<()> {
dnf_cmd.status()?; dnf_cmd.status()?;
let packages = list
.lines()
.map(|line| line.trim())
.filter(|line| !line.is_empty() && !line.starts_with('#') && line.starts_with('-'))
.map(|line| line.trim_start_matches('-').trim())
.collect::<Vec<_>>();
if packages.is_empty() {
return Ok(());
}
let mut dnf_cmd = std::process::Command::new("dnf");
if remove {
log::info!("Re-installing unwanted list's packages...");
dnf_cmd.arg("install").arg("--allowerasing");
} else {
log::info!("Removing unwanted list's packages...");
dnf_cmd.arg("remove");
}
packages.iter().for_each(|package| {
dnf_cmd.arg(package);
});
dnf_cmd.status()?;
Ok(()) Ok(())
} }