diff --git a/README.en.md b/README.en.md deleted file mode 100644 index 25dee73a73ed5566ee992f39abbf5aeb5d0d286b..0000000000000000000000000000000000000000 --- a/README.en.md +++ /dev/null @@ -1,36 +0,0 @@ -# ksh - -#### Description -{**When you're done, you can delete the content in this README and update the file with details for others getting started with your repository**} - -#### Software Architecture -Software architecture description - -#### Installation - -1. xxxx -2. xxxx -3. xxxx - -#### Instructions - -1. xxxx -2. xxxx -3. xxxx - -#### Contribution - -1. Fork the repository -2. Create Feat_xxx branch -3. Commit your code -4. Create Pull Request - - -#### Gitee Feature - -1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md -2. Gitee blog [blog.gitee.com](https://blog.gitee.com) -3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore) -4. The most valuable open source project [GVP](https://gitee.com/gvp) -5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help) -6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/README.md b/README.md deleted file mode 100644 index 46cedf32bec9c1b37c81ccead8c1e22fadbcaae1..0000000000000000000000000000000000000000 --- a/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# ksh - -#### 介绍 -{**以下是码云平台说明,您可以替换此简介** -码云是 OSCHINA 推出的基于 Git 的代码托管平台(同时支持 SVN)。专为开发者提供稳定、高效、安全的云端软件开发协作平台 -无论是个人、团队、或是企业,都能够用码云实现代码托管、项目管理、协作开发。企业项目请看 [https://gitee.com/enterprises](https://gitee.com/enterprises)} - -#### 软件架构 -软件架构说明 - - -#### 安装教程 - -1. xxxx -2. xxxx -3. xxxx - -#### 使用说明 - -1. xxxx -2. xxxx -3. xxxx - -#### 参与贡献 - -1. Fork 本仓库 -2. 新建 Feat_xxx 分支 -3. 提交代码 -4. 新建 Pull Request - - -#### 码云特技 - -1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md -2. 码云官方博客 [blog.gitee.com](https://blog.gitee.com) -3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解码云上的优秀开源项目 -4. [GVP](https://gitee.com/gvp) 全称是码云最有价值开源项目,是码云综合评定出的优秀开源项目 -5. 码云官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) -6. 码云封面人物是一档用来展示码云会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/dotkshrc b/dotkshrc new file mode 100644 index 0000000000000000000000000000000000000000..349e5999266a982181018c0d00ded60571f694c4 --- /dev/null +++ b/dotkshrc @@ -0,0 +1,12 @@ +# .kshrc + +# Source global definitions +if [ -f /etc/kshrc ]; then + . /etc/kshrc +fi + +# use emacs editing mode by default +set -o emacs + +# User specific aliases and functions + diff --git a/ksh-2020.0.0-beta1.tar.gz b/ksh-2020.0.0-beta1.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..2d0209bfe3a6d18f80b7e1dadfc2649737fbc934 Binary files /dev/null and b/ksh-2020.0.0-beta1.tar.gz differ diff --git a/ksh.spec b/ksh.spec new file mode 100644 index 0000000000000000000000000000000000000000..38a8c39f2db204357ffdfc2051e14f0016fa79ff --- /dev/null +++ b/ksh.spec @@ -0,0 +1,92 @@ +Name: ksh +Version: 2020.0.0 +Release: 2 +Summary: The Original ATT Korn Shell +License: EPL +URL: http://www.kornshell.com/ +Epoch: 1 +Source0: https://github.com/att/ast/releases/download/%{version}/%{name}-%{version}.tar.gz +Source1: kshcomp.conf +Source2: kshrc.rhs +Source3: dotkshrc +Provides: /bin/ksh /usr/bin/ksh +BuildRequires: meson gcc glibc-devel ed +Conflicts: pdksh +Requires(post): grep, coreutils, systemd-units +Requires(postun): sed + +%description +KornShell is an interactive command language that provides access to the UNIX system and to +many other systems, on the many different computers and workstations on which it is implemented. + +%package help +Summary: Documentation for ksh package + +%description help +Documentation for ksh package. + +%prep +%autosetup -n %{name}-%{version} + +%build +%meson -Dbuild-api-tests=false +%meson_build + +%install +%meson_install +mv %{buildroot}/%{_bindir}/ksh %{buildroot}/%{_bindir}/ksh93 +mv %{buildroot}/%{_bindir}/shcomp %{buildroot}/%{_bindir}/shcomp93 +mv %{buildroot}/%{_mandir}/man1/ksh.1 %{buildroot}/%{_mandir}/man1/ksh93.1 +install -p -D -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/binfmt.d/kshcomp.conf +install -p -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/kshrc +install -p -D -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/skel/.kshrc + +%post +for s in /bin/ksh /usr/bin/ksh +do + if [ ! -f /etc/shells ]; then + echo "$s" > /etc/shells + else + if ! grep -q '^'"$s"'$' /etc/shells ; then + echo "$s" >> /etc/shells + fi + fi +done + +/bin/systemctl try-restart systemd-binfmt.service >/dev/null 2>&1 || : + +%{_sbindir}/alternatives --install /bin/ksh ksh /bin/ksh93 50 \ + --slave %{_mandir}/man1/ksh.1.gz ksh-man %{_mandir}/man1/ksh93.1.gz \ + --slave /bin/shcomp shcomp93 /bin/shcomp93 2>/dev/null + +%preun +if [ $1 -eq 0 ]; then + %{_sbindir}/alternatives --remove ksh /bin/ksh93 +fi + +%postun +for s in /bin/ksh /usr/bin/ksh +do + if [ ! -f $s ]; then + sed -i '\|^'"$s"'$|d' /etc/shells + fi +done + +%triggerpostun -- ksh < 1:2020.0.0-0.1 +%{_sbindir}/alternatives --auto ksh + +%files +%doc src/cmd/ksh93/{COMPATIBILITY,RELEASE,TYPES} +%{_bindir}/{ksh93,shcomp93} +%config(noreplace) %{_sysconfdir}/skel/.kshrc +%config(noreplace) %{_sysconfdir}/kshrc +%config(noreplace) %{_sysconfdir}/binfmt.d/kshcomp.conf + +%files help +%doc README.md +%{_mandir}/man1/* + +%changelog +* Fri Jan 10 2020 Lijin Yang - 1:2020.0.0-2 +- Package init + diff --git a/kshcomp.conf b/kshcomp.conf new file mode 100644 index 0000000000000000000000000000000000000000..8caf5ab771169919d7879eb90d64407e844c174e --- /dev/null +++ b/kshcomp.conf @@ -0,0 +1 @@ +:kshcomp:M::\x0b\x13\x08::/bin/ksh: diff --git a/kshrc.rhs b/kshrc.rhs new file mode 100644 index 0000000000000000000000000000000000000000..fd8a14c724f2aa644abaafef8f9c28e335d9deff --- /dev/null +++ b/kshrc.rhs @@ -0,0 +1,53 @@ +# +# /etc/kshrc is sourced in interactive shells. It +# should contain commands to set up aliases, functions, +# options, key bindings, etc. +# + +# Set prompts +#PROMPT='[%n@%m]%~%# ' # default prompt +#RPROMPT=' %~' # prompt for right side of screen + +_src_etc_profile_d() +{ + # from zshrc, with ksh 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 +} + +pathmunge () { +case ":${PATH}:" in +*:"$1":*) + ;; +*) + if [ "$2" = "after" ]; then + PATH=$PATH:$1 + else + PATH=$1:$PATH + fi +esac +} + +_src_etc_profile_d + +unset -f _src_etc_profile_d +unset -f pathmunge + +# key bindings - make Delete, Home, End,... work +keybd_trap () { + case ${.sh.edchar} in + $'\e[1~') .sh.edchar=$'\001';; # Home = beginning-of-line + $'\e[F') .sh.edchar=$'\005';; # End = end-of-line + $'\e[5~') .sh.edchar=$'\e>';; # PgUp = history-previous + $'\e[6~') .sh.edchar=$'\e<';; # PgDn = history-next + $'\e[3~') .sh.edchar=$'\004';; # Delete = delete-char + esac +} +trap keybd_trap KEYBD +