[pacman-dev] configurable shell for install scripts

Allan McRae allan at archlinux.org
Sun Mar 28 14:27:44 CEST 2010


On 28/03/10 22:12, Dieter Plaetinck wrote:
> 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, ..)

No we can not unless I am missing something.  We need to source the 
script and run a particular function within that script.

Allan


More information about the pacman-dev mailing list