Skip to content

Commit e87c0f9

Browse files
authored
Merge pull request #20 from wizard-28/rem/mainline
rem!: remove `mainline` flag
2 parents fc23e1a + 118722d commit e87c0f9

4 files changed

Lines changed: 2 additions & 84 deletions

File tree

src/cli.rs

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pub enum Commands {
3737
#[clap(group(
3838
ArgGroup::new("operations")
3939
.multiple(true)
40-
.args(&["mainline", "pacstall", "snapdpurge"]),
40+
.args(&["pacstall", "snapdpurge"]),
4141
))]
4242
pub struct EnableCommand {
4343
/// Run interactively
@@ -50,14 +50,6 @@ pub struct EnableCommand {
5050
#[clap(short, long)]
5151
pub interactive: bool,
5252

53-
/// Enable the latest Linux mainline kernel
54-
///
55-
/// The latest kernel can be enabled via the rhino-config enable command.
56-
/// This will download, install and keep the latest Linux kernel updated
57-
/// via the Ubuntu mainline repositories
58-
#[clap(short, long)]
59-
pub mainline: bool,
60-
6153
/// Enable Pacstall, an additional AUR-like package manager for Ubuntu
6254
///
6355
/// Pacstall can be enabled via the rhino-config enable command. This will
@@ -81,17 +73,9 @@ pub struct EnableCommand {
8173
ArgGroup::new("operations")
8274
.required(true)
8375
.multiple(true)
84-
.args(&["mainline", "pacstall", "snapdpurge"]),
76+
.args(&["pacstall", "snapdpurge"]),
8577
))]
8678
pub struct DisableCommand {
87-
/// Disable the latest Linux mainline kernel
88-
///
89-
/// This disables the mainline kernel from being continually updated. If it
90-
/// was enabled then it will still be installed on your system, however you
91-
/// can revert to the kernel provided by Ubuntu in your grub menu
92-
#[clap(short, long)]
93-
pub mainline: bool,
94-
9579
/// Disable Pacstall, an additional AUR-like package manager for Ubuntu
9680
///
9781
/// This disables and uninstalls Pacstall from your system. Pacstall will

src/commands/disable.rs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@ use std::process::Command;
44

55
use anyhow::{ensure, Context, Result};
66

7-
pub fn mainline(config_path: &Path) -> Result<()> {
8-
fs::remove_file(&config_path).context("Unable to remove mainline config file!")?;
9-
println!("Mainline kernel has been disabled.");
10-
11-
Ok(())
12-
}
137
pub fn pacstall(config_path: &Path) -> Result<()> {
148
fs::remove_file(&config_path).context("Unable to remove pacstall config file!")?;
159
println!("Pacstall has been disabled.");
@@ -79,18 +73,6 @@ mod tests {
7973
#[fixture]
8074
fn temp_dir() -> TempDir { tempdir().unwrap() }
8175

82-
#[rstest]
83-
fn test_mainline(temp_dir: TempDir) -> Result<(), Box<dyn Error>> {
84-
let config_path = temp_dir.path().join("mainline");
85-
File::create(&config_path)?;
86-
87-
super::mainline(&config_path)?;
88-
// Test that the config file is deleted
89-
assert!(!config_path.exists());
90-
91-
Ok(())
92-
}
93-
9476
#[rstest]
9577
fn test_pacstall(temp_dir: TempDir) -> Result<(), Box<dyn Error>> {
9678
let config_path = temp_dir.path().join("pacstall");

src/commands/enable.rs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,6 @@ use std::process::Command;
55
use anyhow::{ensure, Context, Result};
66
use indoc::indoc;
77

8-
pub fn mainline(config_path: &Path) -> Result<()> {
9-
File::create(config_path).context("Failed to create the mainline config file!")?;
10-
println!(
11-
r#"The mainline kernel has been enabled - please run "rhino-update" to update your system."#
12-
);
13-
Ok(())
14-
}
15-
168
pub fn pacstall(config_path: &Path) -> Result<()> {
179
File::create(config_path).context("Unable to create pacstall config!")?;
1810

@@ -88,17 +80,6 @@ mod tests {
8880
#[fixture]
8981
fn temp_dir() -> TempDir { tempdir().unwrap() }
9082

91-
#[rstest]
92-
fn test_mainline(temp_dir: TempDir) -> Result<(), Box<dyn Error>> {
93-
let config_path = temp_dir.path().join("mainline");
94-
95-
super::mainline(&config_path)?;
96-
// Test that the config file is created
97-
assert!(config_path.exists());
98-
99-
Ok(())
100-
}
101-
10283
#[rstest]
10384
fn test_pacstall(temp_dir: TempDir) -> Result<(), Box<dyn Error>> {
10485
let config_path = temp_dir.path().join("pacstall");

src/main.rs

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -51,25 +51,13 @@ fn main() -> Result<()> {
5151
fs::create_dir_all(&config_path).context("Failed to create config directory!")?;
5252

5353
let pacstall_config_path = config_path.join("pacstall");
54-
let mainline_config_path = config_path.join("mainline");
5554

5655
let snapdpurge_config_path = config_path.join("snapdpurge");
5756
let snapdpurge_snap_path = home_path.join("snap/");
5857

5958
match &cli.command {
6059
Commands::Enable(flag) => {
6160
if flag.interactive {
62-
if !mainline_config_path.exists() {
63-
if ask("Do you wish to install the Linux mainline kernel?") {
64-
enable::mainline(&mainline_config_path)?;
65-
} else {
66-
println!(
67-
"No changes were made to the Rhino configuration, the mainline kernel \
68-
will not be installed."
69-
);
70-
}
71-
}
72-
7361
if !snapdpurge_config_path.exists() {
7462
if ask("Do you wish to remove Snapcraft (snapd) and replace it with Flatpak?") {
7563
enable::snapdpurge(&snapdpurge_config_path, &snapdpurge_snap_path)?;
@@ -96,14 +84,6 @@ fn main() -> Result<()> {
9684
}
9785
}
9886

99-
if flag.mainline {
100-
ensure!(
101-
!mainline_config_path.exists(),
102-
"Mainine kernel is already enabled!"
103-
);
104-
enable::mainline(&mainline_config_path)?;
105-
}
106-
10787
if flag.snapdpurge {
10888
ensure!(
10989
!snapdpurge_config_path.exists(),
@@ -123,15 +103,6 @@ fn main() -> Result<()> {
123103
Ok(())
124104
},
125105
Commands::Disable(flag) => {
126-
if flag.mainline {
127-
ensure!(
128-
mainline_config_path.exists(),
129-
"Mainline kernel is already disabled!"
130-
);
131-
132-
disable::mainline(&mainline_config_path)?;
133-
}
134-
135106
if flag.snapdpurge {
136107
ensure!(
137108
snapdpurge_config_path.exists(),

0 commit comments

Comments
 (0)