+#
+# Conditional build
+%bcond_without static # don't build static
+%bcond_with dietlibc # link with dietlibc, implies without static
+%bcond_with uClibc # link with uclibc
# Branch: HEAD
-# conditional build:
-# _without_embed - don't build uClibc version
+
+%if %{with dietlibc}
+%undefine with_static
+%endif
+
Summary: Small bourne shell from Berkeley
Summary(de): Kleine Bourne-Shell von Berkeley
+Summary(es): Pequeña shell bourne de Berkeley
Summary(fr): Shell Bourne réduit de Berkeley
-Summary(pl): Ma³y shell bourne'a
+Summary(pl): Ma³y shell bourne'a
+Summary(pt_BR): Pequena shell bourne de Berkeley
+Summary(ru): ïÂÌÅÇÞÅÎÎÁÑ ×ÅÒÓÉÑ Bourne shell (sh)
Summary(tr): Ufak bir bourne kabuðu
+Summary(uk): ðÏÌÅÇÛÅÎÁ ×ÅÒÓ¦Ñ Bourne shell (sh)
+Summary(zh_CN): [ϵͳ]BerkeleyµÄ΢ÐÍBourne Shell
+Summary(zh_TW): [\e-A¨t\e$)B²Î]Berkeleyªº\e-A·L\e$)B«¬Bourne Shell
Name: ash
Version: 0.4.0
-Release: 5
+Release: 10
License: BSD
Group: Applications/Shells
-Group(de): Applikationen/Shells
-Group(pl): Aplikacje/Pow³oki
-Source: %{name}-%{version}.tar.gz
+Source0: %{name}-%{version}.tar.gz
+# Source0-md5: 1c59f5b62a081cb0cb3b053c01d79529
Patch0: %{name}-builtin.patch
Patch1: %{name}-echo.patch
Patch2: %{name}-getcwd.patch
Patch18: %{name}-ppid.patch
Patch19: %{name}-freebsd.patch
Patch20: %{name}-sighup.patch
-Prereq: fileutils
-Prereq: grep
-BuildRequires: glibc-static
-BuildRequires: flex
+Patch21: %{name}-dietlibc.patch
BuildRequires: byacc
-%if %{!?_without_embed:1}%{?_without_embed:0}
-BuildRequires: uClibc-devel
-BuildRequires: uClibc-static
+%{?with_dietlibc:BuildRequires: dietlibc-devel}
+BuildRequires: flex
+%if %{with static}
+%{?without_uClibc:BuildRequires: glibc-static}
+%{?with_uClibc:BuildRequires: uClibc-static > 2:0.9.27-1}
%endif
+%{?with_uClibc:BuildRequires: uClibc-devel > 2:0.9.27-1}
+Requires(post,preun,verify): grep
+Requires(preun): fileutils
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
Conflicts: mkinitrd <= 1.7
-%define embed_path /usr/lib/embed
-%define embed_cc %{_arch}-uclibc-cc
-%define embed_cflags %{rpmcflags} -Os
-
%define _bindir /bin
%description
Standard-Bourne-Shell- Befehle unterstützt und dennoch erheblich
weniger Platz beansprucht als bash.
+%description -l es
+Ash es un clon del shell bourne de Berkeley. Soporta todos los
+comandos padrón de la Bourne shell y tiene la ventaja de soportarlos
+con un tamaño considerablemente menor del que bash.
+
%description -l fr
ash est un clone Berkeley du shell Bourne. Il gère toutes les
commandes standard du shell Bourne et a l'avantage de les gérer tout
en restant considérablement plus petit que bash.
%description -l pl
-Ash jest klonem shell'a Bourne'a z Berkeley. Obs³uguje standardowe
-komendy shell'a Bourne'a i jest mniejszy ni¿ bash.
+Ash jest klonem shella Bourne'a z Berkeley. Obs³uguje standardowe
+komendy shella Bourne'a i jest mniejszy ni¿ bash.
+
+%description -l pt_BR
+ash é um clone do shell bourne de Berkeley. Ele suporta todos os
+comandos-padrão da Bourne shell e tem a vantagem de suportá-los com um
+tamanho consideravelmente menor do que bash.
+
+%description -l ru
+ûÅÌÌ - ÜÔÏ ÂÁÚÏ×ÁÑ ÓÉÓÔÅÍÎÁÑ ÐÒÏÇÒÁÍÍÁ, ËÏÔÏÒÁÑ ÉÎÔÅÒÐÒÅÔÉÒÕÅÔ ËÏÍÁÎÄÙ
+ÐÏÌØÚÏ×ÁÔÅÌÑ, ××ÏÄÉÍÙÅ Ó ËÌÁ×ÉÁÔÕÒÙ ÉÌÉ ÐÒÉ ÐÏÍÏÝÉ ÍÙÛÉ. Ash - ÜÔÏ
+ËÌÏÎ Bourne shell (sh) ÉÚ âÅÒËÌÉ. Ash ÐÏÄÄÅÒÖÉ×ÁÅÔ ×ÓÅ ÓÔÁÎÄÁÒÔÎÙÅ
+ËÏÍÁÎÄÙ ÛÅÌÌÁ sh, ÂÕÄÕÞÉ ÚÎÁÞÉÔÅÌØÎÏ ÍÅÎØÛÅ ÞÅÍ sh. ÷ ash ÏÔÓÕÔÓÔ×ÕÀÔ
+ÎÅËÏÔÏÒÙÅ ×ÏÚÍÏÖÎÏÓÔÉ Bourne shell (ÎÁÐÒÉÍÅÒ, ÉÓÔÏÒÉÑ ËÏÍÁÎÄ), ÎÏ ÏÎ
+ÔÒÅÂÕÅÔ ÚÎÁÞÉÔÅÌØÎÏ ÍÅÎØÛÅ ÐÁÍÑÔÉ.
%description -l tr
ash, Berkeley'in bir bourne kabuðu kopyasýdýr. Standart bourne kabuðu
komutlarýnýn tümünü destekler ve bash kabuðundan daha küçük olma
avantajýna sahiptir.
+%description -l uk
+ûÅÌ - ÃÅ ÂÁÚÏ×Á ÓÉÓÔÅÍÎÁ ÐÒÏÇÒÁÍÁ, ËÏÔÒÁ ¦ÎÔÅÒÐÒÅÔÕ¤ ËÏÍÁÎÄÉ
+ËÏÒÉÓÔÕ×ÁÞÁ, Ñ˦ ××ÏÄÑÔØÓÑ Ú ËÌÁצÁÔÕÒÉ ÁÂÏ ÚÁ ÄÏÐÏÍÏÇÏÀ ÍÉÛ¦. Ash -
+ÃÅ ËÌÏÎ Bourne shell (sh) Ú âÅÒË̦. Ash ЦÄÔÒÉÍÕ¤ ÕÓ¦ ÓÔÁÎÄÁÒÔΦ
+ËÏÍÁÎÄÉ ÛÅÌÁ sh, ÂÕÄÕÞÉ ÚÎÁÞÎÏ ÍÅÎÛÉÍ Î¦Ö sh. ÷ ash צÄÓÕÔΦ ÄÅÑ˦
+ÍÏÖÌÉ×ÏÓÔ¦ Bourne shell (ÎÁÐÒÉËÌÁÄ, ¦ÓÔÏÒ¦Ñ ËÏÍÁÎÄ), ÚÁÔŠצΠ×ÉÍÁÇÁ¤
+ÚÎÁÞÎÏ ÍÅÎÛÅ ÐÁÍ'ÑÔ¦.
+
%package static
Summary: Small bourne shell from Berkeley
Summary(de): Kleine Bourne-Shell von Berkeley
Summary(fr): Shell Bourne réduit de Berkeley
-Summary(pl): Ma³y shell bourne'a
+Summary(pl): Ma³y shell bourne'a
Summary(tr): Ufak bir bourne kabuðu
Group: Applications/Shells
-Group(de): Applikationen/Shells
-Group(pl): Aplikacje/Pow³oki
-Prereq: fileutils
-Prereq: grep
+Requires(post,preun,verify): grep
+Requires(preun): fileutils
Conflicts: mkinitrd <= 1.7
%description static
en restant considérablement plus petit que bash.
%description static -l pl
-Ash jest klonem shell'a Bourne'a z Berkeley. Obs³uguje standardowe
-komendy shell'a Bourne'a i jest mniejszy ni¿ bash.
+Ash jest klonem shella Bourne'a z Berkeley. Obs³uguje standardowe
+komendy shella Bourne'a i jest mniejszy ni¿ bash.
%description static -l tr
ash, Berkeley'in bir bourne kabuðu kopyasýdýr. Standart bourne kabuðu
komutlarýnýn tümünü destekler ve bash kabuðundan daha küçük olma
avantajýna sahiptir.
-%package embed
-Summary: Small bourne shell from Berkeley
-Summary(de): Kleine Bourne-Shell von Berkeley
-Summary(fr): Shell Bourne réduit de Berkeley
-Summary(pl): Ma³y shell bourne'a
-Summary(tr): Ufak bir bourne kabuðu
-Group: Applications/Shells
-Group(de): Applikationen/Shells
-Group(pl): Aplikacje/Pow³oki
-
-%description embed
-ash is a bourne shell clone from Berkeley. It supports all of the
-standard Bourne shell commands and has the advantage of supporting
-them while remaining considerably smaller than bash.
-Version for embedded systems.
-
%prep
%setup -q
%patch0 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1
+%{?_with_dietlibc:%patch21 -p1}
%build
-# BOOT
-%if %{!?_without_embed:1}%{?_without_embed:0}
-# some of this utilities does not compile with uClibc
-# and it is not necessary
-%{__make} mksignames mkbuiltins mknodes mksignames mksyntax mktokens
-%{__make} \
- OPT_FLAGS="%{embed_cflags}" \
- CC=%{embed_cc}
-mv -f sh ash-embed-shared
-%{__make} \
- OPT_FLAGS="%{embed_cflags}" \
- LDFLAGS="-static" \
- CC=%{embed_cc}
-mv -f sh ash-embed-static
-%{__make} clean
-%endif
-# other
-%{__make} OPT_FLAGS="%{rpmcflags}" LDFLAGS="-static %{rpmldflags}"
-mv -f sh ash.static
-%{__make} OPT_FLAGS="%{rpmcflags}" LDFLAGS="%{rpmldflags}"
+%define __cc %{_target_cpu}-pld-linux-gcc
+%{?with_dietlibc:%define __cc %{_target_cpu}-dietlibc-gcc}
+%{?with_uClibc:%define __cc %{_target_cpu}-uclibc-gcc}
+
+%{?with_static:%{__make} OPT_FLAGS="%{rpmcflags}" LDFLAGS="-static %{rpmldflags}" CC="%{__cc}"}
+%{?with_static:mv -f sh ash.static}
+%{__make} OPT_FLAGS="%{rpmcflags}" LDFLAGS="%{rpmldflags}" CC="%{__cc}"
%install
rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT{%{_bindir},%{_mandir}/man1}
-# BOOT
-%if %{!?_without_embed:1}%{?_without_embed:0}
-install -d $RPM_BUILD_ROOT/%{embed_path}/{shared,static}
-install ash-embed-static $RPM_BUILD_ROOT/%{embed_path}/static/ash
-install ash-embed-shared $RPM_BUILD_ROOT/%{embed_path}/shared/ash
-ln -sf ash $RPM_BUILD_ROOT/%{embed_path}/shared/sh
-ln -sf ash $RPM_BUILD_ROOT/%{embed_path}/static/sh
-%endif
-
-# other
-install -d $RPM_BUILD_ROOT/{%{_bindir},%{_mandir}/man1}
install sh $RPM_BUILD_ROOT%{_bindir}/ash
-install ash.static $RPM_BUILD_ROOT%{_bindir}/ash.static
+%{?with_static:install ash.static $RPM_BUILD_ROOT%{_bindir}/ash.static}
install sh.1 $RPM_BUILD_ROOT%{_mandir}/man1/ash.1
echo ".so ash.1" > $RPM_BUILD_ROOT%{_mandir}/man1/bsh.1
-ln -sf ash $RPM_BUILD_ROOT/%{_bindir}/bsh
+ln -sf ash $RPM_BUILD_ROOT%{_bindir}/bsh
+
+%clean
+rm -rf $RPM_BUILD_ROOT
%post
+umask 022
if [ ! -f /etc/shells ]; then
- echo "%{_bindir}/ash" > /etc/shells
- echo "%{_bindir}/bsh" >> /etc/shells
+ echo "%{_bindir}/ash" > /etc/shells
+ echo "%{_bindir}/bsh" >> /etc/shells
else
- if ! grep -q '^%{_bindir}/ash$' /etc/shells ; then
- echo "%{_bindir}/ash" >> /etc/shells
- fi
- if ! grep -q '^%{_bindir}/bsh$' /etc/shells ; then
- echo "%{_bindir}/bsh" >> /etc/shells
- fi
+ if ! grep -q '^%{_bindir}/ash$' /etc/shells ; then
+ echo "%{_bindir}/ash" >> /etc/shells
+ fi
+ if ! grep -q '^%{_bindir}/bsh$' /etc/shells ; then
+ echo "%{_bindir}/bsh" >> /etc/shells
+ fi
+fi
+
+%preun
+if [ "$1" = 0 ]; then
+ umask 022
+ grep -v '^%{_bindir}/ash$' /etc/shells | grep -v '^%{_bindir}/bsh$' > /etc/shells.new
+ mv -f /etc/shells.new /etc/shells
fi
%post static
+umask 022
if [ ! -f /etc/shells ]; then
- echo "%{_bindir}/ash.static" >> /etc/shells
+ echo "%{_bindir}/ash.static" >> /etc/shells
else
- if ! grep -q '^%{_bindir}/ash.static$' /etc/shells ; then
- echo "%{_bindir}/ash.static" >> /etc/shells
- fi
-fi
-
-%preun
-if [ "$1" = 0 ]; then
- grep -v '^%{_bindir}/ash$' /etc/shells | grep -v '^%{_bindir}/bsh$' > /etc/shells.new
- mv -f /etc/shells.new /etc/shells
+ if ! grep -q '^%{_bindir}/ash.static$' /etc/shells ; then
+ echo "%{_bindir}/ash.static" >> /etc/shells
+ fi
fi
%preun static
if [ "$1" = 0 ]; then
- grep -v '^%{_bindir}/ash\.static$' /etc/shells > /etc/shells.new
- mv -f /etc/shells.new /etc/shells
+ umask 022
+ grep -v '^%{_bindir}/ash\.static$' /etc/shells > /etc/shells.new
+ mv -f /etc/shells.new /etc/shells
fi
%verifyscript
for n in ash bsh ; do
- echo -n "Looking for $n in /etc/shells... "
- if ! grep -q "^%{_bindir}/${n}\$" /etc/shells ; then
- echo "missing"
- echo "${n} missing from /etc/shells" >&2
- else
- echo "found"
- fi
+ echo -n "Looking for $n in /etc/shells... "
+ if ! grep -q "^%{_bindir}/${n}\$" /etc/shells ; then
+ echo "missing"
+ echo "${n} missing from /etc/shells" >&2
+ else
+ echo "found"
+ fi
done
%verifyscript static
echo "found"
fi
-%clean
-rm -rf $RPM_BUILD_ROOT
-
%files
%defattr(644,root,root,755)
%attr(755,root,root) %{_bindir}/ash
%attr(755,root,root) %{_bindir}/bsh
%{_mandir}/man1/*
+%if %{with static}
%files static
%defattr(644,root,root,755)
%attr(755,root,root) %{_bindir}/ash.static
-
-%if %{!?_without_embed:1}%{?_without_embed:0}
-%files embed
-%defattr(644,root,root,755)
-%attr(755,root,root) %{embed_path}/*/*
%endif