You are not logged in.

#1 2010-10-06 13:02:49

naeg
Member
Registered: 2010-07-30
Posts: 10

[Shell] PKGBUILD: Replace source variable

Hello

I want to replace the source variable in a PKGBUILD with a new one.
As you might know, the source variable can go over several lines.

An example:

PKGBUILD:

...
source=(http://foobar.org/foo.tar.bz2
bar.patch)
...

Then, after executing a script with sed/awk/whatever, it should look like this:

new PKGBUILD:

...
source=(http://foobar.org/foo.tar.bz2
bar.patch
general.patch)
...

I just can't solve this problem...not a shell scripting guru.

Thanks in advance


greetings naeg

Offline

#2 2010-10-06 13:04:45

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: [Shell] PKGBUILD: Replace source variable

What is the problem you are trying to solve? You should not be creating a PKGBUILD that is self modifying.

This smells like Bashphorism #0.

Offline

#3 2010-10-06 13:12:32

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,487
Website

Re: [Shell] PKGBUILD: Replace source variable

awk '/^[[:space:]]*source=/,/)/' PKGBUILD

should get you on your way...

Offline

#4 2010-10-06 13:12:40

naeg
Member
Registered: 2010-07-30
Posts: 10

Re: [Shell] PKGBUILD: Replace source variable

We, from ArchMobile, want to make all our changes we do to the PKGBUILDs from Arch Linux with the use of patches. So, these patches have to be added to the source variable, and I don't want to do this by hand to all those PKGBUILDs.


greetings naeg

Offline

Board footer

Powered by FluxBB