Skip to content

Commit

Permalink
fix: remove mke2fs from linux bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
Xtr126 committed Feb 15, 2024
1 parent ff813d6 commit 5f7060e
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 21 deletions.
Binary file removed src-tauri/mke2fs-x86_64-unknown-linux-gnu
Binary file not shown.
11 changes: 11 additions & 0 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ async fn create_data_img(
let data_img_path = file_path.join("data.img");

use tauri::api::process::Command;

#[cfg(windows)]
let output = Command::new_sidecar("mke2fs")
.map_err(|err| err.to_string())?
.args([
Expand All @@ -78,6 +80,15 @@ async fn create_data_img(
format!("{size}G").as_str()
])
.output().map_err(|err| err.to_string())?;

#[cfg(target_os = "linux")]
let output = Command::new("mkfs.ext4")
.args([
"-F", "-b", "4096", "-L", "/data", "-t", "ext4",
&data_img_path.display().to_string(),
format!("{size}G").as_str()
])
.output().map_err(|err| err.to_string())?;

remove_dir(file_path.join("data")).map_err(|err| err.to_string())?;

Expand Down
21 changes: 1 addition & 20 deletions src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,7 @@
"all": false,
"shell": {
"all": false,
"open": true,
"scope": [
{
"name": "mke2fs",
"sidecar": true,
"args": [
"-F",
"-b",
"4096",
"-L",
"/data",
"-t",
"ext4",
{ "validator": "\\S+" },
{ "validator": "\\S+" }
]
}
]
"open": true
},
"dialog": {
"all": false,
Expand All @@ -56,7 +39,6 @@
"deb": {
"depends": []
},
"externalBin": [ "mke2fs" ],
"icon": [
"icons/32x32.png",
"icons/128x128.png",
Expand All @@ -73,7 +55,6 @@
"providerShortName": null,
"signingIdentity": null
},
"resources": ["mke2fs.conf"],
"shortDescription": "",
"targets": "all",
"windows": {
Expand Down
27 changes: 26 additions & 1 deletion src-tauri/tauri.windows.conf.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,33 @@
{
"tauri": {
"allowlist": {
"shell": {
"all": false,
"execute": false,
"open": false,
"scope": [
{
"name": "mke2fs",
"sidecar": true,
"args": [
"-F",
"-b",
"4096",
"-L",
"/data",
"-t",
"ext4",
{ "validator": "\\S+" },
{ "validator": "\\S+" }
]
}
]
}
},
"bundle": {
"resources": ["mke2fs.conf",
"*.dll"]
"*.dll"],
"externalBin": [ "mke2fs" ]
}
}
}

0 comments on commit 5f7060e

Please sign in to comment.