LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
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 07-18-2005, 01:20 PM   #1
AxXium
Zenwalk Admin
 
Registered: May 2005
Location: Louisiana, U.S.A.
Distribution: Zenwalk Gnu/Linux
Posts: 258

Rep: Reputation: 31
Please check this script for error


This script is a rip off of instructions from the LFS 6.1 book btw, I dare not take credit.

Is this script do-able to install binutils pass-1?



Code:
#!/bin/sh
#
# Check the LFS environment variable.

echo $LFS

# Install Binutils-2.15.94.0.2.2 - Pass 1

cd $LFS/sources

tar xvjf binutils-2.15.94.0.2.2.tar.bz2

cd $LFS/sources/binutils-2.15.94.0.2.2

mkdir ../binutils-build

cd ../binutils-build

../binutils-2.15.94.0.2.2/configure --prefix=/tools --disable-nls

make

make install

make -C ld clean

make -C ld LIB_PATH=/tools/lib
Or will it only work as such

Code:
cd $LFS/sources && tar xvjf binutils-2.15.94.0.2.2.tar.bz2 && cd $LFS/sources/binutils-2.15.94.0.2.2 && mkdir ../binutils-build && cd ../binutils-build && ../binutils-2.15.94.0.2.2/configure --prefix=/tools --disable-nls && make && make install && make -C ld clean && make -C ld LIB_PATH=/tools/lib
What ya think?
 
Old 07-18-2005, 02:06 PM   #2
ParticleHunter
Member
 
Registered: Apr 2004
Location: Malaga, Spain
Distribution: LFS
Posts: 129

Rep: Reputation: 15
Hi,

it looks OK, at least at first-sight, as my base system is completed, I'm not in the situation of being able to test it, but... it seems to be good, wheter you create the script or you concatenate the commmands with the '&&' operator, althought there's something 'redundant' for me in the 'script' version...

why do you perform 'cd $LFS/sources/binutils-2.15.94.0.2.2' after unpacking the tarball? if the script is OK, after 'cd $LFS/sources' you're efectively in the sources directory, so a simple 'cd binutils-2.15.94.0.2.2' will do the trick

Julio

Last edited by ParticleHunter; 07-18-2005 at 02:09 PM.
 
Old 07-18-2005, 02:07 PM   #3
zonk
Newbie
 
Registered: Jul 2005
Posts: 7

Rep: Reputation: 0
both versions will work.

but in the first version, you might want to set $LFS rather than just echo it. that way you can be sure it'll be what you need it to be. if $LFS is set to "hahahaiamusingtehintarwebz", it'll just echo that and then proceed installing with that not exactly sane value.
 
Old 07-18-2005, 02:16 PM   #4
AxXium
Zenwalk Admin
 
Registered: May 2005
Location: Louisiana, U.S.A.
Distribution: Zenwalk Gnu/Linux
Posts: 258

Original Poster
Rep: Reputation: 31
Great

When would it matter if I began the script with

#!/bin/sh

or

#!/bin/bash

or would it ever?

My understanding is that the system is blind to anything behind a #

I really appreciate your help!

Did you guys run into trouble when you created the symlinks in chapter 6.6 for

6.6. Creating Essential Symlinks

Some programs use hard-wired paths to programs which do not exist yet.
In order to satisfy these programs, create a number of symbolic links
which will be replaced by real files throughout the course of this
chapter after the software has been installed.
ln -s /tools/bin/{bash,cat,pwd,stty} /bin
ln -s /tools/bin/perl /usr/bin
ln -s /tools/lib/libgcc_s.so{,.1} /usr/lib
ln -s bash /bin/sh

my [ sh ] couldn't be found when I tried to install

6.10.1. Installation of Man-pages

Install Man-pages by running:
make install


To fix it I had to

rm -r /bin/sh

ln -s /tools/bin/bash /bin/sh

The book wasn't too clear to me when I read it.

Are we supposed have [ sh ] pointing to /tools/bash or /bin/bash in which case /bin/bash is a symlink to /tools/bash

Does it matter
 
Old 07-18-2005, 02:34 PM   #5
ParticleHunter
Member
 
Registered: Apr 2004
Location: Malaga, Spain
Distribution: LFS
Posts: 129

Rep: Reputation: 15
Hi,

/bin/sh and /bin/bash are the same in the sense that sh is supposed to be a symlink for bash, so as long as the /etc/shells file is present in your host distribution you must not have any problem with that, as the /etc/shells file contains the following (extracted from the BLFS book (SVN):


cat > /etc/shells << "EOF"
# Begin /etc/shells

/bin/sh
/bin/bash

# End /etc/shells
EOF


so if this file is present, it's not relevant wheter you use !/bin/sh or /bin/bash in your script

I didn't had any problem with that part of the book, in fact, as I compiled my system from a terminal window in GNOME having another window with Firefox and the LFS book, I just had to copy-and-paste over the terminal

I think the ln -s /tools/bin/bash /bin/sh command is executed because in that step of the book, you still haven't installed the final bash, but you're using your build-tools' bash to do the trick... as stated before, I didn't had any problem with this

Julio
 
Old 07-18-2005, 03:40 PM   #6
zonk
Newbie
 
Registered: Jul 2005
Posts: 7

Rep: Reputation: 0
and just to add: the #! is called shebang. in the very first line of a script, you can specify the interpreter of the script. thus, # always represents a comment line (does not get executed). but if on the first line the # is followed by a !, it signifies the interpreter. what really happens is not that each line of the script gets executed by the shell you are in when you call the script, rather the interpreter on the first line is called (a new shell is started) than then executes the script. if you had php installed, say, this would be perfectly good for a script:

#!/usr/bin/php
<?php
phpinfo();
?>

that would start an instance of php that would then execute the rest of the code.
 
  


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
Help me check the iptables script vhh Linux - Security 10 01-28-2005 09:56 PM
Can someone check my Iptables script fotoguy Linux - Security 2 01-25-2005 12:32 AM
Script check Echo Kilo Programming 4 12-13-2004 03:55 AM
Script check Echo Kilo Programming 1 12-12-2004 12:55 PM
Ip check script, help me? wiggywag Programming 3 01-13-2004 01:58 AM


All times are GMT -5. The time now is 07:23 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration