Hi,
I have checked the lfs-support mailing list,
'http://www.linuxfromscratch.org/hints/read.html' (which reports '[an
error occurred while processing this directive]'), and searched the
hints wiki for 'package management' (which reports no results), which
have not answered my questions, so I am trying here - feel free to
educate me if this is not the appropriate place for this...
I have chosen to try to implement 'Symlink Style' package management,
but wanted to check my understanding before going any further with my
build.
My process (for Chapter 6.11. Zlib-1.2.7 onwards):
1 - untar the package source into /sources
2 - enter the extracted <pkg_name-pkg_number> directory
3 - follow the configure, make, etc instructions for the package,
*except for* make install.
4 - run make DESTRDIR=/usr/pkg/<pkg_name>/<pkg_number> <other options,
if given in LFS> install
5 - change working directory to /usr/pkg/<pkg_name>/<pkg_number>
6 - apply any post install instructions with
'/usr/pkg/<pkg_name>/<pkg_number>' as the 'root' location (although
relative symlink source values should remain unchanged) **
7 - soft-link to all the files in '/usr/pkg/<pkg_name>/<pkg_number>'
from the actual root tree, for which I have written a script ***
8 - remove the source and build directories (if any) from '/sources'.
9 - repeat for next package
I have three main questions:
1 - Have I understood the process correctly?
2 - Will this method, including the script, work as expected?
3 - Is it actually necessary to soft-link to *every* file in
'/usr/pkg/<pkg_name>/<pkg_number>' from the root tree, or is that
overkill?
Any help would be much appreciated (even if it's 'don't ask here, ask
http://here'),
Steve
** e.g. from Chapter 6.11:
- Original:
mv -v /usr/lib/libz.so.* /lib
ln -sfv ../../lib/libz.so.1.2.7 /usr/lib/libz.so
- With with package management system:
cp /usr/pkg/zlib/1.2.7/
mv -v ./usr/lib/libz.so.* ./lib
ln -sfv ../../lib/libz.so.1.2.7 ./usr/lib/libz.so
*** My script (could be more flexible, but it does the job as far as I
understand the job):
+++++ start of script +++++
#!/bin/sh
# Create a soft-link from the root-tree equivalent of the files in the
calling directory
# an its children to the absolute locations of these files.
# Find each file in this directory and all subdirectories.
find . | while read path; # Assign each relative ./path/of/dirs or
./path/and/filename to $path
do
if test -d "$path" # If $path is a directory then create it in root tree
then
# Extract the root tree equivalent of the relative path: /path/of/dirs
rootpath="${path#*.}" # Remove leading '.'
# Create the target directories in the root tree, if not already present.
echo "mkdir -p $rootpath"
mkdir -p $rootpath
fi
if test -f "$path" # If $path is a filename create a symlink
then
# Determine the absolute path: /abs/path/and/filename
abspath="$(readlink -f $path)"
# Extract the root tree equivalent of the relative path: /path/and/
tmp_rootpath="$(dirname $path)" # Extract ./path/and
rootpath="${tmp_rootpath#*.}/" # Remove leading '.', add trailing '/'
# Create the soft-link from the root tree to the actual package
echo "ln -sfv $abspath $rootpath"
ln -sfv $abspath $rootpath
fi
done
+++++ end of script +++++