How to script automate unTAR of packages
zarniwhoop73 at googlemail.com
Mon Dec 28 12:29:20 PST 2009
2009/12/28 Mikie <kmb at mikienet.com>:
> Hello list,
> I have made a script file at:
> ... to unTAR my packages so I don't have to do it manually.
> When I run it I get:
> tar: /mnt/lfs/sources/zlib-1.2.3.tar.bz2\r: Cannot open: No such file or
> tar: Error is not recoverable: exiting now
> tar: Child returned status 2
> tar: Exiting with failure status due to previous errors
> etc ..... for each package.
> What am I doing wrong?
No idea, but maybe the tarballs are not where you think they are.
Try instrumenting it (e.g. in this case echo $PWD, ls -l /mnt/lfs/sources
... ) to gather information which will help you identify what you are
doing wrong - we all make errors in scripting, the important thing is
to learn from them, and to try not to repeat them unnecessarily.
I also suggest that in general it is better to stop after an error.
I have difficulty understanding *why* you want to do this mass extraction.
The general process is:
untar the next package
cd to the directory
run the commands to configure, build and install this package
remove the source and any -build directory.
NB occasionally a package or documentation might be untarred
into another package's directory (things like gmp and mpfr).
Of these steps, untarring a package is generally trivial and can be
easily added to a more useful script (AFAIK, all the packages in
LFS itself are nicely packaged in directories, but that is not
When building LFS on an empty filesystem, you can probably
afford not to care about having all the source code taking up
space, but if you move on to use the new system you will be
unnecessarily taking up space (and that might make your
More seriously, whenever you rebuild a package (either
because you built it in chapter 5 and are now in chapter 6, or
because a build failed) you should use freshly-extracted
The interesting question comes when you move on and
one day discover that the directory name you need to cd into
is not necessarily the same as the versioned tarball name.
After tragedy, and farce, "OMG poneys!"
More information about the lfs-support