GentooThis forum is for the discussion of Gentoo Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: slackware, slackware from scratch, LFS, slackware [arm], linux Mint...
Posts: 1,564
Rep:
help concerning sed command:
Can someone help me undertand what is doing the following command, it's called for building xfsdump:
------------------
sed -i -e "s:enable_curses=[a-z]*:enable_curses=$(usex ncurses):" -e "s:libcurses="[^"]*":libcurses='$(use ncurses && $(tc-getPKG_CONFIG) --libs ncurses)':" configure || die
-------------------
The normal delimiters for search and replace are slashes, as in s/// but they can be any character as long as they are three of a kind. So here you have s::: instead.
Then you have double quotes so that means the shell is interpreting the contents before passing them on to sed. That brings you to the command substitution indicated by $( ... )
Then the logical OR operator || means that if sed fails, then die will be run. Maybe die is a function defined earlier in the script. I'm not sure at all under which conditions sed would fail.
It also looks like a pair of double quotes needed to be escaped:
Code:
sed -i \
-e "s:enable_curses=[a-z]*:enable_curses=$(usex ncurses):" \
-e "s:libcurses=\"[^"]*\":libcurses='$(use ncurses && $(tc-getPKG_CONFIG) --libs ncurses)':" \
configure \
|| die
sed is the command
-i inline editing, the processed file will be overwritten (see man page)
-e 'expression' a sed script to execute
-e 'expression' another one
configure looks like a filename here
that's all
both expressions are:
s substitute
: separator
search string
: separator
replacement
:
sed -i -e "s:enable_curses=[a-z]*:enable_curses=$(usex ncurses):" -e "s:libcurses="[^"]*":libcurses='$(use ncurses && $(tc-getPKG_CONFIG) --libs ncurses)':" configure || die
In the config file, where it finds "enable_curses=something" it replaces the "something" with the output from the "usex ncurses" command.
Where it finds "libcurses=something" it replaces the "something" with the output from the command string, "use ncurses && $(tc-getPKG_CONFIG) --libs ncurses", which presumably gives the installed version of the ncurses library.
Are you sure those functions are not defined somewhere above in the configure script, or perhaps in some file sourced by the configure script? If not, then that script was apparently intended for a build environment where those commands exist. Maybe there is a README file that tells what is required.
But I am not sure it is the intended effect, and I don't understand why it is needed as in Slackware the package is built OK without it. Where does that come from? And why post that in the Gentoo forum if you try it on Slackware?
Distribution: slackware, slackware from scratch, LFS, slackware [arm], linux Mint...
Posts: 1,564
Original Poster
Rep:
Well, I'm trying to solve the xfdsdump building in slackware-current (for Slackware From Scratch), and for the time being, I've not found a way to solve it.
So I pick ideas and patches in every distribution (gentoo, debian, fedora, archlinux...) to try to solve the problem.
Thanks for you answer, I'll try to see if it solves my problem.
Well, I'm trying to solve the xfdsdump building in slackware-current (for Slackware From Scratch), and for the time being, I've not found a way to solve it.
xfsdump builds fine on a regular Slackware 14.2 without any patch. That's all I know.
Quote:
So I pick ideas and patches in every distribution (gentoo, debian, fedora, archlinux...) to try to solve the
Applying blindly (not knowing what they do and why they are needed) patches at random out of context is a receipt for failure.
Good luck, though.
Last edited by Didier Spaier; 06-11-2017 at 01:59 AM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.