summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorTravis A. Everett <travis.a.everett@gmail.com>2020-09-11 16:45:58 -0500
committerTravis A. Everett <travis.a.everett@gmail.com>2020-10-19 12:25:52 -0500
commitc40bad415104398450866d32682011db0acb0310 (patch)
tree2703e2db18ad9a9c7dd397bd835b58a8f9d9c188 /scripts
parentb719f686a8c8936fe831ce730f28638d8b1e2982 (diff)
create missing profile files to fix zsh envvars
Env vars for ZSH were moved from /etc/zshrc to /etc/zshenv in #3608 to address an issue with zshrc getting clobbered by OS updates, but /etc/zshenv doesn't exist by default--so *nothing* would get set up for zsh users unless they already happened to have /etc/zshenv. Creating these files if they don't exist. Also cut separate creation of profile.d/nix.sh, which isn't needed now.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/install-multi-user.sh22
1 files changed, 9 insertions, 13 deletions
diff --git a/scripts/install-multi-user.sh b/scripts/install-multi-user.sh
index 54edfe40d..5e8b4ac18 100644
--- a/scripts/install-multi-user.sh
+++ b/scripts/install-multi-user.sh
@@ -608,24 +608,20 @@ EOF
}
configure_shell_profile() {
- # If there is an /etc/profile.d directory, we want to ensure there
- # is a nix.sh within it, so we can use the following loop to add
- # the source lines to it. Note that I'm _not_ adding the source
- # lines here, because we want to be using the regular machinery.
- #
- # If we go around that machinery, it becomes more complicated and
- # adds complications to the uninstall instruction generator and
- # old instruction sniffer as well.
- if [ -d /etc/profile.d ]; then
- _sudo "create a stub /etc/profile.d/nix.sh which will be updated" \
- touch /etc/profile.d/nix.sh
- fi
-
for profile_target in "${PROFILE_TARGETS[@]}"; do
if [ -e "$profile_target" ]; then
_sudo "to back up your current $profile_target to $profile_target$PROFILE_BACKUP_SUFFIX" \
cp "$profile_target" "$profile_target$PROFILE_BACKUP_SUFFIX"
+ else
+ # try to create the file if its directory exists
+ target_dir="$(dirname "$profile_target")"
+ if [ -d "$target_dir" ]; then
+ _sudo "to create a stub $profile_target which will be updated" \
+ touch "$profile_target"
+ fi
+ fi
+ if [ -e "$profile_target" ]; then
shell_source_lines \
| _sudo "extend your $profile_target with nix-daemon settings" \
tee -a "$profile_target"