mirror of
https://github.com/EFForg/rayhunter.git
synced 2026-04-28 00:20:00 -07:00
Do not overwrite configs by default
On tplink and orbic, do not overwrite config files by default. There is a new flag `installer orbic --reset-config` that one can use to restore the old behavior. This fixes #778, a long-standing issue existent since 0.3.0. The businesslogic for config file overrides is shared to some degree. The Install trait from pinephone.rs has been moved out and renamed to DeviceConnection for that purpose, so that `install_config` can be shared across installers, which in turn can delegate to the trait for running commands and copying files. This also works towards #542. However, the pinephone and other installers have not been adapted to support --reset-config out of fear of regressions. A future refactor by somebody with ability to test on pinephone should probably also consider using the same DeviceConnection impl as orbic, if possible.
This commit is contained in:
committed by
Will Greenberg
parent
9e08e662ff
commit
d607c63cc8
@@ -5,6 +5,7 @@ use env_logger::Env;
|
||||
#[cfg(not(target_os = "android"))]
|
||||
use anyhow::bail;
|
||||
|
||||
mod connection;
|
||||
#[cfg(not(target_os = "android"))]
|
||||
mod orbic;
|
||||
mod orbic_auth;
|
||||
@@ -79,10 +80,18 @@ struct InstallTpLink {
|
||||
/// your custom path may conflict with the builtin storage functionality.
|
||||
#[arg(long, default_value = "")]
|
||||
sdcard_path: String,
|
||||
|
||||
/// Overwrite config.toml even if it already exists on the device.
|
||||
#[arg(long)]
|
||||
reset_config: bool,
|
||||
}
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
struct InstallOrbic {}
|
||||
struct InstallOrbic {
|
||||
/// Overwrite config.toml even if it already exists on the device.
|
||||
#[arg(long)]
|
||||
reset_config: bool,
|
||||
}
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
struct OrbicNetworkArgs {
|
||||
@@ -97,6 +106,10 @@ struct OrbicNetworkArgs {
|
||||
/// Admin password for authentication.
|
||||
#[arg(long)]
|
||||
admin_password: Option<String>,
|
||||
|
||||
/// Overwrite config.toml even if it already exists on the device.
|
||||
#[arg(long)]
|
||||
reset_config: bool,
|
||||
}
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
@@ -231,8 +244,8 @@ async fn run(args: Args) -> Result<(), Error> {
|
||||
Command::Pinephone(_) => pinephone::install().await
|
||||
.context("Failed to install rayhunter on the Pinephone's Quectel modem")?,
|
||||
#[cfg(not(target_os = "android"))]
|
||||
Command::OrbicUsb(_) => orbic::install().await.context("\nFailed to install rayhunter on the Orbic RC400L (USB installer)")?,
|
||||
Command::Orbic(args) => orbic_network::install(args.admin_ip, args.admin_username, args.admin_password).await.context("\nFailed to install rayhunter on the Orbic RC400L")?,
|
||||
Command::OrbicUsb(args) => orbic::install(args.reset_config).await.context("\nFailed to install rayhunter on the Orbic RC400L (USB installer)")?,
|
||||
Command::Orbic(args) => orbic_network::install(args.admin_ip, args.admin_username, args.admin_password, args.reset_config).await.context("\nFailed to install rayhunter on the Orbic RC400L")?,
|
||||
Command::Wingtech(args) => wingtech::install(args).await.context("\nFailed to install rayhunter on the Wingtech CT2MHS01")?,
|
||||
Command::Util(subcommand) => {
|
||||
match subcommand.command {
|
||||
|
||||
Reference in New Issue
Block a user