···99use std::fs::File;
1010use std::io::{Read, Write};
1111use std::path::Path;
1212-use std::process::Command;
1212+use std::process::{exit, Command};
1313use std::time::Duration;
1414use steamlocate::SteamDir;
1515use sudo::RunningAs;
···137137 .expect("Could not copy webfishing.app");
138138}
139139140140+fn sign_webfishing() {
141141+ Command::new("xattr")
142142+ .arg("-cr")
143143+ .arg("build/webfishing.app")
144144+ .output()
145145+ .expect("Could not execute xattr");
146146+147147+ Command::new("rm")
148148+ .arg("build/signing-step")
149149+ .output()
150150+ .expect("Could not remove signing-step file");
151151+152152+ println!("Webfishing is in the build folder !");
153153+154154+ Text::new("Press Enter to quit")
155155+ .prompt()
156156+ .expect("Could not confirm to quit");
157157+158158+159159+}
160160+140161#[tokio::main]
141162async fn main() {
142142- if sudo::check() != RunningAs::Root {
143143- println!("You need to be root to run this program");
163163+ if sudo::check() == RunningAs::Root && Path::new("build/signing-step").exists() {
164164+ sign_webfishing();
165165+ exit(0);
144166 }
145145- sudo::escalate_if_needed().expect("Could not escalate");
146167147168 set_current_dir(
148169 current_exe()
···223244 .write(bytes)
224245 .expect("Could not write to webfishing.pck");
225246226226- Command::new("xattr")
227227- .arg("-cr")
228228- .arg("build/webfishing.app")
229229- .output()
230230- .expect("Could not execute xattr");
247247+ File::create("build/signing-step").expect("Could not create signing step file");
231248232232- println!("Webfishing is in the build folder !");
249249+ if sudo::check() != RunningAs::Root {
250250+ println!("In order to sign the app, you need to be root");
251251+ sudo::escalate_if_needed().expect("Could not escalate");
252252+ exit(1);
253253+ }
233254234234- Text::new("Press Enter to quit")
235235- .prompt()
236236- .expect("Could not confirm to quit");
255255+ sign_webfishing();
237256}