Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

  • Loading branch information...
commit 8534a97e9b33c9f5ceea9aa8e1408f9146bc4f68 1 parent 857c598
Peter Stephenson authored
View
8 ChangeLog
@@ -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
2  Functions/Newuser/.distfiles
@@ -1,4 +1,4 @@
DISTFILES_SRC='
.distfiles
-zsh-install-newuser
+zsh-newuser-install
'
View
11 Functions/Newuser/zsh-install-newuser
@@ -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
23 Functions/Newuser/zsh-newuser-install
@@ -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
6 Scripts/newuser
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.