You are not logged in.

#1 2004-12-01 01:28:49

kleptophobiac
Member
From: Sunnyvale, CA
Registered: 2004-04-25
Posts: 488

Using sed in PKGBUILD

I would like to replace a line in a file using sed when a program makepkg -c is run

Here's the line I have now:

sed -i "s//usr/local/$startdir/pkg/usr/" $startdir/file

The idea is to replace /usr/local in the file with $startdir/pkg/usr, but with $startdir expanded. I initially thought the double quotes around the sed command would work, but apparently not. The file ends up having "$startdir" actually in the line rather than what the script thinks it expands to. It is very annoying. sad

Does anybody know how to make this work?

Offline

#2 2004-12-01 02:11:52

sarah31
Member
From: Middle of Canada
Registered: 2002-08-20
Posts: 2,975
Website

Re: Using sed in PKGBUILD

why not take a look at the several PKGBUILDs that use sed commands to see if you can figure it out? sorry it has been a LONG time since i worked on packages so I cannot point you directly to one.


AKA uknowme

I am not your friend

Offline

#3 2004-12-01 02:13:18

kleptophobiac
Member
From: Sunnyvale, CA
Registered: 2004-04-25
Posts: 488

Re: Using sed in PKGBUILD

I have no idea which packages use sed, though I'm sure they're there.

http://arch.subpop.net/sources/cedega/PKGBUILD

I found that one!

Offline

#4 2004-12-01 02:20:41

kleptophobiac
Member
From: Sunnyvale, CA
Registered: 2004-04-25
Posts: 488

Re: Using sed in PKGBUILD

aha! I refined my google search and came up with something useful. smile

sed -i "s%/usr/local%$startdir/pkg/usr%g" $startdir/file

IT WORKED!!
w00t

Offline

#5 2004-12-01 16:12:23

sarah31
Member
From: Middle of Canada
Registered: 2002-08-20
Posts: 2,975
Website

Re: Using sed in PKGBUILD

you could have grepped the abs directory for PKGBUILDs that used sed btw.

glad you found your answer though


AKA uknowme

I am not your friend

Offline

#6 2004-12-01 20:50:57

kleptophobiac
Member
From: Sunnyvale, CA
Registered: 2004-04-25
Posts: 488

Re: Using sed in PKGBUILD

sarah31 wrote:

you could have grepped the abs directory for PKGBUILDs that used sed btw.

glad you found your answer though

But I so rarely ever use grep or cat that I'm completely useless with them.

Offline

#7 2004-12-01 21:55:24

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,622
Website

Re: Using sed in PKGBUILD

grep -R "sed" /var/abs

Sit back and watch the scrolling joy!
In fact, you might want to redirect output to a file, or pipe it to less...


"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍

Offline

Board footer

Powered by FluxBB