fix: change to home dir before installing Ahoy

This commit is contained in:
rzmk 2025-08-18 13:28:36 -04:00
parent dfdfad0217
commit acd5a94664

View file

@ -50,6 +50,7 @@ fn main() -> Result<()> {
if ans { if ans {
let sh = Shell::new()?; let sh = Shell::new()?;
let username = cmd!(sh, "whoami").read()?;
println!( println!(
"\n{} Running {} and {}...", "\n{} Running {} and {}...",
"1.".if_supports_color(Stdout, |t| t.style(step_style)), "1.".if_supports_color(Stdout, |t| t.style(step_style)),
@ -80,7 +81,6 @@ fn main() -> Result<()> {
"✅ 2. Successfully installed curl and enabled SSH." "✅ 2. Successfully installed curl and enabled SSH."
.if_supports_color(Stdout, |t| t.style(success_style)) .if_supports_color(Stdout, |t| t.style(success_style))
); );
let username = cmd!(sh, "whoami").read()?;
let dpkg_l_output = cmd!(sh, "dpkg -l").read()?; let dpkg_l_output = cmd!(sh, "dpkg -l").read()?;
let has_docker = cmd!(sh, "grep docker") let has_docker = cmd!(sh, "grep docker")
@ -121,6 +121,7 @@ fn main() -> Result<()> {
"\n{} Installing Ahoy...", "\n{} Installing Ahoy...",
"4.".if_supports_color(Stdout, |t| t.style(step_style)), "4.".if_supports_color(Stdout, |t| t.style(step_style)),
); );
sh.change_dir(format!("/home/{username}"));
cmd!(sh, "sudo curl -LO https://github.com/ahoy-cli/ahoy/releases/download/v2.5.0/ahoy-bin-linux-amd64").run()?; cmd!(sh, "sudo curl -LO https://github.com/ahoy-cli/ahoy/releases/download/v2.5.0/ahoy-bin-linux-amd64").run()?;
cmd!(sh, "mv ./ahoy-bin-linux-amd64 ./ahoy").run()?; cmd!(sh, "mv ./ahoy-bin-linux-amd64 ./ahoy").run()?;
cmd!(sh, "sudo chmod +x ./ahoy").run()?; cmd!(sh, "sudo chmod +x ./ahoy").run()?;