1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-01-01 05:16:05 +01:00

21527: rename zsh-newuser-install and don't run if not loaded

This commit is contained in:
Peter Stephenson 2005-07-26 10:35:22 +00:00
parent 857c5983f8
commit 8534a97e9b
5 changed files with 36 additions and 14 deletions

View file

@ -1,3 +1,11 @@
2005-07-26 Peter Stephenson <pws@csr.com>
* 21527: Functions/Newuser/.distfiles,
Functions/Newuser/zsh-install-newuser,
Functions/Newuser/zsh-newuser-install, Scripts/newuser: don't
use function if it failed to load; rename to zsh-newuser-install
in case there are more zsh-newuser-* functions in future.
2005-07-25 Clint Adams <clint@zsh.org>
* 21526: Completion/Unix/Command/_dhclient: handle dhclient V3 as

View file

@ -1,4 +1,4 @@
DISTFILES_SRC='
.distfiles
zsh-install-newuser
zsh-newuser-install
'

View file

@ -1,11 +0,0 @@
# Function to install startup files for a new user.
# This dummy version simply creates a new .zshrc with a comment.
# FIXME: we don't want to distribute a file that does that, it
# would be preferable to do nothing at all.
# Sanitize environment.
emulate -L zsh
echo "# Created by newuser for $ZSH_VERSION" >${ZDOTDIR:-$HOME}/.zshrc
unfunction zsh-install-newuser

View file

@ -0,0 +1,23 @@
# Function to install startup files for a new user.
# This dummy version simply creates a new .zshrc with a comment.
# FIXME: we don't want to distribute a file that does that, it
# would be preferable to do nothing at all.
# Sanitize environment.
emulate -L zsh
local zd=${ZDOTDIR:-$HOME}
# The zsh/newuser module already tests for the following, so this test only
# triggers if zsh-newuser-install is run by hand.
#
# In future we may want to use this mechanism to update startup files.
if [[ -e $zd/.zshenv || -e $zd/.zprofile || -e $zd/.zshrc || -e $zs/.zlogin ]]
then
print "zsh-newuser-install: startup files exist, aborting" >&2
return 1
fi
echo "# Created by newuser for $ZSH_VERSION" >$zd/.zshrc
unfunction zsh-newuser-install

View file

@ -2,5 +2,7 @@
# no startup files. See the documentation for the zsh/newuser
# module in zshmodules(1).
autoload -U zsh-install-newuser
zsh-install-newuser
if functions zsh-newuser-install >/dev/null 2>&1 ||
autoload -U +X zsh-newuser-install; then
zsh-newuser-install
fi