Correctly set maintenance tool as executable on unix platforms

This commit is contained in:
James Lonie 2018-05-03 14:51:44 +10:00
parent a174c265d4
commit e7175ae880

View File

@ -34,6 +34,7 @@ use config::Config;
use http::stream_file; use http::stream_file;
use sources::types::Version; use sources::types::Version;
use std::fs::OpenOptions;
/// A message thrown during the installation of packages. /// A message thrown during the installation of packages.
#[derive(Serialize)] #[derive(Serialize)]
@ -364,7 +365,18 @@ impl InstallerFramework {
let new_app = path.join(platform_extension); let new_app = path.join(platform_extension);
let mut new_app_file = match File::create(new_app) { let mut file_metadata = OpenOptions::new();
file_metadata.write(true)
.create_new(true);
#[cfg(unix)]
{
use std::os::unix::fs::OpenOptionsExt;
file_metadata.mode(0o770);
}
let mut new_app_file = match file_metadata.open(new_app) {
Ok(v) => v, Ok(v) => v,
Err(v) => return Err(format!("Unable to open installer binary: {:?}", v)), Err(v) => return Err(format!("Unable to open installer binary: {:?}", v)),
}; };