Skip to content
This repository has been archived by the owner on Jan 12, 2025. It is now read-only.

Commit

Permalink
pkgs: set file permissions post-install
Browse files Browse the repository at this point in the history
Currently 755 (probably always going to be that tbh)

Signed-off-by: Dylan Turner <[email protected]>
  • Loading branch information
blueOkiris committed Mar 6, 2023
1 parent 5cecde6 commit f6e8e8a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/pkg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
use std::{
path::Path,
fs::{
File, create_dir_all, read_to_string, remove_file
File, create_dir_all, read_to_string, remove_file, Permissions
}, io::{
Write, copy
}, process::{
Stdio, Command
}
}, os::unix::fs::PermissionsExt
};
use dirs::home_dir;
use reqwest::blocking::get;
Expand All @@ -29,6 +29,7 @@ use version_compare::{
const PKG_LIST_URL: &'static str =
"https://raw.githubusercontent.com/blueOkiris/aip-man-pkg-list/main/pkgs.json";
pub const APP_DIR: &'static str = "Applications";
pub const PERMISSION: u32 = 0o755; // -rwxr-xr-x.

/// Structure used to parse JSON info from package list.
#[derive(Clone, Debug, Serialize, Deserialize)]
Expand Down Expand Up @@ -77,6 +78,10 @@ impl Package {
"{}/{}-{}.AppImage", app_dir.as_os_str().to_str().unwrap(), self.name, self.version
)).expect("Failed to save file");
copy(&mut pkg_file, &mut out).expect("Failed to write package content to file");

// Set executable flag
out.set_permissions(Permissions::from_mode(PERMISSION))
.expect("Failed to set package permissions.");
}

pub fn remove(&self) {
Expand Down

0 comments on commit f6e8e8a

Please sign in to comment.