mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-11-28 03:47:37 +03:00
fix(tauri) use appimagetool to build, finish script run, proper AppRun (#682)
This commit is contained in:
parent
02317dce9c
commit
ea74c5cc01
5
.changes/appimage_fix.md
Normal file
5
.changes/appimage_fix.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
"tauri-bundler": minor
|
||||
---
|
||||
|
||||
Fixes AppImage bundler (appimagetool usage, build script running properly, proper AppRun and .desktop files).
|
@ -64,7 +64,7 @@ pub fn bundle_project(settings: &Settings) -> crate::Result<Vec<PathBuf>> {
|
||||
let temp = HANDLEBARS.render("appimage", &sh_map)?;
|
||||
|
||||
// create the shell script file in the target/ folder.
|
||||
let sh_file = output_path.join("build_appimage");
|
||||
let sh_file = output_path.join("build_appimage.sh");
|
||||
common::print_bundling(format!("{:?}", &appimage_path).as_str())?;
|
||||
write(&sh_file, temp)?;
|
||||
|
||||
@ -79,14 +79,19 @@ pub fn bundle_project(settings: &Settings) -> crate::Result<Vec<PathBuf>> {
|
||||
.expect("Failed to chmod script");
|
||||
|
||||
// execute the shell script to build the appimage.
|
||||
Command::new(&sh_file)
|
||||
let status = Command::new(&sh_file)
|
||||
.current_dir(output_path)
|
||||
.stdout(Stdio::piped())
|
||||
.stderr(Stdio::piped())
|
||||
.spawn()
|
||||
.status()
|
||||
.expect("Failed to execute shell script");
|
||||
|
||||
remove_dir_all(&package_dir)?;
|
||||
|
||||
Ok(vec![appimage_path])
|
||||
if !status.success() {
|
||||
Err(crate::Error::ShellScriptError(
|
||||
"error running build_appimage.sh".to_owned(),
|
||||
))
|
||||
} else {
|
||||
remove_dir_all(&package_dir)?;
|
||||
Ok(vec![appimage_path])
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,9 @@ cp -r ../deb/{{bundle_name}}/data/usr {{app_name}}.AppDir
|
||||
|
||||
cd {{app_name}}.AppDir
|
||||
|
||||
cp usr/bin/{{app_name}} AppRun
|
||||
wget -q -O AppRun https://github.com/AppImage/AppImageKit/releases/download/continuous/AppRun-x86_64
|
||||
chmod +x AppRun
|
||||
|
||||
cp usr/share/icons/hicolor/256x256/apps/{{app_name}}.png {{app_name}}.png
|
||||
|
||||
cd ..
|
||||
@ -21,10 +23,10 @@ echo 'Type=Application' >> {{app_name}}.desktop
|
||||
echo 'Categories=X-Web;' >> {{app_name}}.desktop
|
||||
|
||||
cp {{app_name}}.desktop {{app_name}}.AppDir/usr/share/applications/{{app_name}}.desktop
|
||||
mv {{app_name}}.desktop {{app_name}}.AppDir/{{app_name}}.desktop
|
||||
|
||||
mksquashfs {{app_name}}.AppDir {{app_name}}.squashfs -root-owned -noappend
|
||||
|
||||
wget -q -O runtime https://github.com/AppImage/AppImageKit/releases/download/continuous/runtime-x86_64
|
||||
cat runtime > {{app_name}}.AppImage
|
||||
cat {{app_name}}.squashfs >> {{app_name}}.AppImage
|
||||
chmod a+x {{app_name}}.AppImage
|
||||
wget -q -O appimagetool https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage
|
||||
chmod +x appimagetool
|
||||
./appimagetool {{app_name}}.AppDir {{app_name}}.AppImage
|
||||
|
Loading…
Reference in New Issue
Block a user