Skip to content

Commit 35b4e90

Browse files
larp0Copilot
andauthored
Update src/utils/ssh_deploy/deployments/solana.rs
Co-authored-by: Copilot <[email protected]>
1 parent bbdb2df commit 35b4e90

File tree

1 file changed

+27
-14
lines changed

1 file changed

+27
-14
lines changed

src/utils/ssh_deploy/deployments/solana.rs

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -193,23 +193,36 @@ fn install_solana_cli(
193193
}
194194
Some("firedancer") => {
195195
// Install Firedancer client
196-
// First install dependencies
197-
client.execute_command("sudo apt-get update && sudo apt-get install -y build-essential cmake pkg-config libssl-dev")?;
198-
199-
// Clone and build Firedancer
200-
client.execute_command("git clone https://github.com/firedancer-io/firedancer.git /tmp/firedancer")?;
201-
client.execute_command("cd /tmp/firedancer && make -j")?;
202-
203-
// Install Firedancer binaries
204-
client.execute_command("sudo mkdir -p /opt/firedancer/bin")?;
205-
client.execute_command("sudo cp /tmp/firedancer/build/bin/* /opt/firedancer/bin/")?;
196+
let temp_dir = "/tmp/firedancer";
197+
let cleanup = || {
198+
let _ = client.execute_command(&format!("rm -rf {}", temp_dir));
199+
};
206200

207-
// Create symlinks for compatibility
208-
client.execute_command("sudo ln -sf /opt/firedancer/bin/fdctl /usr/local/bin/solana-validator")?;
209-
client.execute_command("sudo ln -sf /opt/firedancer/bin/fd_keygen /usr/local/bin/solana-keygen")?;
201+
// Wrap installation steps in error handling
202+
if let Err(e) = (|| -> Result<(), DeploymentError> {
203+
// First install dependencies
204+
client.execute_command("sudo apt-get update && sudo apt-get install -y build-essential cmake pkg-config libssl-dev")?;
205+
206+
// Clone and build Firedancer
207+
client.execute_command(&format!("git clone https://github.com/firedancer-io/firedancer.git {}", temp_dir))?;
208+
client.execute_command(&format!("cd {} && make -j", temp_dir))?;
209+
210+
// Install Firedancer binaries
211+
client.execute_command("sudo mkdir -p /opt/firedancer/bin")?;
212+
client.execute_command("sudo cp /tmp/firedancer/build/bin/* /opt/firedancer/bin/")?;
213+
214+
// Create symlinks for compatibility
215+
client.execute_command("sudo ln -sf /opt/firedancer/bin/fdctl /usr/local/bin/solana-validator")?;
216+
client.execute_command("sudo ln -sf /opt/firedancer/bin/fd_keygen /usr/local/bin/solana-keygen")?;
217+
218+
Ok(())
219+
})() {
220+
cleanup();
221+
return Err(e);
222+
}
210223

211224
// Clean up
212-
client.execute_command("rm -rf /tmp/firedancer")?;
225+
cleanup();
213226
}
214227
Some("sig") => {
215228
// Install Sig (Solana Zig Validator)

0 commit comments

Comments
 (0)