···9use std::fs::File;
10use std::io::{Read, Write};
11use std::path::Path;
12-use std::process::Command;
13use std::time::Duration;
14use steamlocate::SteamDir;
15use sudo::RunningAs;
···137 .expect("Could not copy webfishing.app");
138}
139000000000000000000000140#[tokio::main]
141async fn main() {
142- if sudo::check() != RunningAs::Root {
143- println!("You need to be root to run this program");
0144 }
145- sudo::escalate_if_needed().expect("Could not escalate");
146147 set_current_dir(
148 current_exe()
···223 .write(bytes)
224 .expect("Could not write to webfishing.pck");
225226- Command::new("xattr")
227- .arg("-cr")
228- .arg("build/webfishing.app")
229- .output()
230- .expect("Could not execute xattr");
231232- println!("Webfishing is in the build folder !");
0000233234- Text::new("Press Enter to quit")
235- .prompt()
236- .expect("Could not confirm to quit");
237}
···9use std::fs::File;
10use std::io::{Read, Write};
11use std::path::Path;
12+use std::process::{exit, Command};
13use std::time::Duration;
14use steamlocate::SteamDir;
15use sudo::RunningAs;
···137 .expect("Could not copy webfishing.app");
138}
139140+fn sign_webfishing() {
141+ Command::new("xattr")
142+ .arg("-cr")
143+ .arg("build/webfishing.app")
144+ .output()
145+ .expect("Could not execute xattr");
146+147+ Command::new("rm")
148+ .arg("build/signing-step")
149+ .output()
150+ .expect("Could not remove signing-step file");
151+152+ println!("Webfishing is in the build folder !");
153+154+ Text::new("Press Enter to quit")
155+ .prompt()
156+ .expect("Could not confirm to quit");
157+158+159+}
160+161#[tokio::main]
162async fn main() {
163+ if sudo::check() == RunningAs::Root && Path::new("build/signing-step").exists() {
164+ sign_webfishing();
165+ exit(0);
166 }
0167168 set_current_dir(
169 current_exe()
···244 .write(bytes)
245 .expect("Could not write to webfishing.pck");
246247+ File::create("build/signing-step").expect("Could not create signing step file");
0000248249+ if sudo::check() != RunningAs::Root {
250+ println!("In order to sign the app, you need to be root");
251+ sudo::escalate_if_needed().expect("Could not escalate");
252+ exit(1);
253+ }
254255+ sign_webfishing();
00256}