AUTHOR: Randy Blythe [rblythe] <rblythe714 at comcast dot net>

DATE: 2006-08-16

LICENSE: GNU Free Documentation License v 1.2

SYNOPSIS: Building BLFS from newly installed LFS system

PRIMARY URI: none

DESCRIPTION:
This hint is designed to detail a way to build your BLFS
system from within your newly created LFS system.  It is a help to
lessen and possibly eliminate typographical errors while building the
system.

This hint was used by me to build BLFS-SVN from within LFS-SVN.

ATTACHMENTS:
None

PREREQUISITES:
This hint requires that you have a working LFS or LFS-SVN build
completed and able to boot successfully.

You have already set up your (unpriviledged) user account

Working Internet connection (able to ping your ISP or favorite website
successfully)

Required packages (these should be downloaded BEFORE you start building
your new BLFS system):
* unhtml-2.3.8.tar.gz - http://linux.maruhn.com/sec/unhtml.html
  (also located in the debian repositories)

* BLFS{-SVN} bootscripts

* GPM (see BLFS{-SVN} for installation instructions)
  (this is vital for your build to go smoothly)

For BLFS (standard build) -
* BLFS book (HTML Format, multiple pages)
  (see download section at
  http://www.linuxfromscratch.org/blfs/download.html)

For BLFS-SVN
* blfs-book-cvs-html-*.tar.bz2 (see download section at
  http://www.linuxfromscratch.org/blfs/downloads/svn/)


Suggested Packages:
During non-X Window phase of the build - 

* Screen (see BLFS{-SVN} for installation instructions)
  
* Lynx or your favorite text web browser
  (see BLFS{-SVN} for installation instructions)
  
* Vi(m) installed during LFS{-SVN}, not linked to the X window


HINT:

* Boot into your newly installed LFS{-SVN} system

* unpack unhtml

* edit the Makefile (optional) - The make file puts everything
  (executable, man pages) in places that may not be consistent with your
  system.  Change it accordingly. I did not do this because I didn't
  realize this until after it was installed, but the install portion of the
  Makefile copies what is compiled to directories specified in the
  Makefile and changing those destinations should not affect the
  performance of the program.

* install unhtml (as root): make && make install

* install GPM-*, GPM bootscript, configure the mouse, and start the
  daemon, according to the BLFS{-SVN} instructions
 
* create a directory (i.e. $HOME/blfsbook) and unpack the BLFS book
  tar.bz2 into it

* create a directory (i.e. $HOME/blfsbook-text) to hold the text file
  versions of each BLFS html page

* copy and edit the script (see below) accordingly. chmod +x script and
  execute (this will make a text page for each BLFS html page)

Here's the beauty of this hint.  From here to the end of your system
installation, you can simply use vi(m) to read each one of your newly
created .txt files for each package of the complete BLFS{-SVN} install
and use your mouse to copy/paste build instructiona accordingly.  You
can also edit the instructions as necessary for your specific build
parameters (flags, optimizations, etc.) and check them before copy/paste
to lessen (if not eliminate) your typing errors.

* install Lynx or your favorite text based web browser according to the
  BLFS{-SVN} instructions.  This will be needed to access this hint
  online as well other BLFS instructions or other pages of interest.
  Also lynx can be used to save html pages in text format so you can use
  the copy/paste method to install programs outside of BLFS{-SVN}.

* install other Suggested packages as needed.

* use Lynx or your favorite text based web browser to download other
  programs and patches according to your needs.

* Enjoy your (possibly error free) build of BLFS{-SVN}!!!


copy this and edit according to your needs:

cat > $HOME/convert.sh << "EOF"
#!/bin/bash
# Begin convert.sh
# Created by rblythe <Randy Blythe> <rblythe714 at comcast dot net>
# Note:
# images and stylesheets directories ommitted because they
# do not have any HTML pages within them.

cd $HOME/blfsbook
for DIR in "appendices" "basicnet" "connect" "general" "gnome" \
           "introduction" "kde" "multimedia" "postlfs" \
           "preface" "pst" "server" "x" "xsoft"
do
        cd $DIR
            for i in $(ls *.html); do
                export v=$(echo $i | sed 's/.html/.txt/')
                # if you did not edit the Makefile then change this to
                # /usr/local/bin/unhtml $i > $HOME/blfsbook-text/$v
                /usr/bin/unhtml $i > $HOME/blfsbook-text/$v
            done
cd ..
done

# End of convert.sh
EOF


And make it executable: chmod +x $HOME/convert.sh


How I used the information in this hint:

I created three (3) screens (see man screen for details)
screen 0 was for my build.  screen 1 was for my txt files.  Screen 2 was
for lynx (in case I needed to get to the internet). I would open a file in
screen 1 and copy/paste the supplied build instructions to the command
line in screen 0 and the system did the rest. I did this until X was built 
and then I used multiple xterms instead of screen and repeated the process.
Screen 2 was used to download some of the optional dependencies as
needed (wanted).

It should be noted that some html files (and their txt equivalents) are not 
named after the package, i.e. the file known as printing.html (which
will be converted to printing.txt if using the above script) is actually
the page for CUPS. 

unhtml can also be used from the command line for other html files that
you want to convert to txt by simply issuing:
unhtml nameoffile.html > anynameyouwant.txt
Also see man unhtml for more details.

The only drawback to this method is the large amounts of whitespace that
are created in the converted text file.  I am not sure why that happens,
but you files will have whitespace.


ACKNOWLEDGEMENTS:

Everyone on the LFS/BLFS mailing list(s) who encouraged me to do a
little research and try to find the answers myself before performing
"fishing expeditions" on the list(s). :)

Kevin Swan <013639s at dragon dot acadiau at ca> for creating unhtml


CHANGELOG:
[2006-08-16]
  * Initial hint
