[aur-general] postinstall script and local user directory
rafael.f.f1 at gmail.com
Tue May 22 11:56:13 EDT 2012
2012/5/22 Jorge Barroso <jorge.barroso.11 at gmail.com>:
> 2012/5/22 rafael ff1 <rafael.f.f1 at gmail.com>
>> > sed -e '325s#then#then\n\t[ ! -d ~/.LMD ] \&\& lmd -reconf#' -i
> Mmm yes it helps, I know what you mean, adding a line on the own lmd binary
> script that checks if .LMD already exists... any time you run lmd an for
> any user ;) Not bad :D but... if fear I don't know so sed "command", so I
> can't comprehend where are you exactly telling me that I should put that
> or... well :S sorry, could you explain it a little more :S
> My bigest thanks friend
If you're not comfortable with sed, you can always create a patch
using 'diff -u foo1 bar2 > foo-bar.patch' and add to source=() ... But
since we are here:
My sed command executes an expression in an input text. The input text
is from the file 'lmd'. I also added the flag '-i' so the output of
this command will not go to stdout, but directly to the input file.
So, it will not just read the file, but alter/write too.
The expression structure is basically 'A#B#C#', where #s are
delimiters; A is a specific line number that sed will look and
replace; B is the regexp to look (and to be replaced) in that line in
A; and C is the replacement regexp that I want to replace B. Please
note that '\n' is a newline character and '\t' is a tab character.
So, as I mentioned before, I replaced the string 'then' in line 325
with the new line/command you provided.
'sed' can do much more than that. Man page and google can help a lot.
More information about the aur-general