Skip to content

Commit

Permalink
Set the correct permissions on the zshenv (#257)
Browse files Browse the repository at this point in the history
* Set the correct permissions on the zshenv

* Update error to suggest chmod instead of delete

* Missed a formatting option

* 644, not 755

* Get a bit more specific

* Mac specific permissions
  • Loading branch information
Hoverbear authored Feb 21, 2023
1 parent 5582d05 commit 7e951a5
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/action/common/configure_shell_profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use crate::action::{Action, ActionDescription, ActionError, StatefulAction};

use nix::unistd::User;
use std::path::{Path, PathBuf};
use target_lexicon::OperatingSystem;
use tokio::task::JoinSet;
use tracing::{span, Instrument, Span};

Expand Down Expand Up @@ -65,12 +66,22 @@ impl ConfigureShellProfile {
);
continue;
}
// Macs require a different mode on certain files...
let required_mode = match target_lexicon::OperatingSystem::host() {
OperatingSystem::MacOSX {
major: _,
minor: _,
patch: _,
}
| OperatingSystem::Darwin => 0o100444,
_ => 0o100644,
};
create_or_insert_files.push(
CreateOrInsertIntoFile::plan(
profile_target_path,
None,
None,
None,
required_mode,
shell_buf.to_string(),
create_or_insert_into_file::Position::Beginning,
)
Expand Down Expand Up @@ -112,7 +123,7 @@ impl ConfigureShellProfile {
profile_target,
None,
None,
0o0755,
0o100644,
fish_buf.to_string(),
create_or_insert_into_file::Position::Beginning,
)
Expand Down

0 comments on commit 7e951a5

Please sign in to comment.