Linux From ScratchThis Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I know some folks here routinely build with scripts. I've used scripts occasionally and just for certain parts. But today I'm doing the whole rc1 thing with scripts. I just wondered how other people do that and how they create their scripts. For example, one huge script doesn't seem to be practical since it will stop when new shells are opened. I ended up with about five of them. And how do others create their build scripts? This time I printed the nochunks book to a text file and manually turned it into scripts by deleting everything that wasn't a command. I created pauses after tests and resumed if they were okay. And so on. It worked well and pretty quick since I could read it at the same time. The third one is running now. It would be nice though to have some killer sed command to fish out the commands from the html version using the tags. It is possible?
I thoroughly read the book and draft Bash scripts for batch works. Works very well and all I have to do is execute each script in sequence. Easy as pie.
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150
Rep:
I used to do a similar thing, one script for the tools, one for the basic system, one to create the filesystem and kernel, one for xorg etc, it does make correcting mistakes easier as you just correct the script and re-run it.
Yep, once you have all the bugs worked out, you can create a master batch script, execute it, walk away, and come back four hours later to a brand new OS.
"It would be nice though to have some killer sed command to fish out the commands from the html version using the tags. It is possible?"
Why don't you download the xml files from svn and use the included Makefile to create the commands? This will create dirs lfs-commands and lfs-html. You can then use the lfs-commands dir to build your scripts.
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150
Rep:
Quote:
Originally Posted by Johnburrell
...Why don't you download the xml files from svn and use the included Makefile to create the commands? This will create dirs lfs-commands and lfs-html. You can then use the lfs-commands dir to build your scripts.
Didn't know I could do that! Thanks for that tip it will make it LOTS easier to update my build scripts, Thanks.
This is the function in my script that gets the book
Quote:
CheckoutSVN () {
local bookdir=$1
local book_version=$2
#
Url="${SVN_URL}${type}/${book_version}"
Tag=$book_version
#
echo "Will svn the LFS book at $Url"
echo "and place it in ${bookdir}/${Tag}"
svn co $Url ${bookdir}/${Tag} # get the requested book
#
} # end CheckoutSVN
where:
SVN_URL="svn://svn.linuxfromscratch.org/LFS/"
type = trunk, branches or tags, depending on which book is requested.
As you can see, you specify which book in $Url and store it on you machine at ${bookdir}/${Tag}
Why don't you download the xml files from svn and use the included Makefile to create the commands? This will create dirs lfs-commands and lfs-html. You can then use the lfs-commands dir to build your scripts.
When I run make I didn't get the dir lfs-commands. Should one run a different command for that? I didn't find it in the README or install files.
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150
Rep:
Code:
make dump-commands
Always handy to look at the Makefile and see what bits can be made/installed, a lot of Makefiles have different targets to do different thing and not every thing is built with just 'make'.
# need to define these somewhere in your script
DumpedCommands=${LFS}/lfs-commands
Dumpedhtml=${LFS}/lfs-html
#
DumpCommands () {
# $1 is the Repository - LFS in this case
local bookdir=$2
local book_version=$3
if [ "$book_version" = systemd ]; then book_version="systemd/BOOK/"; fi
#
REPODIR=${bookdir}/${book_version}
target=$( echo $1 | awk '{print tolower($1)}')
SVNINFO="$(svn info $REPODIR | awk '{printf $0"|"}')"
SVNrevision=$( echo $SVNINFO | awk 'BEGIN{ RS = "|" };/Revision/ {print $0}' )
#
for dir in $DumpedCommands
do
if [ ! -d $dir ]; then
install -vd $dir
install -vd $Dumpedhtml
touch ${dir}/.revision
fi
done
#
for dir in $DumpedCommands
do
if [ -e "$dir" -a "$SVNrevision" != "$( cat $dir/.revision | awk '/Revision/ {print $0}')" ]; then
rm -rf $dir # remove these dirs if they exist but are not the latest revision
rm -rf $Dumpedhtml
install -d $dir
install -d $Dumpedhtml
pushd $REPODIR
make -j1 DUMPDIR=$DumpedCommands BASEDIR=$Dumpedhtml $target dump-commands
for dir in $DumpedCommands $Dumpedhtml
do
echo $SVNINFO | awk 'BEGIN{ RS = "|" }; {print $0}' > ${dir}/.revision
done
popd
break
fi
done
} # end of DumpCommands
I've never relied on a dumper to extract commands from the book for a good reason. There are extra commands in the book(s) meant for x86 PCs rather than x64 as well as sample commands as well, that don't often need to be ran on various systems.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.