[aur-general] postinstall script and local user directory

rafael ff1 rafael.f.f1 at gmail.com
Tue May 22 13:37:41 EDT 2012


2012/5/22 Jorge Barroso <jorge.barroso.11 at gmail.com>:
> 2012/5/22 rafael ff1 <rafael.f.f1 at gmail.com>
>
>>
>> >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.
>>
>
> Oh, ok, yeah I read a bit on the man page and o a webpage, but it's too
> large, it has so many functions. Eitherway, I understand what you said now.
> Then, on my PKGBUILD, I should modify the package()... in the next way?:
>
> package() {
> cd "${srcdir}"
>
> tar xf data.tar.gz
> mkdir -p "${pkgdir}/usr/"
> cp -r "${srcdir}/./usr/local/bin" "${pkgdir}/usr/bin"
> cp -r "${srcdir}/./usr/share" "${pkgdir}/usr/share"
>
> sed -e '325s#then#then\n\t[ ! -d ~/.LMD ] \&\& lmd -reconf#' -i
> "${pkgdir}"/usr/bin/lmd
>
> chmod +x "${pkgdir}/usr/bin"/*
> sed 's|usr/local|usr|' -i "${pkgdir}/usr/bin"/*
> sed 's|usr/local|usr|' -i "${pkgdir}/usr/share/applications/LMD.desktop"
> sed 's|usr/local|usr|' -i
> "${pkgdir}/usr/share/doc/linux-manga-downloader/copyright"
> sed 's|usr/local|usr|' -i "${pkgdir}/usr/share/icons/pen.png"
> sed 's|usr/local|usr|' -i "${pkgdir}/usr/share/lmd/langs/ca_ES"
> sed 's|usr/local|usr|' -i "${pkgdir}/usr/share/lmd/langs/es_ES"
> }

Looks good. Try to build the package and then verify if
pkg/usr/bin/lmd has the command added with sed. Case yes, then you're
good to go.

Rafael Ferreira


More information about the aur-general mailing list