[blfs] branch trunk updated: zsh: add a zprofile file
| Newsgroups | gmane.linux.lfs.beyond.book |
|---|---|
| Message-ID | <178290280374.3172066.16700369963374267031@rivendell.linuxfromscratch.org> |
This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch trunk
in repository blfs.
The following commit(s) were added to refs/heads/trunk by this push:
new 241b9f9d26 zsh: add a zprofile file
241b9f9d26 is described below
commit 241b9f9d2635dda1a959b6f62e3c5887099a190c
Author: Xi Ruoyao <[email protected]>
AuthorDate: Wed Jul 1 18:45:03 2026 +0800
zsh: add a zprofile file
---
postlfs/shells/zsh.xml | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 74 insertions(+)
diff --git a/postlfs/shells/zsh.xml b/postlfs/shells/zsh.xml
index cdf2caa8b3..d3ba85a3ba 100644
--- a/postlfs/shells/zsh.xml
+++ b/postlfs/shells/zsh.xml
@@ -210,6 +210,80 @@ install -v -m644 zsh.{html,txt} Etc/FAQ /usr/share/doc/zsh-&zsh-version;</userin
manual pages.
</para>
+ <para>
+ Create a basic <filename>/etc/zsh/zprofile</filename> file. Like
+ <filename>/etc/profile</filename> provided in
+ <xref linkend='postlfs-config-profile'/>, it sets up some helper
+ functions and some basic parameters, then loads the scripts in
+ <filename class='directory'>/etc/profile.d</filename>:
+ </para>
+
+ <screen role="root"><?dbfo keep-together="auto"?><userinput>install -vdm755 /etc/zsh &&
+cat > /etc/zsh/zprofile << "EOF"
+<literal># Begin /etc/zsh/zprofile
+# Written for Beyond Linux From Scratch
+
+# System wide environment variables and startup programs.
+
+# Functions to help us manage paths. Second argument is the name of the
+# path variable to be modified (default: PATH)
+pathremove () {
+ local IFS=':'
+ local NEWPATH
+ local DIR
+ local PATHVARIABLE=${2:-PATH}
+ for DIR in ${(P)=PATHVARIABLE} ; do
+ if [ "$DIR" != "$1" ] ; then
+ NEWPATH=${NEWPATH:+$NEWPATH:}$DIR
+ fi
+ done
+ export $PATHVARIABLE="$NEWPATH"
+}
+
+pathprepend () {
+ pathremove $1 $2
+ local PATHVARIABLE=${2:-PATH}
+ export $PATHVARIABLE="$1${(P)PATHVARIABLE:+:${(P)PATHVARIABLE}}"
+}
+
+pathappend () {
+ pathremove $1 $2
+ local PATHVARIABLE=${2:-PATH}
+ export $PATHVARIABLE="${(P)PATHVARIABLE:+${(P)PATHVARIABLE}:}$1"
+}
+
+# Set the initial path
+export PATH=/usr/bin
+
+# Attempt to provide backward compatibility with LFS earlier than 11
+if [ ! -L /bin ]; then
+ pathappend /bin
+fi
+
+if [ $EUID -eq 0 ] ; then
+ pathappend /usr/sbin
+ if [ ! -L /sbin ]; then
+ pathappend /sbin
+ fi
+ unset HISTFILE
+fi
+
+# Set some defaults for graphical systems
+export XDG_DATA_DIRS=${XDG_DATA_DIRS:-/usr/share}
+export XDG_CONFIG_DIRS=${XDG_CONFIG_DIRS:-/etc/xdg}
+export XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR:-/tmp/xdg-$USER}
+
+for script in /etc/profile.d/*.sh ; do
+ if [ -r $script ] ; then
+ . $script
+ fi
+done
+
+unset script
+
+# End /etc/zsh/zprofile</literal>
+EOF</userinput></screen>
+
<para>
The first time zsh is executed, you will be prompted by messages asking
several questions. The answers will be used to create a
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
--
http://lists.linuxfromscratch.org/sympa/info/blfs-book
Unsubscribe: See the above information page