mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-12-01 19:44:39 +03:00
fix(bundler): Fix DMG script (#283)
- Fix sips command - Copy seticon from templates folder - Only cp bg.png if it exists
This commit is contained in:
parent
e3d21dae5f
commit
2b28b52097
@ -6,9 +6,10 @@ use handlebars::Handlebars;
|
||||
use lazy_static::lazy_static;
|
||||
|
||||
use std::collections::BTreeMap;
|
||||
use std::fs::write;
|
||||
use std::fs::{File, write};
|
||||
use std::path::PathBuf;
|
||||
use std::process::{Command, Stdio};
|
||||
use std::io::Write;
|
||||
|
||||
// Create handlebars template for shell scripts
|
||||
lazy_static! {
|
||||
@ -50,11 +51,18 @@ pub fn bundle_project(settings: &Settings) -> crate::Result<Vec<PathBuf>> {
|
||||
// write the scripts
|
||||
write(&bundle_sh, bundle_temp).or_else(|e| Err(e.to_string()))?;
|
||||
|
||||
// copy seticon binary
|
||||
let seticon = include_bytes!("templates/seticon");
|
||||
let seticon_out = &output_path.join("seticon");
|
||||
let mut seticon_buffer = File::create(seticon_out).or_else(|e| Err(e.to_string()))?;
|
||||
seticon_buffer.write_all(seticon).or_else(|e| Err(e.to_string()))?;
|
||||
|
||||
// chmod script for execution
|
||||
|
||||
Command::new("chmod")
|
||||
.arg("777")
|
||||
.arg(&bundle_sh)
|
||||
.arg(&seticon_out)
|
||||
.current_dir(output_path)
|
||||
.stdout(Stdio::piped())
|
||||
.stderr(Stdio::piped())
|
||||
|
@ -73,6 +73,8 @@ const ALL_PACKAGE_TYPES: &[PackageType] = &[
|
||||
PackageType::WindowsMsi,
|
||||
PackageType::OsxBundle,
|
||||
PackageType::Rpm,
|
||||
#[cfg(feature = "dmg")]
|
||||
PackageType::Dmg,
|
||||
];
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
|
@ -34,7 +34,7 @@ sleep 5
|
||||
bless --folder "${MOUNT_DIR}" -label "${MACOS_APP_NAME}"
|
||||
|
||||
test -d "${MOUNT_DIR}/.background" || mkdir "${MOUNT_DIR}/.background"
|
||||
cp ../../icons/bg.png "${MOUNT_DIR}"/.background/bg.png
|
||||
test -f ../../icons/bg.png && cp ../../icons/bg.png "${MOUNT_DIR}"/.background/bg.png
|
||||
|
||||
# I couldn't get DeRez and Rez to work. Leaving it here in case its helpful in the future.
|
||||
### DeRez -only icns "${MOUNT_DIR}/.VolumeIcon.icns" > "${MOUNT_DIR}/.VolumeIcon.rsrc"
|
||||
@ -46,7 +46,7 @@ VERSION=$(sw_vers -productVersion | cut -d'.' -f2)
|
||||
|
||||
if [ "$VERSION" -gt 12 ]; then
|
||||
echo "Using SIPS v10.13+"
|
||||
sips --i "${MOUNT_DIR}/.VolumeIcon.icns" # 10.13+
|
||||
sips -i "${MOUNT_DIR}/.VolumeIcon.icns" # 10.13+
|
||||
else
|
||||
echo "Using SIPS v10.12-"
|
||||
sips --addIcon "${MOUNT_DIR}/.VolumeIcon.icns"
|
||||
|
Loading…
Reference in New Issue
Block a user