mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-10-25 05:10:28 +02:00
21527: rename zsh-newuser-install and don't run if not loaded
This commit is contained in:
parent
857c5983f8
commit
8534a97e9b
5 changed files with 36 additions and 14 deletions
|
|
@ -1,4 +1,4 @@
|
|||
DISTFILES_SRC='
|
||||
.distfiles
|
||||
zsh-install-newuser
|
||||
zsh-newuser-install
|
||||
'
|
||||
|
|
|
|||
|
|
@ -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
|
||||
23
Functions/Newuser/zsh-newuser-install
Normal file
23
Functions/Newuser/zsh-newuser-install
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue