zsh: move zprofile and zshenv to additional-files.

This commit is contained in:
fbrosson
2018-05-23 23:21:49 +00:00
committed by Leorize
parent 65f2c797f7
commit 44d419c96f
3 changed files with 32 additions and 28 deletions

View File

@@ -0,0 +1,18 @@
# Emulate ksh as a walkaround for ksh-syntax within /etc/profile
emulate ksh -c 'source /etc/profile'
PS1="${PS1/'$PWD'/%~}"
# Migration path for users who rely on the old behavior
(
setopt EXTENDED_GLOB
if [[ -n $ZDOTDIR && -z $ZDOTDIR/.z(login|logout|profile|shrc|shenv)(#qN) ]]; then
for i in "$HOME/config/settings/zsh"/z(login|logout|profile|shrc|shenv)(#qN)
do
local target=$ZDOTDIR/.$(basename "$i")
echo "Symlinking $i to $target..."
ln -sv "$i" "$target"
unset target
done
[[ -e $ZDOTDIR/.zshenv ]] && source $ZDOTDIR/.zshenv
fi
)

View File

@@ -0,0 +1,5 @@
setopt EXTENDED_GLOB
if [ -z ~/.z(login|logout|profile|shrc|shenv)(N) ]; then
ZDOTDIR="$(finddir B_USER_SETTINGS_DIRECTORY)/zsh"
fi
unsetopt EXTENDED_GLOB

View File

@@ -13,6 +13,10 @@ CHECKSUM_SHA256="e1c38808fcbe0cc1344d55c9a758349f7ba1e317325b154621ac37eddac4aa8
SOURCE_URI_2="https://downloads.sf.net/zsh/zsh-$portVersion-doc.tar.xz"
CHECKSUM_SHA256_2="41ce13a89a6bc7e709b6f110e54288d59f02ba2becd2646895d28188d4dd6283"
PATCHES="zsh-$portVersion.patchset"
ADDITIONAL_FILES="
zprofile
zshenv
"
ARCHITECTURES="x86_gcc2 ?x86 x86_64"
@@ -101,36 +105,13 @@ INSTALL()
install -d -m 755 "$settingsDir/zsh"
# Source /etc/profile on startup, which contains important settings
# Keep dots in B_USER_SETTINGS_DIRECTORY, if the user hasn't got any
# dots in their home directory
cat > "$settingsDir/zsh/zshenv" << EOF
setopt EXTENDED_GLOB
if [ -z ~/.z(login|logout|profile|shrc|shenv)(N) ]; then
ZDOTDIR="\$(finddir B_USER_SETTINGS_DIRECTORY)/zsh"
fi
unsetopt EXTENDED_GLOB
EOF
# Source /etc/profile on startup, which contains important settings
cat > "$settingsDir/zsh/zprofile" << EOF
# Emulate ksh as a walkaround for ksh-syntax within /etc/profile
emulate ksh -c 'source /etc/profile'
PS1="\${PS1/'\$PWD'/%~}"
# Migration path for users who rely on the old behavior
(
setopt EXTENDED_GLOB
if [[ -n \$ZDOTDIR && -z \$ZDOTDIR/.z(login|logout|profile|shrc|shenv)(#qN) ]]; then
for i in "\$HOME/config/settings/zsh"/z(login|logout|profile|shrc|shenv)(#qN)
do
local target=\$ZDOTDIR/.\$(basename "\$i")
echo "Symlinking \$i to \$target..."
ln -sv "\$i" "\$target"
unset target
done
[[ -e \$ZDOTDIR/.zshenv ]] && source \$ZDOTDIR/.zshenv
fi
)
EOF
install -m 644 \
"$portDir"/additional-files/zprofile \
"$portDir"/additional-files/zshenv \
"$settingsDir"/zsh
make install.html
install -t "$developDocDir" -m 644 Doc/*.pdf