LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This 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


Reply
  Search this Thread
Old 02-17-2014, 06:05 PM   #1
stoat
Member
 
Registered: May 2007
Distribution: LFS
Posts: 628

Rep: Reputation: 185Reputation: 185
Building LFS v7.5-rc1 via scripts


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?
 
Old 02-17-2014, 06:23 PM   #2
ReaperX7
LQ Guru
 
Registered: Jul 2011
Location: California
Distribution: Slackware64-15.0 Multilib
Posts: 6,558
Blog Entries: 15

Rep: Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097
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.
 
Old 02-18-2014, 04:02 PM   #3
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150

Rep: Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856
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.
 
Old 02-18-2014, 09:42 PM   #4
ReaperX7
LQ Guru
 
Registered: Jul 2011
Location: California
Distribution: Slackware64-15.0 Multilib
Posts: 6,558
Blog Entries: 15

Rep: Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097
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.
 
Old 02-19-2014, 01:03 PM   #5
Johnburrell
Member
 
Registered: May 2004
Distribution: FC3
Posts: 87

Rep: Reputation: 27
"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.

jb.
 
1 members found this post helpful.
Old 02-22-2014, 10:04 AM   #6
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150

Rep: Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856
Quote:
Originally Posted by Johnburrell View Post
...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.
 
Old 02-22-2014, 12:17 PM   #7
Johnburrell
Member
 
Registered: May 2004
Distribution: FC3
Posts: 87

Rep: Reputation: 27
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}

HTH

jb.
 
Old 02-23-2014, 12:53 AM   #8
Lennie
Member
 
Registered: Aug 2012
Location: Sweden
Distribution: LFS, built with pacman
Posts: 374

Rep: Reputation: 85
Quote:
Originally Posted by Johnburrell View Post
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.
 
Old 02-23-2014, 07:25 AM   #9
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150

Rep: Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856
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'.
 
1 members found this post helpful.
Old 02-23-2014, 05:48 PM   #10
Johnburrell
Member
 
Registered: May 2004
Distribution: FC3
Posts: 87

Rep: Reputation: 27
Here is how I make lfs-commands and lfs-html:

Quote:
# 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

jb.
 
Old 02-23-2014, 10:25 PM   #11
ReaperX7
LQ Guru
 
Registered: Jul 2011
Location: California
Distribution: Slackware64-15.0 Multilib
Posts: 6,558
Blog Entries: 15

Rep: Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LFS 7.4-rc1 is ready stoat Linux From Scratch 29 09-09-2013 09:49 PM
LFS 7.3-rc1 stoat Linux From Scratch 29 03-20-2013 02:08 PM
[SOLVED] Which version of book to use for BLFS??? (LFS-6.7 used for building LFS) rkmv Linux From Scratch 3 02-21-2012 05:32 PM
LFS-4.0-RC1 released lfslinux Linux From Scratch 1 09-29-2002 04:44 AM
LFS-3.2-RC1 released lfslinux Linux From Scratch 7 02-11-2002 08:13 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

All times are GMT -5. The time now is 05:10 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration