Use perl or csh or tcl from inside the spec file?

Panu Matilainen pmatilai at laiskiainen.org
Wed Feb 15 06:53:43 UTC 2012


On 02/15/2012 12:25 AM, Red Cricket wrote:
> I could of sworn there was a way to do something like this ...
>
> %install #!/usr/SD/perl/bin/perl
> my $DESTDIR=$ENV{'RPM_BUILD_ROOT');
> my $VAS_STOW_TOP        = ".";
> my $LICENSE_DIRNAME     = "/etc/opt/quest/vas/.licenses";
> my $LICENSE_FILENAME    = "QAS-100-813-787.txt";
>
> But obviously that is not right as rpmbuild fails with this message:
>
>
> /var/tmp/rpm-tmp.5HpWke: line 28: syntax error near unexpected token `)'
> error: Bad exit status from /var/tmp/rpm-tmp.5HpWke (%install)
>
> Isn't a way to use something besides /bin/sh inside the spec file?

Not really. For install-time scripts like %post etc you can specify an 
alternative interpreter with eg "%post -p /usr/bin/perl" but that 
doesn't work for the build-time scripts.

Technically you can change the shell used for building by overriding 
%___build_shell but rpmbuild assumes a Bourne shell compatible shell, 
and if it's changed to something else, not a whole lot is going to work.

What you can do is have the other-language scripts as separate sources, 
and then explicitly run those. Eg

Source10: my-install.pl

%install
/usr/SD/perl/bin/perl %{SOURCE10}

Creating them in-place with here-documents and running that also works.

	- Panu -


More information about the Rpm-list mailing list