diff --git a/bash-4.4-no-loadable-builtins.patch b/bash-4.4-no-loadable-builtins.patch new file mode 100644 index 0000000000000000000000000000000000000000..b03459d56d3ced02350466dadd54c0e03607452a --- /dev/null +++ b/bash-4.4-no-loadable-builtins.patch @@ -0,0 +1,15 @@ +diff --git a/Makefile.in b/Makefile.in +index a1f9483..24c646a 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -800,7 +800,6 @@ install: .made installdirs + infodir=$(infodir) htmldir=$(htmldir) DESTDIR=$(DESTDIR) $@ ) + -( cd $(DEFDIR) ; $(MAKE) $(MFLAGS) DESTDIR=$(DESTDIR) $@ ) + -( cd $(PO_DIR) ; $(MAKE) $(MFLAGS) DESTDIR=$(DESTDIR) $@ ) +- -( cd $(LOADABLES_DIR) && $(MAKE) $(MFLAGS) DESTDIR=$(DESTDIR) $@ ) + + install-strip: + $(MAKE) $(MFLAGS) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' \ +-- +2.9.3 + diff --git a/bash-5.2-alpha.tar.gz b/bash-5.2-alpha.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..b4b67a2c0ccb89464958df284130021868376dc9 Binary files /dev/null and b/bash-5.2-alpha.tar.gz differ diff --git a/bash.spec b/bash.spec new file mode 100644 index 0000000000000000000000000000000000000000..ac59ed35687d1675aa66957e720442c24b48d663 --- /dev/null +++ b/bash.spec @@ -0,0 +1,240 @@ +%define anolis_release 1 +%bcond_without tests + +Version: 5.2~alpha +Name: bash +Summary: The GNU Bourne Again shell +Release: %{anolis_release}%{?dist} +License: GPLv3+ +Url: https://www.gnu.org/software/bash +Source0: http://git.savannah.gnu.org/cgit/bash.git/snapshot/bash-5.2-alpha.tar.gz + +Source1: dot-bashrc +Source2: dot-bash_profile +Source3: dot-bash_logout + +# disable loadable build +Patch1: bash-4.4-no-loadable-builtins.patch + +BuildRequires: gcc +BuildRequires: texinfo bison +BuildRequires: ncurses-devel +BuildRequires: autoconf, gettext +# Required for bash tests +BuildRequires: glibc-all-langpacks +BuildRequires: make +Requires: filesystem >= 3 +Provides: /bin/sh +Provides: /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 %{name}-5.2-alpha -p1 + +echo %{version} > _distribution +echo %{release} > _patchlevel + +# force refreshing the generated files +rm y.tab.* + +%build +autoconf +%configure --with-bash-malloc=no --with-afs + +MFLAGS="CPPFLAGS=-D_GNU_SOURCE -DRECYCLES_PIDS -DDEFAULT_PATH_VALUE='\"/usr/local/bin:/usr/bin\"' `getconf LFS_CFLAGS` -DSYSLOG_HISTORY -DSYSLOG_SHOPT=0" + +# work around missing deps in Makefiles +make "$MFLAGS" version.h +make "$MFLAGS" %{?_smp_mflags} -C builtins +make "$MFLAGS" %{?_smp_mflags} + +%install +if [ -e autoconf ]; then + export PATH=.:$PATH +fi + +sed -i -e 's,bashref\.info,bash.info,' doc/bashref.info + +%make_install install-headers + +mkdir -p %{buildroot}/%{_sysconfdir} + +# make manpages for bash builtins as per suggestion in DOC/README +pushd doc +sed -e ' +/^\.SH NAME/, /\\- bash built-in commands, see \\fBbash\\fR(1)$/{ +/^\.SH NAME/d +s/^bash, // +s/\\- bash built-in commands, see \\fBbash\\fR(1)$// +s/,//g +b +} +d +' builtins.1 > man.pages +for i in echo pwd test kill; do + sed -i -e "s,$i,,g" man.pages + sed -i -e "s, , ,g" man.pages +done + +install -p -m 644 builtins.1 %{buildroot}%{_mandir}/man1/builtins.1 + +for i in `cat man.pages` ; do + echo .so man1/builtins.1 > %{buildroot}%{_mandir}/man1/$i.1 + chmod 0644 %{buildroot}%{_mandir}/man1/$i.1 +done +popd + +# Link bash man page to sh so that man sh works. +ln -s bash.1 %{buildroot}%{_mandir}/man1/sh.1 + +# Not for printf, true and false (conflict with coreutils) +rm -f %{buildroot}/%{_mandir}/man1/printf.1 +rm -f %{buildroot}/%{_mandir}/man1/true.1 +rm -f %{buildroot}/%{_mandir}/man1/false.1 + +ln -sf bash %{buildroot}%{_bindir}/sh +rm -f %{buildroot}%{_infodir}/dir +mkdir -p %{buildroot}%{_sysconfdir}/skel +install -p -m644 %SOURCE1 %{buildroot}/etc/skel/.bashrc +install -p -m644 %SOURCE2 %{buildroot}/etc/skel/.bash_profile +install -p -m644 %SOURCE3 %{buildroot}/etc/skel/.bash_logout +LONG_BIT=$(getconf LONG_BIT) +mv %{buildroot}%{_bindir}/bashbug \ + %{buildroot}%{_bindir}/bashbug-"${LONG_BIT}" +ln -s bashbug-"${LONG_BIT}" %{buildroot}%{_bindir}/bashbug +ln -s bashbug.1 %{buildroot}/%{_mandir}/man1/bashbug-"$LONG_BIT".1 + +for script in \ + examples/scripts/shprompt +# I don't know why these are gone in 4.3 + #examples/scripts/krand.bash \ + #examples/scripts/bcsh.sh \ + #examples/scripts/precedence \ +do + cp "$script" "$script"-orig + echo '#!/bin/bash' > "$script" + cat "$script"-orig >> "$script" + rm -f "$script"-orig +done + +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 + +%find_lang %{name} + +# copy doc to /usr/share/doc +cat /dev/null > %{name}-doc.files +mkdir -p %{buildroot}/%{_pkgdocdir}/doc +# loadables aren't buildable +rm -rf examples/loadables +for file in CHANGES COMPAT NEWS NOTES POSIX RBASH README examples +do + cp -rp "$file" %{buildroot}%{_pkgdocdir}/"$file" + echo "%%doc %{_pkgdocdir}/$file" >> %{name}-doc.files +done +echo "%%doc %{_pkgdocdir}/doc" >> %{name}-doc.files + + + +%if %{with tests} +%check +make check +%endif + +%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 +%dir %{_pkgdocdir}/ +%license COPYING +%attr(0755,root,root) %{_bindir}/bashbug[-.]* +%{_bindir}/bashbug +%{_infodir}/bash.info* +%{_mandir}/*/* +%{_mandir}/*/..1* +%doc RBASH README +%doc doc/{FAQ,INTRO,README,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 +* Fri Mar 04 2022 Chunmei Xu - 5.2-alpha-1 +- init from upstream bash 5.2-alpha and disable loadable build diff --git a/dot-bash_logout b/dot-bash_logout new file mode 100644 index 0000000000000000000000000000000000000000..af7c6fd8fd1d77b1081711bd0e497161446cc7d0 --- /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 0000000000000000000000000000000000000000..55136b96f7b5901dec91127071e2b5f2031caea8 --- /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 0000000000000000000000000000000000000000..ad4581ea0ce23406fec92585e9d806dd085a11f2 --- /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