[pacman-dev] configurable shell for install scripts

Dieter Plaetinck dieter at plaetinck.be
Sun Mar 28 14:12:35 CEST 2010


On Sun, 28 Mar 2010 21:44:28 +1000
Allan McRae <allan at archlinux.org> wrote:

> Hi,
> 
> I thought I'd run this past people on this list before I spent the
> two weeks that this would take me to figure out how to implement it!
> 
> This is motivated by experience packaging for Arch.   Install
> scriptlets are written assuming /bin/sh is bash, which is true on a
> default system.   But some people want to change their /bin/sh to
> (e.g.) dash. As pacman uses the default shell (as given by /bin/sh)
> to run install scriptlets, pointing /bin/sh at dash may cause
> failures when bash specific features are used.
> 
> So I thought, why not manually specify the shell for install
> scriptlets in pacman.conf.  Something like "INSTALL_SHELL=/bin/sh" by
> default. Then _alpm_runscriptlet would call something like "<shell>
> -c ". <scriptlet path> && <function>"  (which works for bash, dash,
> zsh, pdksh).
> 
> Comments?
> 
> Allan
> 

Hi Allan,

can't we use shebangs instead of inventing our own which-shell-to-use
implementation? (#!/bin/sh, #!/bin/bash, ..)
2 other notes:
1) do we actually _need_ bashims? are install scripts too complex to be
done in just posix sh?
2) I think we should make /bin/sh a posix sh compliant shell. (ie.
dash. yes i know strictly speaking there is one variable missing to
make it really posix compliant or something, but that's a
detail)

Dieter


More information about the pacman-dev mailing list