Sync from SUSE:SLFO:Main zsh revision 13eb460c052e620c54bd6565584d4b5b

This commit is contained in:
Adrian Schröter 2024-05-04 02:39:16 +02:00
commit a77752dfcc
19 changed files with 2287 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

34
dotzshrc.rh Normal file
View File

@ -0,0 +1,34 @@
#
# .zshrc is sourced in interactive shells.
# It should contain commands to set up aliases,
# functions, options, key bindings, etc.
#
autoload -U compinit
compinit
#allow tab completion in the middle of a word
setopt COMPLETE_IN_WORD
## keep background processes at full speed
#setopt NOBGNICE
## restart running processes on exit
#setopt HUP
## history
#setopt APPEND_HISTORY
## for sharing history between zsh processes
#setopt INC_APPEND_HISTORY
#setopt SHARE_HISTORY
## never ever beep ever
#setopt NO_BEEP
## automatically decide when to page a list of completions
#LISTMAX=0
## disable mail checking
#MAILCHECK=0
# autoload -U colors
#colors

26
egrep-deprecation.patch Normal file
View File

@ -0,0 +1,26 @@
Index: zsh-5.9/Test/D07multibyte.ztst
===================================================================
--- zsh-5.9.orig/Test/D07multibyte.ztst
+++ zsh-5.9/Test/D07multibyte.ztst
@@ -6,7 +6,7 @@
unset -m LC_\*
mb_ok=
langs=(en_{US,GB}.{UTF-,utf}8 en.UTF-8
- $(locale -a 2>/dev/null | egrep 'utf8|UTF-8'))
+ ${(M)$(locale -a 2>/dev/null):#*.(utf8|UTF-8)} )
for LANG in $langs; do
if [[ é = ? ]]; then
mb_ok=1
Index: zsh-5.9/Test/E01options.ztst
===================================================================
--- zsh-5.9.orig/Test/E01options.ztst
+++ zsh-5.9/Test/E01options.ztst
@@ -651,7 +651,7 @@
>noktarg1
>0 1
- showopt() { setopt | egrep 'localoptions|ksharrays'; }
+ showopt() { setopt | grep -E 'localoptions|ksharrays'; }
f1() { setopt localoptions ksharrays; showopt }
f2() { setopt ksharrays; showopt }
setopt kshoptionprint

View File

@ -0,0 +1,104 @@
diff --git a/Src/jobs.c b/Src/jobs.c
index 707374297..76c762ee5 100644
--- a/Src/jobs.c
+++ b/Src/jobs.c
@@ -544,16 +544,14 @@ update_job(Job jn)
if (isset(MONITOR)) {
pid_t pgrp = gettygrp(); /* get process group of tty */
+ int deadpgrp = (mypgrp != pgrp && inforeground && pgrp > 1 &&
+ kill(-pgrp, 0) == -1 && errno == ESRCH);
/* is this job in the foreground of an interactive shell? */
if (mypgrp != pgrp && inforeground &&
- (jn->gleader == pgrp ||
- (pgrp > 1 &&
- (kill(-pgrp, 0) == -1 && errno == ESRCH)))) {
+ ((jn->gleader == pgrp && signalled) || deadpgrp)) {
if (list_pipe) {
- if (somestopped || (pgrp > 1 &&
- kill(-pgrp, 0) == -1 &&
- errno == ESRCH)) {
+ if (somestopped || deadpgrp) {
attachtty(mypgrp);
/* check window size and adjust if necessary */
adjustwinsize(0);
@@ -566,6 +564,12 @@ update_job(Job jn)
* when the job is finally deleted.
*/
jn->stat |= STAT_ATTACH;
+ /*
+ * If we're in shell jobs on the right side of a pipeline
+ * we should treat it like a job in the current shell.
+ */
+ if (inforeground == 2)
+ inforeground = 1;
}
/* If we have `foo|while true; (( x++ )); done', and hit
* ^C, we have to stop the loop, too. */
@@ -1488,10 +1492,7 @@ addproc(pid_t pid, char *text, int aux, struct timeval *bgtime,
* set it for that, too.
*/
if (gleader != -1) {
- if (jobtab[thisjob].stat & STAT_CURSH)
- jobtab[thisjob].gleader = gleader;
- else
- jobtab[thisjob].gleader = pid;
+ jobtab[thisjob].gleader = gleader;
if (list_pipe_job_used != -1)
jobtab[list_pipe_job_used].gleader = gleader;
/*
@@ -1500,7 +1501,7 @@ addproc(pid_t pid, char *text, int aux, struct timeval *bgtime,
*/
last_attached_pgrp = gleader;
} else if (!jobtab[thisjob].gleader)
- jobtab[thisjob].gleader = pid;
+ jobtab[thisjob].gleader = pid;
/* attach this process to end of process list of current job */
pnlist = &jobtab[thisjob].procs;
}
@@ -2506,6 +2507,7 @@ bin_fg(char *name, char **argv, Options ops, int func)
jobtab[job].stat &= ~STAT_CURSH;
}
if ((stopped = (jobtab[job].stat & STAT_STOPPED))) {
+ /* WIFCONTINUED will makerunning() again at killjb() */
makerunning(jobtab + job);
if (func == BIN_BG) {
/* Set $! to indicate this was backgrounded */
diff --git a/Src/exec.c b/Src/exec.c
index 2422dae91..d4e681887 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -1899,8 +1899,12 @@ execpline(Estate state, wordcode slcode, int how, int last1)
break;
}
}
- else if (subsh && jn->stat & STAT_STOPPED)
- thisjob = newjob;
+ else if (subsh && jn->stat & STAT_STOPPED) {
+ if (thisjob == newjob)
+ makerunning(jn);
+ else
+ thisjob = newjob;
+ }
else
break;
}
diff --git a/Src/jobs.c b/Src/jobs.c
index 76c762ee5..4863962b9 100644
--- a/Src/jobs.c
+++ b/Src/jobs.c
@@ -564,12 +564,6 @@ update_job(Job jn)
* when the job is finally deleted.
*/
jn->stat |= STAT_ATTACH;
- /*
- * If we're in shell jobs on the right side of a pipeline
- * we should treat it like a job in the current shell.
- */
- if (inforeground == 2)
- inforeground = 1;
}
/* If we have `foo|while true; (( x++ )); done', and hit
* ^C, we have to stop the loop, too. */

View File

@ -0,0 +1,13 @@
Index: zsh-5.0.2/Src/Zle/complete.mdd
===================================================================
--- zsh-5.0.2.orig/Src/Zle/complete.mdd
+++ zsh-5.0.2/Src/Zle/complete.mdd
@@ -1,7 +1,7 @@
name=zsh/complete
link=either
load=yes
-functions='Completion/*comp* Completion/AIX/*/* Completion/BSD/*/* Completion/Base/*/* Completion/Cygwin/*/* Completion/Darwin/*/* Completion/Debian/*/* Completion/Linux/*/* Completion/Mandriva/*/* Completion/Redhat/*/* Completion/Solaris/*/* Completion/openSUSE/*/* Completion/Unix/*/* Completion/X/*/* Completion/Zsh/*/*'
+functions='Completion/*comp* Completion/Base/*/* Completion/Linux/*/* Completion/openSUSE/*/* Completion/Unix/*/* Completion/X/*/* Completion/Zsh/*/*'
moddeps="zsh/zle"

8
zlogin.rhs Normal file
View File

@ -0,0 +1,8 @@
#
# /etc/zlogin and .zlogin are sourced in login shells. It should
# contain commands that should be executed only in
# login shells. It should be used to set the terminal
# type and run a series of external commands (fortune,
# msgs, from, etc).
#

7
zlogout.rhs Normal file
View File

@ -0,0 +1,7 @@
#
#
# /etc/zlogout and ~/.zlogout are run when an interactive session ends
#
#
clear

7
zprofile Normal file
View File

@ -0,0 +1,7 @@
# we source the general profile here so we dont have to
# reimplement it
setopt nonomatch
source /etc/profile
unsetopt nonomatch
# put your own login shell specific configuration below
# this line

22
zprofile.rhs Normal file
View File

@ -0,0 +1,22 @@
#
# /etc/zprofile and ~/.zprofile are run for login shells
#
PATH="$PATH:$HOME/bin"
export PATH
_src_etc_profile()
{
# Make /etc/profile happier, and have possible ~/.zshenv options like
# NOMATCH ignored.
#
emulate -L ksh
# source profile
if [ -f /etc/profile ]; then
source /etc/profile
fi
}
_src_etc_profile
unset -f _src_etc_profile

BIN
zsh-5.9.tar.xz (Stored with Git LFS) Normal file

Binary file not shown.

11
zsh-5.9.tar.xz.asc Normal file
View File

@ -0,0 +1,11 @@
-----BEGIN PGP SIGNATURE-----
iQEzBAABCAAdFiEEfKfsqvBiFrkPiUFGrPgUbK6Mu8QFAmJ///QACgkQrPgUbK6M
u8RgPgf+N/yJ+ltJouICaa8fYiYxN0uuYhCeBDVmHuPdwFBPl/Fa5npXkuvo2s/0
1ho5VfuU08B856GcBpraeuNqN74WNaaZ1E2P8ZFFg1Uw3xjxyg1lqjvkJZrrYURm
tZNoov33jeyKbyTaNxTHgIujyBE3Uu40wpLoIOL3jO4PV0useJyw1jj5CsnvhN1b
3S4X99gre3J0SahNDTGltmCwtO/nL3uZh0+FYNagJMF9ZTV9/BQEjBlozBWU+sPa
rBpbr9A4p/AY2GQti03EmP/HXicaX397aRlBqgfjSRkMJpvaDnVnuXY53uLVOKdW
sg6FYiIrO54Q6bEzJV9JfhdvqQtU4A==
=BNV9
-----END PGP SIGNATURE-----

15
zsh-osc-completion.patch Normal file
View File

@ -0,0 +1,15 @@
Index: zsh-5.0.7/Completion/openSUSE/Command/_osc
===================================================================
--- zsh-5.0.7.orig/Completion/openSUSE/Command/_osc
+++ zsh-5.0.7/Completion/openSUSE/Command/_osc
@@ -16,8 +16,8 @@
# version 0.2
#
-OSC_BUILD_TARGETS="openSUSE_12.1 openSUSE_12.2 openSUSE_12.3 openSUSE_Tumbleweed openSUSE_Factory SLE_11_SP2"
-OSC_PROJECTS="openSUSE:Factory openSUSE:Tumbleweed openSUSE:12.3 openSUSE:12.2 openSUSE:12.1"
+OSC_BUILD_TARGETS="openSUSE_13.1 openSUSE_13.2 openSUSE_Tumbleweed openSUSE_Factory SLE_11_SP3 SLE_12"
+OSC_PROJECTS="openSUSE:Factory openSUSE:Tumbleweed openSUSE:13.2 openSUSE:13.1"
# user defined variables $OSC_BUILD_TARGETS_EXTRA and
# $OSC_PROJECTS_EXTRA can add to the project/build target list

1306
zsh.changes Normal file

File diff suppressed because it is too large Load Diff

30
zsh.keyring Normal file
View File

@ -0,0 +1,30 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQENBFwswugBCADdkzua9HwC8Ip5zh7Z0/nJGKbMyq+cobXArhHos40taeidn0+v
HRES5y6PHR+h56c9TpmJEp/bLCHP5pLvcSz/ETz7+Kk82pld63pOHejSxAQCu7Wv
1NwrTu6TyKlZsNG1oZBxx2LkEN6k8Wy+88DlQqZoXOXafmhF+Sms6gv9DXa029sv
B07EehAx02T+b02QwVVG/Pq9austmsTd9EcNcVNRDneD2LcdxCllbS5IamjVa+NW
oeKZVqbsO71uUolwBvshFSBLPsSY8EZdGApjazQcY0lgkaRA/QlMOisyq2mjV6FY
JXHrlI3WWWK2vROjb35AHiHEE/EVgb5RVpxxABEBAAG0E2RhbmEgPGRhbmFAZGFu
YS5pcz6JAU4EEwEIADgWIQR8p+yq8GIWuQ+JQUas+BRsroy7xAUCXCzC6AIbAwUL
CQgHAgYVCgkICwIEFgIDAQIeAQIXgAAKCRCs+BRsroy7xA5XB/93EQqzs0as07U+
gmPDpvE7JwIY4TrcvAS7RHgJ4sE+arR5uTziHixiHBQQMedbfV51Jxgws6WL0Ko8
7K8h9sN2UGnXIc1lWuQ2FDshrcpSHZvLxL4Z7WC3Rj/Dq3/nuZZyljWQNHxg4BlO
EJqe67F5kT2OI591oxB6L1E6F8sVsgxD7gBCPVl/8CsyZ7wkyW/gMRqrlYolJhpS
B5C1zKJzvULQJKXDCh9DUyi7cKFtPyYfYtRWfWhKGz5Dhtt9qvBlxJzZufZ9QNQt
oPhNGF34QaLWTCLRbtoVbNq2NlxalZ5Byhg/0pBcQc2w4C70jSxF3c+2oMEGQIbc
5GJFgLpZuQENBFwswugBCAD5rIYdlLWHOMw+stWTRNquu3SZr+v7RRzreV9fOKN+
lUiqwicU2uCX39s/q+2wtF536r+IS/53DrMAW8sxf8eroK+MBnJYtP3U8BnB3mag
bTJXMjng2ZqZXvxzetXLyXR+38f+6WbJtV0ByDeFQQJYsFxOag3r6etxrzpwRFm0
PL440fc0nxOxhxWWJcR0RKTMX87ymipi9mETYeZi7h9B3cDw8aIUz2O3s45TtNlA
NI1MNMU4sAsc5i+w0zJON9gT+rWDYFj6BiEqnRoSK2XDm+WaJa3FwgW1WnHPTe+E
RJFGT58DICU3ta6cCQPavZz/KALyj8GBJ+PydelIAv2rABEBAAGJATYEGAEIACAW
IQR8p+yq8GIWuQ+JQUas+BRsroy7xAUCXCzC6AIbDAAKCRCs+BRsroy7xOgxB/40
sp9xFq8L/59yRTeXSskOsGk3aUlSnACofcRCGgDSXV5GwWJ/G0O8krhHOISJKuxc
vA0wLFq0WB/EafrKAPTSkrnxmq8noT3c8MpnFRSXHq3sOXkB4nqVEmUu/AAA0TbC
HcwhFQExvK7O+funxIGU5vqHFeQGJ0VcgC/KZUEMNtVV8aZGvn7JzSxEIwHVXGLu
5H7TnNWzLzkzIDVY9IJpTutsc6RMvv6BV8ooWBHSgzmh0MTqEjwNarHAMuffrAjE
zIO3qi0YCaxSDVf2jrWyYpB2QntplmUoubB9s/ngCqVb4A3B7JxPmJuL/0XMUThn
WZLWFpbLimyoUCfHoehZ
=dR/Y
-----END PGP PUBLIC KEY BLOCK-----

303
zsh.spec Normal file
View File

@ -0,0 +1,303 @@
#
# spec file for package zsh
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%if 0%{?rhel_version} || 0%{?centos_version} || 0%{?fedora_version}
%if 0%{?rhel_version} >= 700 || 0%{?centos_version} >= 700
%global __requires_exclude ^/bin/zsh$
%endif
BuildRequires: libtermcap-devel
BuildRequires: texi2html
BuildRequires: texinfo
%endif
Name: zsh
Version: 5.9
Release: 0%{?dist}
Summary: Shell with comprehensive completion
License: MIT
Group: System/Shells
URL: https://www.zsh.org
Source0: https://downloads.sourceforge.net/project/zsh/zsh/%{version}/zsh-%{version}.tar.xz
Source1: https://downloads.sourceforge.net/project/zsh/zsh/%{version}/zsh-%{version}.tar.xz.asc
Source2: %{name}.keyring
Source3: zshrc
Source4: zshenv
Source5: zprofile
Patch1: trim-unneeded-completions.patch
# PATCH-FIX-OPENSUSE zsh-osc-completion.patch -- Fix openSUSE versions in osc completion
Patch2: zsh-osc-completion.patch
# PATCH-FIX-OPENSUSE: taken from https://www.zsh.org/mla/workers/2022/msg00956.html
Patch3: egrep-deprecation.patch
Patch4: pipe-less-and-signals-handling.patch
BuildRequires: groff
BuildRequires: libcap-devel
BuildRequires: ncurses-devel
BuildRequires: pcre-devel
%if 0%{?rhel_version} || 0%{?centos_version} || 0%{?fedora_version}
Source11: zlogin.rhs
Source12: zlogout.rhs
Source13: zprofile.rhs
Source14: zshrc.rhs
Source15: zshenv.rhs
Source16: dotzshrc.rh
%endif
%if 0%{?suse_version}
BuildRequires: fdupes
Requires(pre): %{install_info_prereq}
%if 0%{?suse_version} >= 1210
BuildRequires: makeinfo
BuildRequires: texi2html
%endif
%else
Requires(pre): /sbin/install-info
Requires(pre): fileutils
Requires(pre): grep
%endif
%if 0%{?suse_version} >= 1550
Provides: /bin/zsh
%endif
%description
Zsh is a UNIX command interpreter (shell) that resembles the Korn shell
(ksh). It is not completely compatible. It includes many enhancements,
notably in the command-line editor, options for customizing its
behavior, file name globbing, features to make C-shell (csh) users feel
at home, and extra features drawn from tcsh (another `custom' shell).
Zsh is well known for its command line completion.
%package htmldoc
Summary: Zsh shell manual in HTML format
Group: Documentation/HTML
Provides: %{name}-html = %{version}
Obsoletes: %{name}-html < %{version}
%description htmldoc
The zsh shell is a command interpreter usable as an interactive login
shell and as a shell script command processor. Zsh resembles the ksh
shell (the Korn shell), but includes many enhancements. Zsh supports
command line editing, built-in spelling correction, programmable
command completion, shell functions (with autoloading), a history
mechanism, and more.
This package contains the Zsh manual in HTML format.
%if 0%{?suse_version} >= 1550
%package sh
Summary: Handle behaviour of /bin/sh
Group: System/Shells
Requires: zsh = %{version}
Conflicts: alternative(sh)
Provides: alternative(sh)
BuildArch: noarch
%description sh
Use zsh as /bin/sh implementation.
%endif
%prep
%setup -q
%if 0%{?suse_version}
%patch1 -p1
%endif
%patch2 -p1
%patch3 -p1
%patch4 -p1
# Remove executable bit
chmod 0644 Etc/changelog2html.pl
# Fix bindir path in some files
perl -p -i -e 's|%{_prefix}/local/bin|%{_bindir}|' \
Doc/intro.ms Misc/globtests.ksh Misc/globtests \
Misc/lete2ctl Util/check_exports Util/helpfiles \
Util/reporter Functions/VCS_Info/test-repo-git-rebase-*
%build
%configure \
%if 0%{?suse_version}
--with-term-lib="ncursesw" \
--enable-cflags="%{optflags} -fPIE %(ncursesw6-config --cflags)" \
--enable-ldflags="%(ncursesw6-config --libs) -pie -Wl,-z,relro" \
%endif
--enable-fndir=%{_datadir}/%{name}/${version}/functions \
--enable-site-fndir=%{_datadir}/%{name}/site-functions \
--enable-function-subdirs \
--enable-maildir-support \
--with-tcsetpgrp \
--enable-cap \
--enable-multibyte \
--enable-pcre \
--enable-unicode9
# Copy _rpm completion from Redhat (bnc#900424)
%if 0%{?suse_version}
cp Completion/Redhat/Command/_rpm Completion/openSUSE/Command/_rpm
%endif
make %{?_smp_mflags} all info html
# generate intro.ps
groff -Tps -ms Doc/intro.ms > intro.ps
# better name for html documentation
install -d -m 0755 Doc/htmldoc/
mv Doc/*.html Doc/htmldoc
# remove some unwanted files in Etc/
rm -f Etc/Makefile* Etc/*.yo
%install
%if 0%{?rhel_version} || 0%{?centos_version} || 0%{?fedora_version}
%endif
%if 0%{?suse_version}
%make_install install.info
%else
make DESTDIR=%{buildroot} install install.info
%endif
install -m 0755 -Dd %{buildroot}/{etc,bin}
%if 0%{?suse_version}
# install SUSE configuration
install -m 0644 %{SOURCE3} %{SOURCE4} %{SOURCE5} %{buildroot}%{_sysconfdir}
# Create custom completion directory
mkdir %{buildroot}%{_sysconfdir}/zsh_completion.d
%endif
%if 0%{?rhel_version} || 0%{?centos_version} || 0%{?fedora_version}
# install RHEL || CentOS || Fedora configuration
for i in zlogin zlogout zprofile zshrc zshenv; do
install -m 0644 $RPM_SOURCE_DIR/${i}.rhs %{buildroot}%{_sysconfdir}/$i
done
install -D -m 0644 %{SOURCE16} %{buildroot}%{_sysconfdir}/skel/.zshrc
%endif
%if 0%{?suse_version} < 1550
# link zsh binary
%if 0%{?suse_version} || 0%{?rhel} <= 6
ln -sf %{_bindir}/zsh %{buildroot}/bin/zsh
%endif
%endif
# Remove versioned zsh binary
rm -f %{buildroot}%{_bindir}/zsh-*
%if 0%{?rhel_version} || 0%{?centos_version} || 0%{?fedora_version}
rm -f %{buildroot}/%{_infodir}/dir
%endif
%if 0%{?suse_version} >= 1110
%fdupes %{buildroot}
%endif
#
# Create the symlink required for zsh-sh to handle /bin/sh
#
%if 0%{?suse_version} >= 1550
ln -s %{_bindir}/zsh %{buildroot}%{_bindir}/sh
%endif
%check
%if ! 0%{?qemu_user_space_build}
%if 0%{?suse_version}
make %{?_smp_mflags} check
%else
# FixMe: sometimes failing Test
#+ fn:echo:2: write error: broken pipe
#+ fn:2: write error: inappropriate ioctl for device
mv Test/E01options.ztst Test/E01options.ztst.mvd
%ifarch s390 s390x ppc ppc64
( cd Test
mkdir skipped
mv Y*.ztst skipped )
%endif
ZTST_verbose=0 make test
%endif
%endif
%preun
%if ! 0%{?suse_version}
if [ "$1" = 0 ] ; then
/sbin/install-info --delete %{_infodir}/zsh.info.gz %{_infodir}/dir \
--entry="* zsh: (zsh). An enhanced bourne shell."
fi
%endif
%post
%if ! 0%{?suse_version}
if [ ! -f %{_sysconfdir}/shells ]; then
echo "%{_bindir}/zsh" > %{_sysconfdir}/shells
else
grep -q "^%{_bindir}/zsh$" %{_sysconfdir}/shells \
|| echo "%{_bindir}/zsh" >> %{_sysconfdir}/shells
fi
/sbin/install-info %{_infodir}/zsh.info.gz %{_infodir}/dir \
--entry="* zsh: (zsh). An enhanced bourne shell."
%endif
%postun
%if ! 0%{?suse_version}
if [ "$1" = 0 ] ; then
if [ -f %{_sysconfdir}/shells ] ; then
TmpFile=`%{_bindir}/mktemp /tmp/.zshrpmXXXXXX`
grep -v '^%{_bindir}/zsh$' %{_sysconfdir}/shells > $TmpFile
cp -f $TmpFile %{_sysconfdir}/shells
rm -f $TmpFile
chmod 644 %{_sysconfdir}/shells
fi
fi
%endif
%files
%doc ChangeLog FEATURES LICENCE MACHINES META-FAQ NEWS README
%doc Etc/* intro.ps Misc/compctl-examples
%config(noreplace) %{_sysconfdir}/zshrc
%config(noreplace) %{_sysconfdir}/zshenv
%config(noreplace) %{_sysconfdir}/zprofile
%if 0%{?rhel_version} || 0%{?centos_version} || 0%{?fedora_version}
%config(noreplace) %{_sysconfdir}/zlogin
%config(noreplace) %{_sysconfdir}/zlogout
%config(noreplace) %{_sysconfdir}/skel/.zshrc
%endif
%if 0%{?suse_version}
%dir %{_sysconfdir}/zsh_completion.d
%endif
%{_bindir}/zsh
%if 0%{?suse_version} < 1550
%if 0%{?suse_version} || 0%{?rhel} <= 6
/bin/zsh
%endif
%endif
%{_libdir}/zsh/
%{_datadir}/zsh/
%{_infodir}/zsh.info*%{ext_info}
%{_mandir}/man1/zsh*.1%{ext_man}
%files htmldoc
%doc Doc/htmldoc/*
%if 0%{?suse_version} >= 1550
%files sh
%{_bindir}/sh
%endif
%changelog

1
zshenv Normal file
View File

@ -0,0 +1 @@
# set global options for all zsh shells here

9
zshenv.rhs Normal file
View File

@ -0,0 +1,9 @@
#
# /etc/zshenv is sourced on all invocations of the
# shell, unless the -f option is set. It should
# contain commands to set the command search path,
# plus other important environment variables.
# .zshenv should not contain commands that produce
# output or assume the shell is attached to a tty.
#

315
zshrc Normal file
View File

@ -0,0 +1,315 @@
# Custom completion support via /etc/zsh_completion.d
fpath=( $fpath /etc/zsh_completion.d )
# zsh line editing
: ${ZSHEDIT:="emacs"}
: ${TERM:=linux}
if [[ "$ZSHEDIT" == "vi" ]] then
bindkey -v
else
bindkey -e
bindkey "^[ " magic-space
bindkey "^[!" expand-history
fi
# Environment
HISTSIZE=1000
HISTFILE=${HOME}/.zsh_history
SAVEHIST=500
# Prompt on the right side. zsh feature
#RPROMPT="[%T]"
# Set/unset shell options
setopt nocorrect
setopt pushdtohome
setopt autolist
setopt nopromptcr
setopt nocorrectall
setopt autocd
setopt recexact
setopt longlistjobs
setopt histignoredups
setopt pushdsilent
setopt appendhistory
setopt histexpiredupsfirst
setopt autopushd
setopt pushdminus
setopt extendedglob
setopt rcquotes
unsetopt bgnice
unsetopt autoparamslash
unsetopt hup
# Setup some basic programmable completions. To see more examples
# of these, check out /usr/doc/packages/zsh/compctl-examples.
# You you have a slow machine, you might want to comment the lines below
# with compctl in, and comment the below two lines out.
#
# compctl -g '*(-/)' cd pushd
# compctl -g '*(/)' rmdir dircmp
# compctl -j -P % -x 's[-] p[1]' -k signals -- kill
# compctl -j -P % fg bg wait jobs disown
# compctl -A shift
# compctl -caF type whence which
# compctl -F unfunction
# compctl -a unalias
# compctl -v unset typeset declare vared readonly export integer
# compctl -e disable
# compctl -d enable
#
# The default way is the usage of the zsh built-in completer
# Comment the two below lines out, if you are on a slow machine, and
# comment the above compctl lines in.
autoload -U compinit
compinit
# Completion so "cd ..<TAB>" -> "cd ../"
# zstyle ':completion:*' special-dirs ..
# Online help
unalias run-help 2>/dev/null || true
autoload run-help
# Don't use zsh builtin which
alias which >/dev/null && unalias which
# Common standard keypad and cursor
bindkey "^[[2~" yank
bindkey "^[[3~" delete-char
# History completion on pgup and pgdown
autoload -U history-search-end
zle -N history-beginning-search-backward-end history-search-end
zle -N history-beginning-search-forward-end history-search-end
bindkey "^[[5~" history-beginning-search-backward-end
bindkey "^[[6~" history-beginning-search-forward-end
if [[ "$TERM" == "xterm" || "$TERM" == "xterm-256color" ]] then
bindkey "^[2;5~" yank
bindkey "^[3;5~" delete-char
bindkey "^[5;5~" up-history
bindkey "^[6;5~" down-history
fi
bindkey "^[[C" forward-char
bindkey "^[[D" backward-char
bindkey "^[[A" up-history
bindkey "^[[B" down-history
# Avoid network problems
# ... \177 (ASCII-DEL) and \010 (ASCII-BS)
# do `backward-delete-char'
# Note: `delete-char' is maped to \033[3~
# Therefore xterm's responce on pressing
# key Delete or KP-Delete should be
# \033[3~ ... NOT \177
bindkey "^?" backward-delete-char
bindkey "^H" backward-delete-char
# Home and End
if [[ "$TERM" == "xterm" || "$TERM" == "xterm-256color" ]] then
# Normal keypad and cursor of xterm
bindkey "^[[1~" history-search-backward
bindkey "^[[4~" set-mark-command
bindkey "^[[H" beginning-of-line
bindkey "^[[F" end-of-line
# Home and End of application keypad and cursor of xterm
bindkey "^[OH" beginning-of-line
bindkey "^[OF" end-of-line
bindkey "^[O5H" beginning-of-line
bindkey "^[O5F" end-of-line
else
if [[ "$TERM" == "kvt" ]] then
bindkey "^[[1~" history-search-backward
bindkey "^[[4~" set-mark-command
bindkey "^[OH" beginning-of-line
bindkey "^[OF" end-of-line
else
# TERM=linux or console
bindkey "^[[1~" beginning-of-line
bindkey "^[[4~" end-of-line
fi
fi
# Application keypad and cursor of xterm
if [[ "$TERM" == "xterm" || "$TERM" == "xterm-256color" ]] then
bindkey "^[OD" backward-char
bindkey "^[OC" forward-char
bindkey "^[OA" up-history
bindkey "^[OB" down-history
# DEC keyboard KP_F1 - KP_F4
bindkey -s "^[OP" "^["
bindkey "^[OQ" undo
bindkey "^[OR" undefined-key
bindkey "^[OS" kill-line
fi
if [[ "$TERM" == "gnome" ]] then
# or gnome terminal F1 - F4
bindkey -s "^[OP" "^["
bindkey "^[OQ" undo
bindkey "^[OR" undefined-key
bindkey "^[OS" kill-line
fi
# Function keys F1 - F12
if [[ "$TERM" == "linux" ]] then
# On console the first five function keys
bindkey "^[[[A" undefined-key
bindkey "^[[[B" undefined-key
bindkey "^[[[C" undefined-key
bindkey "^[[[D" undefined-key
bindkey "^[[[E" undefined-key
else
# The first five standard function keys
bindkey "^[[11~" undefined-key
bindkey "^[[12~" undefined-key
bindkey "^[[13~" undefined-key
bindkey "^[[14~" undefined-key
bindkey "^[[15~" undefined-key
fi
bindkey "^[[17~" undefined-key
bindkey "^[[18~" undefined-key
bindkey "^[[19~" undefined-key
bindkey "^[[20~" undefined-key
bindkey "^[[21~" undefined-key
# Note: F11, F12 are identical with Shift_F1 and Shift_F2
bindkey "^[[23~" undefined-key
bindkey "^[[24~" undefined-key
# Shift Function keys F1 - F12
# identical with F11 - F22
#
# bindkey "^[[23~" undefined-key
# bindkey "^[[24~" undefined-key
bindkey "^[[25~" undefined-key
bindkey "^[[26~" undefined-key
# DEC keyboard: F15=^[[28~ is Help
bindkey "^[[28~" undefined-key
# DEC keyboard: F16=^[[29~ is Menu
bindkey "^[[29~" undefined-key
bindkey "^[[31~" undefined-key
bindkey "^[[32~" undefined-key
bindkey "^[[33~" undefined-key
bindkey "^[[34~" undefined-key
if [[ "$TERM" == "xterm" || "$TERM" == "xterm-256color" ]] then
# Not common
bindkey "^[[35~" undefined-key
bindkey "^[[36~" undefined-key
fi
if [[ "$TERM" == "xterm" || "$TERM" == "xterm-256color" ]] then
# Application keypad and cursor of xterm
# with NumLock ON
#
# Operators
bindkey -s "^[Oo" "/"
bindkey -s "^[Oj" "*"
bindkey -s "^[Om" "-"
bindkey -s "^[Ok" "+"
bindkey -s "^[Ol" ","
bindkey -s "^[OM" "\n"
bindkey -s "^[On" "."
# Numbers
bindkey -s "^[Op" "0"
bindkey -s "^[Oq" "1"
bindkey -s "^[Or" "2"
bindkey -s "^[Os" "3"
bindkey -s "^[Ot" "4"
bindkey -s "^[Ou" "5"
bindkey -s "^[Ov" "6"
bindkey -s "^[Ow" "7"
bindkey -s "^[Ox" "8"
bindkey -s "^[Oy" "9"
fi
# EMACS line editing
if [[ "$ZSHEDIT" == "emacs" ]] then
# ... xterm application cursor
if [[ "$TERM" == "xterm" || "$TERM" == "xterm-256color" ]] then
bindkey "^[^[OD" backward-word
bindkey "^[^[OC" forward-word
bindkey "^[^[OA" up-history
bindkey "^[^[OB" down-history
bindkey "^^[OD" backward-char
bindkey "^^[OC" forward-char
bindkey "^^[OA" up-history
bindkey "^^[OB" down-history
fi
# Standard cursor
bindkey "^[^[[D" backward-word
bindkey "^[^[[C" forward-word
bindkey "^[^[[A" up-history
bindkey "^[^[[B" down-history
bindkey "^^[[D" backward-char
bindkey "^^[[C" forward-char
bindkey "^^[[A" up-history
bindkey "^^[[B" down-history
fi
# Aliases exported from /etc/bash.bashrc
alias ..='cd ..'
alias ...='cd ../..'
alias beep='echo -en "\007"'
alias cd..='cd ..'
alias dir='ls -l'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias ip='ip --color=auto'
alias l='ls -alF'
alias la='ls -la'
alias ll='ls -l'
alias ls-l='ls -l'
alias md='mkdir -p'
alias o=less
alias rd=rmdir
alias unmount='echo "Error: Try the command: umount" 1>&2; false'
alias which-command=whence
alias you='if test "$EUID" = 0 ; then /sbin/yast2 online_update ; else su - -c "/sbin/yast2 online_update" ; fi'
test -s $HOME/.alias && . $HOME/.alias
#
# Colored file listings
#
if test -x /usr/bin/dircolors ; then
#
# set up the color-ls environment variables:
#
if test -f $HOME/.dir_colors ; then
eval "`/usr/bin/dircolors -b $HOME/.dir_colors`"
elif test -f /etc/DIR_COLORS ; then
eval "`/usr/bin/dircolors -b /etc/DIR_COLORS`"
fi
fi
# ls color option depends on the terminal
# If LS_COLORS is set but empty, the terminal has no colors.
if test "${LS_COLORS+empty}" = "${LS_COLORS:+empty}" ; then
LS_OPTIONS=--color=tty
else
LS_OPTIONS=--color=none
fi
if test "$UID" = 0 ; then
LS_OPTIONS="-A -N $LS_OPTIONS -T 0"
else
LS_OPTIONS="-N $LS_OPTIONS -T 0"
fi
# Avoid trouble with Emacs shell mode
if test "$EMACS" = "t" ; then
LS_OPTIONS='-N --color=none -T 0';
fi
export LS_OPTIONS
# Set GPG_TTY for curses pinentry
# (see man gpg-agent and bnc#619295)
if test -t && type -p tty > /dev/null 2>&1 ; then
GPG_TTY="`tty`"
export GPG_TTY
fi
# Read custom system-wide config if exists
test -s /etc/zsh.zshrc.local && . /etc/zsh.zshrc.local

50
zshrc.rhs Normal file
View File

@ -0,0 +1,50 @@
#
# /etc/zshrc is sourced in interactive shells. It
# should contain commands to set up aliases, functions,
# options, key bindings, etc.
#
## shell functions
#setenv() { export $1=$2 } # csh compatibility
# Set prompts
PROMPT='[%n@%m]%~%# ' # default prompt
#RPROMPT=' %~' # prompt for right side of screen
# bindkey -v # vi key bindings
# bindkey -e # emacs key bindings
bindkey ' ' magic-space # also do history expansion on space
# Provide pathmunge for /etc/profile.d scripts
pathmunge()
{
if ! echo $PATH | /bin/grep -qE "(^|:)$1($|:)" ; then
if [ "$2" = "after" ] ; then
PATH=$PATH:$1
else
PATH=$1:$PATH
fi
fi
}
_src_etc_profile_d()
{
# Make the *.sh things happier, and have possible ~/.zshenv options like
# NOMATCH ignored.
emulate -L ksh
# from bashrc, with zsh fixes
if [[ ! -o login ]]; then # We're not a login shell
for i in /etc/profile.d/*.sh; do
if [ -r "$i" ]; then
. $i
fi
done
unset i
fi
}
_src_etc_profile_d
unset -f pathmunge _src_etc_profile_d