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

zsh: make the disabling of /etc optional #11056

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 37 additions & 13 deletions Library/Formula/zsh.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,35 @@ class Zsh < Formula

skip_clean :all

def disable_etcdir?
ARGV.include? '--disable-etcdir'
end

def options
[
['--disable-etcdir', 'Disable the reading of Zsh rc files in /etc'],
]
end

def install
system "./configure", "--prefix=#{prefix}",
"--disable-etcdir",
"--enable-fndir=#{share}/zsh/functions",
"--enable-site-fndir=#{share}/zsh/site-functions",
"--enable-scriptdir=#{share}/zsh/scripts",
"--enable-site-scriptdir=#{share}/zsh/site-scripts",
"--enable-cap",
"--enable-function-subdirs",
"--enable-maildir-support",
"--enable-multibyte",
"--enable-pcre",
"--enable-zsh-secure-free",
"--with-tcsetpgrp"
args = [
"-prefix=#{prefix}",
"--enable-fndir=#{share}/zsh/functions",
"--enable-site-fndir=#{share}/zsh/site-functions",
"--enable-scriptdir=#{share}/zsh/scripts",
"--enable-site-scriptdir=#{share}/zsh/site-scripts",
"--enable-cap",
"--enable-function-subdirs",
"--enable-maildir-support",
"--enable-multibyte",
"--enable-pcre",
"--enable-zsh-secure-free",
"--with-tcsetpgrp"
]

args << '--disable-etcdir' if disable_etcdir?

system "./configure", *args

# Do not version installation directories.
inreplace ["Makefile", "Src/Makefile"],
Expand All @@ -38,6 +53,15 @@ def test

def caveats; <<-EOS.undent
To use this build of Zsh as your login shell, add it to /etc/shells.

If you have administrator privileges, you must fix an Apple miss
configuration in Mac OS X 10.7 Lion by renaming /etc/zshenv to
/etc/zprofile, or Zsh will have the wrong PATH when executed
non-interactively by scripts.

Alternatively, install Zsh with /etc disabled:

brew install --disable-etcdir zsh
EOS
end
end