From 34ae35e06a1fca2b24d92ade1d5afa283a4841c6 Mon Sep 17 00:00:00 2001 From: forrest_ly Date: Tue, 1 Mar 2022 20:58:15 +0800 Subject: [PATCH 1/2] Init for Anolis OS 23 --- .gitattributes | 1 + README.md | 11 ---- bash-5.2-alpha.tar.gz | 3 + bash.spec | 150 ++++++++++++++++++++++++++++++++++++++++++ dot-bash_logout | 2 + dot-bash_profile | 8 +++ dot-bashrc | 27 ++++++++ 7 files changed, 191 insertions(+), 11 deletions(-) create mode 100644 .gitattributes delete mode 100644 README.md create mode 100644 bash-5.2-alpha.tar.gz create mode 100644 bash.spec create mode 100644 dot-bash_logout create mode 100644 dot-bash_profile create mode 100644 dot-bashrc diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..d5fc5f8 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.tar.* filter=lfs diff=lfs merge=lfs -text diff --git a/README.md b/README.md deleted file mode 100644 index 7342728..0000000 --- a/README.md +++ /dev/null @@ -1,11 +0,0 @@ -Anolis OS -======================================= -# 代码仓库说明 -## 分支说明 ->进行代码开发工作时,请注意选择当前版本对应的分支 -* aX分支为对应大版本的主分支,如a8分支对应当前最新版本 -* aX.Y分支为对应小版本的维护分支,如a8.2分支对应8.2版本 -## 开发流程 -1. 首先fork目标分支到自己的namespace -2. 在自己的fork分支上做出修改 -3. 向对应的仓库中提交merge request,源分支为fork分支 diff --git a/bash-5.2-alpha.tar.gz b/bash-5.2-alpha.tar.gz new file mode 100644 index 0000000..574e32a --- /dev/null +++ b/bash-5.2-alpha.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5da1ce90054f17fde5f9b15d56581be55b51be28d0f9cd8b36a776db4f4af006 +size 10731197 diff --git a/bash.spec b/bash.spec new file mode 100644 index 0000000..054dfac --- /dev/null +++ b/bash.spec @@ -0,0 +1,150 @@ +%global bashver 5.2-alpha + +Name: bash +Version: 5.2~alpha +Release: 1%{?dist} +Summary: The GNU Bourne Again shell + +License: GPLv3+ +URL: https://www.gnu.org/software/bash +Source0: https://ftp.gnu.org/gnu/bash/bash-%{bashver}.tar.gz +Source1: dot-bashrc +Source2: dot-bash_profile +Source3: dot-bash_logout + +BuildRequires: gcc make texinfo bison ncurses-devel autoconf gettext glibc-all-langpacks coreutils util-linux +Requires: filesystem +Provides: /bin/sh /bin/bash + +%description +The GNU Bourne Again shell (Bash) is a shell or command language +interpreter that is compatible with the Bourne shell (sh). Bash +incorporates useful features from the Korn shell (ksh) and the C shell +(csh). Most sh scripts can be run by bash without modification. + +%package devel +Summary: Development headers for %{name} +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description devel +This package contains development headers for %{name}. + +%package doc +Summary: Documentation files for %{name} +Requires: %{name} = %{version}-%{release} + +%description doc +This package contains documentation files for %{name}. + +%prep +%autosetup -n bash-%{bashver} + +%build +autoconf +%configure --with-bash-malloc=no --with-afs +make version.h +make %{?_smp_mflags} -C builtins +make %{?_smp_mflags} + +%install +rm -rf $RPM_BUILD_ROOT +%make_install install-headers + +ln -sf bash %{buildroot}%{_bindir}/sh + +for ea in alias bg cd command fc fg getopts hash jobs read type ulimit umask unalias wait +do + cat < "%{buildroot}"/%{_bindir}/"$ea" +#!/bin/sh +builtin $ea "\$@" +EOF +chmod +x "%{buildroot}"/%{_bindir}/"$ea" +done + +mkdir -p %{buildroot}/etc/skel/ +install -p -m644 %SOURCE1 %SOURCE2 %SOURCE3 %{buildroot}/etc/skel/ +rename dot- . %{buildroot}/etc/skel/dot-* + +%find_lang %{name} + +install -d %{buildroot}/%{_pkgdocdir}/doc +install -p CHANGES COMPAT NEWS NOTES POSIX RBASH README %{buildroot}%{_pkgdocdir}/ + +rm -rf examples/loadables +cp -rp examples %{buildroot}/%{_pkgdocdir}/doc/ + +ls %{buildroot}/%{_pkgdocdir}/ | xargs -i echo "%%doc %{_pkgdocdir}/{}" >> %{name}-doc.files + +rm -rf %{buildroot}%{_libdir}/%{name} %{buildroot}/usr/lib/debug %{buildroot}%{_bindir}/bashbug %{buildroot}/usr/share/info/dir + +%check +make check + +%post -p +nl = '\n' +sh = '/bin/sh'..nl +bash = '/bin/bash'..nl +f = io.open('/etc/shells', 'a+') +if f then + local shells = nl..f:read('*all')..nl + if not shells:find(nl..sh) then f:write(sh) end + if not shells:find(nl..bash) then f:write(bash) end + f:close() +end + +%postun -p +-- Run it only if we are uninstalling +if arg[2] == 0 +then + t={} + for line in io.lines("/etc/shells") + do + if line ~= "/bin/bash" and line ~= "/bin/sh" + then + table.insert(t,line) + end + end + + f = io.open("/etc/shells", "w+") + for n,line in pairs(t) + do + f:write(line.."\n") + end + f:close() +end + +%files -f %{name}.lang +%config(noreplace) /etc/skel/.b* +%{_bindir}/sh +%{_bindir}/bash +%{_bindir}/alias +%{_bindir}/bg +%{_bindir}/cd +%{_bindir}/command +%{_bindir}/fc +%{_bindir}/fg +%{_bindir}/hash +%{_bindir}/getopts +%{_bindir}/jobs +%{_bindir}/read +%{_bindir}/type +%{_bindir}/ulimit +%{_bindir}/umask +%{_bindir}/unalias +%{_bindir}/wait +%license COPYING +%{_infodir}/bash.info* +%{_mandir}/*/* +%doc RBASH README +%doc doc/{FAQ,INTRO,bash{,ref}.html} + +%files doc -f %{name}-doc.files +%doc doc/*.ps doc/*.0 doc/*.html doc/article.txt + +%files devel +%{_includedir}/%{name} +%{_libdir}/pkgconfig/%{name}.pc + +%changelog +* Tue Mar 1 2022 forrest_ly +- Init for Anolis OS 23 diff --git a/dot-bash_logout b/dot-bash_logout new file mode 100644 index 0000000..af7c6fd --- /dev/null +++ b/dot-bash_logout @@ -0,0 +1,2 @@ +# ~/.bash_logout + diff --git a/dot-bash_profile b/dot-bash_profile new file mode 100644 index 0000000..55136b9 --- /dev/null +++ b/dot-bash_profile @@ -0,0 +1,8 @@ +# .bash_profile + +# Get the aliases and functions +if [ -f ~/.bashrc ]; then + . ~/.bashrc +fi + +# User specific environment and startup programs diff --git a/dot-bashrc b/dot-bashrc new file mode 100644 index 0000000..ad4581e --- /dev/null +++ b/dot-bashrc @@ -0,0 +1,27 @@ +# .bashrc + +# Source global definitions +if [ -f /etc/bashrc ]; then + . /etc/bashrc +fi + +# User specific environment +if ! [[ "$PATH" =~ "$HOME/.local/bin:$HOME/bin:" ]] +then + PATH="$HOME/.local/bin:$HOME/bin:$PATH" +fi +export PATH + +# Uncomment the following line if you don't like systemctl's auto-paging feature: +# export SYSTEMD_PAGER= + +# User specific aliases and functions +if [ -d ~/.bashrc.d ]; then + for rc in ~/.bashrc.d/*; do + if [ -f "$rc" ]; then + . "$rc" + fi + done +fi + +unset rc -- Gitee From 2d0ee8d08d4e9af066c49e8021dad7d26b651b27 Mon Sep 17 00:00:00 2001 From: forrest_ly Date: Fri, 4 Mar 2022 19:19:28 +0800 Subject: [PATCH 2/2] fix changelog --- bash.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash.spec b/bash.spec index 054dfac..0d96070 100644 --- a/bash.spec +++ b/bash.spec @@ -146,5 +146,5 @@ end %{_libdir}/pkgconfig/%{name}.pc %changelog -* Tue Mar 1 2022 forrest_ly +* Tue Mar 1 2022 forrest_ly - 5.2~alpha-1 - Init for Anolis OS 23 -- Gitee