diff --git a/src/cli/subcommand/uninstall.rs b/src/cli/subcommand/uninstall.rs index 61d4771..ca78c14 100644 --- a/src/cli/subcommand/uninstall.rs +++ b/src/cli/subcommand/uninstall.rs @@ -94,33 +94,6 @@ impl CommandExecute for Uninstall { } } - // During install, `nix-installer` will store a copy of itself in `/nix/nix-installer` - // If the user opted to run that particular copy of `nix-installer` to do this uninstall, - // well, we have a problem, since the binary would delete itself. - // Instead, detect if we're in that location, if so, move the binary and `execv` it. - if let Ok(current_exe) = std::env::current_exe() { - if current_exe.as_path() == Path::new("/nix/nix-installer") { - tracing::debug!( - "Detected uninstall from `/nix/nix-installer`, moving executable and re-executing" - ); - let temp = std::env::temp_dir(); - let temp_exe = temp.join("nix-installer"); - tokio::fs::copy(¤t_exe, &temp_exe) - .await - .wrap_err("Copying `nix-installer` to tempdir")?; - let args = std::env::args(); - let mut arg_vec_cstring = vec![]; - for arg in args { - arg_vec_cstring.push(CString::new(arg).wrap_err("Making arg into C string")?); - } - let temp_exe_cstring = CString::new(temp_exe.to_string_lossy().into_owned()) - .wrap_err("Making C string of executable path")?; - - nix::unistd::execv(&temp_exe_cstring, &arg_vec_cstring) - .wrap_err("Executing copied `nix-installer`")?; - } - } - let install_receipt_string = tokio::fs::read_to_string(receipt) .await .wrap_err("Reading receipt")?;