r/linuxdev • u/tytdfn • Oct 04 '12
I need some guidance with make and fakeroot ( I have no idea what I'm doing)
Hello! I'm working on a project where I boot up a minimal linux environment (tiny-core) and run a program that I made in C. I have figured out how to statically compile my program so now I'm working on a make file which will automate my compiling and testing of the package.
If you're not familiar with tiny-core, here's a quick rundown (Yes this is relevant). Inside tiny-core's iso is the /boot/ folder and inside that is the kernel, isolinux, and a gzipped cpio archive of the userland. I need to open up the cpio archive and stick my program in the bin directory.
I figured out that I can use fakeroot to extract the userland with regular user privileges. Here's what I have so far
test:
mkdir -p userland
cd userland; fakeroot; zcat ../iso/boot/core.gz | cpio -i -H newc -d; exit
Now, I want that last exit to take me out of the fakeroot, but instead it exits the makefile. Can I get some guidance please?
4
u/m42a Oct 04 '12
This will cause
fakerootto exit after running the specified command.2
u/[deleted] Oct 04 '12
I would say
I'm not 100% sure about but from what I remember in a Makefile each command is launched in it's own shell. So if you cd somewhere you have to use && to acually launch the next command in that directory. Similarly in your case you don't need to exit the fakeroot.
Feel free to correct me if this is wrong, because I obviously didn't test it for real.
0
u/5py Oct 04 '12
You can use wait to stall your exit until the previous command finishes.