diff --git a/app-shells/zsh/additional-files/zprofile b/app-shells/zsh/additional-files/zprofile new file mode 100644 index 000000000..98335caa7 --- /dev/null +++ b/app-shells/zsh/additional-files/zprofile @@ -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 +) diff --git a/app-shells/zsh/additional-files/zshenv b/app-shells/zsh/additional-files/zshenv new file mode 100644 index 000000000..f56fbe639 --- /dev/null +++ b/app-shells/zsh/additional-files/zshenv @@ -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 diff --git a/app-shells/zsh/zsh-5.5.1.recipe b/app-shells/zsh/zsh-5.5.1.recipe index 0d813702f..ebf0a71ba 100644 --- a/app-shells/zsh/zsh-5.5.1.recipe +++ b/app-shells/zsh/zsh-5.5.1.recipe @@ -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