Op Sun, 01 Jan 2012 10:03:05 +0100 schreef <[email protected]>:
I know there is ALFS and JALFS or whatever and I might refer and or use
those but for me, I personally
like the book layout, so I'm making scripts for each CHUNK along the
way.
HAPPY NEW YEAR FOLKS!
--Jason P Sage
Have you read the Hint "More Control and Package Management using Package
Users (v1.2)"
(www.linuxfromscratch.org/hints/read.html).? Also look into the enclosed
script; somebody send it to me,
but I don't remember who. There was also a discussion about this topic
last year or the year before
on this support-site.
Hans.
# Begin Build for <PACKAGE>
# The basis for this script, and actually the meat of it, came from
# Matthias Benkman's "More Control and Package Users" package management
# system. The "hint" for this is found at the Linux From Scratch "Hints"
# web page.
# This version came from a CLFS build, by Dan McGhee in September of
# using "CLFS-SVN-<snapshot date>-x86_64-Multilib" book. I owe a large
# debt of gratitude to Ken Moffat, a LFS developer, from whom I took
# a large portion of the "start_commands."
# Run this script from the packag users home directory by invoking it with
# the package name--ex. vim-7.2. It will find the tarball in $PACKAGES,
# untar it, change to the created directory and "configure, make install."
# Then it will "clean up" by creating a list of the installed files and
# remove the source tree.
# NOTE: There are sections in this script that must be "uncommented to
# accomplish various things: 32 bit builds, 64 bit builds and
# running a test suite. Scroll through and you will find them.
# It will create 6 log files in the $HOME directory:
# configure.log: All messages output during configure
# configure.err: Just the errors output during configure
# make.log: All messages output during make
# make.err: Just the errors output during make
# install.log: All messages output during make install
# install.err: Just the errors output during make install
# variables
package=$@
logdir=$package-32bit-logs
PACKAGES=/sources
CURRENT=$package
# Begin function definitions
start_commands () {
# Make a log directory
mkdir -v $logdir
# determine type of tar, and name of its directory
# enter with current set to version name
# returns with current set with tar/type,
# directory set, and tarcmd set
if [ -r ${PACKAGES}/${CURRENT}.tar.bz2 ]; then
CURRENT=${CURRENT}.tar.bz2
TARCMD='-j'
elif [ -r ${PACKAGES}/${CURRENT}.tar.gz ]; then
CURRENT=${CURRENT}.tar.gz
TARCMD='-z'
elif [ -r ${PACKAGES}/${CURRENT}.tgz ]; then
CURRENT=${CURRENT}.tgz
TARCMD='-z'
elif [ -r ${PACKAGES}/${CURRENT}.tar ]; then
CURRENT=${CURRENT}.tar
TARCMD=
elif [ -r ${PACKAGES}/${CURRENT}.tbz2 ]; then
CURRENT=${CURRENT}.tbz2
TARCMD='-j'
elif [ -r ${PACKAGES}/${CURRENT}.tar.xz ]; then
CURRENT=${CURRENT}.tar.xz
TARCMD='-J'
else
echo "identify: unable to identify tar for $CURRENT"
exit 1
fi
echo "testing ${CURRENT}"
# /dev/null may not exist at start of ch6
# changed to test for character special file instead of file
#if [ -c /dev/null ]; then
# NUL='2>/dev/null'
#fi
# util-linux uses ./ at start of directory names
#DIRECTORY=`tar -tv $TARCMD -f ${PACKAGES}/${CURRENT} $NUL | head -n 1
| awk '{ print $6}' | sed s'@^./@@' | \
# making NUL defined causes tar to try to look for 2>/dev/null in the
tarball.
DIRECTORY=`tar -tv $TARCMD -f ${PACKAGES}/${CURRENT} | head -n 1 | awk
'{ print $6}' | sed s'@^./@@' | \
cut -d '/' -f 1`
if [ -z $DIRECTORY ]; then
echo "indentify: error in trying to determine directory name"
exit 1
fi
echo "identify: directory is $DIRECTORY"
# Untar
echo "Untarring $CURRENT"
tar -x $TARCMD -f $PACKAGES/$CURRENT
echo "Entering source tree"
cd $DIRECTORY
packagedir=$DIRECTORY
echo $packagedir
}
configure_commands()
{ :
CC="gcc ${BUILD32}" ./configure --prefix=/usr
}
make_commands()
{ :
make
}
install_commands()
{ :
make install
}
test_pipe()
{
for i in "${PIPESTATUS[@]}"
do
test $i != 0 && { echo FAILED! ; exit 1 ; }
done
echo successful!
return 0
}
# End Functions
# Begin tests and function calls for fresh and failed builds.
# This one recovers from failed "make."
if [ -e $logdir/make-`echo $package`.err ] && \
[ ! -e $logdir/install-`echo $package`.err ]; then #Now build
cd $HOME/$packagedir
echo -n Building `echo $package`...
{ make_commands 3>&1 1>&2 2>&3 | tee "$Home/$logdir/make-`echo
$package`.err" ;} &>"$HOME/$logdir/make-`echo $package`.log"
test_pipe && echo -n Installing `echo $package`... #Now build
cd $packagedir
{ install_commands 3>&1 1>&2 2>&3 | tee "$HOME/$logdir/install-`echo
$package`.err" ;} &>"$HOME/$logdir/install-`echo $package`.log"
test_pipe
cd $HOME
echo Cleaning up by removing the source tree
rm -rf $packagedir
list_package $(whoami) > `echo $package`-files.list
echo "Congratulations!!! You're finally done with $package"
fi
# This one recovers from a failed install
if [ -e $logdir/make-`echo $package`.log ] && \
[ ! -e $HOME/$package-files.list ]; then
cd $HOME/`echo $package`/
echo -n Installing `echo $package`...
{ install_commands 3>&1 1>&2 2>&3 | tee "$HOME/$logdir/install-`echo
$package`.err" ;} &>"$HOME/$logdir/install-`echo $package`.log"
test_pipe
cd $HOME
echo Cleaning up by removing the source tree
rm -rf `echo $package`
list_package $(whoami) > `echo $package`-files.list
echo "Congratulations!! You're finally done with ${package}"
fi
# This one does everything through configure, make, make install
if [ ! -e $logdir ]; then
start_commands
echo -n Configuring `echo $package`...
{ configure_commands 3>&1 1>&2 2>&3 | tee
"$HOME/$logdir/configure-`echo $package`.err" ;}
&>"$HOME/$logdir/configure-`echo $package`.log"
test_pipe
pwd
echo -n Building `echo $package`...
{ make_commands 3>&1 1>&2 2>&3 | tee "$HOME/$logdir/make-`echo
$package`.err" ;} &>"$HOME/$logdir/make-`echo $package`.log"
test_pipe
# If you want to run the test suite, uncomment the following
# echo Testing...$package
# ( make -k check 2>&1 | tee $HOME/`echo $package`-32bit-tests.log ; \
# exit $PIPESTATUS )
echo -n Installing `echo $package`...
{ install_commands 3>&1 1>&2 2>&3 | tee "$HOME/$logdir/install-`echo
$package`.err" ;} &>"$HOME/$logdir/install-`echo $package`.log"
test_pipe
cd $HOME
echo Cleaning up by removing the source tree
rm -rf $packagedir
list_package $(whoami) > `echo $package`-files.list
echo Congratulations you are done with $package!!!!
fi
# NOTE: Simply using && instead of test_pipe would not work, because &&
# only tests the exit status of the last command in the pipe, which is tee.
# End Build
--
http://linuxfromscratch.org/mailman/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/lfs/faq.html
Unsubscribe: See the above information page