Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 08-15-2012, 01:34 PM   #1
Registered: Jan 2011
Posts: 263

Rep: Reputation: 5
a short shell script

I'M trying to build an LFS system from the linux from scratch project. I'M stuck on the following page:

I've got the commands placed into a script so I can check to see what went wrong and where fore I get to far ahead and figure out I massed up 30 steps back. Each script is set to create a file by date > ../FLAG then echo GOOD so I know everything went okay. But I've hit a dead end because I'M not getting the FLAG file or seeing GOOD upon completion of the script running and I can't find the problem.

DL=$(readelf -l /bin/sh | sed -n 's@.*interpret.*/tools\(.*\)]$@\1@p') &&
sed -i "s|libs -o|libs -L/usr/lib -Wl,-dynamic-linker=$DL -o|" \
scripts/ &&
unset DL &&
sed -i -e 's/"db1"/& \&\& $name ne "nss_test1"/' scripts/ &&
sed -i 's|@BASH@|/bin/bash|' elf/ &&
( patch -Np1 -i ../../../glibc-2.14.1-fixes-1.patch 2>&1 | tee patch-one.log && exit $PIPESTATUS ) &&
( patch -Np1 -i ../../../glibc-2.14.1-sort-1.patch 2>&1 | tee patch-two.log && exit $PIPESTATUS ) &&
( patch -Np1 -i ../../../glibc-2.14.1-gcc_fix-1.patch 2>&1 | tee patch-tree.log && exit $PIPESTATUS ) &&
nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timed{rd,wr}lock.S &&
mkdir -v ../glibc-build &&
cd ../glibc-build &&
case `uname -m` in
i?86) echo "CFLAGS += -march=i486 -mtune=native -O3 -pipe" > configparms ;;
esac &&
( ../glibc-2.14.1/configure --prefix=/usr \
--disable-profile --enable-add-ons \
--enable-kernel=2.6.25 --libexecdir=/usr/lib/glibc 2>&1 | tee configure-glibc.log && exit $PIPESTATUS ) &&
( make 2>&1 | tee make-glibc.log && exit $PIPESTATUS ) &&
cp -v ../glibc-2.14.1/iconvdata/gconv-modules iconvdata &&
make -k check 2>&1 | tee glibc-check-log &&
grep Error glibc-check-log &&
touch /etc/ &&
( make install 2>&1 | tee make-install.log && exit $PIPESTATUS ) &&
cp -v ../glibc-2.14.1/sunrpc/rpc/*.h /usr/include/rpc &&
cp -v ../glibc-2.14.1/sunrpc/rpcsvc/*.h /usr/include/rpcsvc &&
cp -v ../glibc-2.14.1/nis/rpcsvc/*.h /usr/include/rpcsvc &&
mkdir -pv /usr/lib/locale &&
localedef -i cs_CZ -f UTF-8 cs_CZ.UTF-8 &&
localedef -i de_DE -f ISO-8859-1 de_DE &&
localedef -i de_DE@euro -f ISO-8859-15 de_DE@euro &&
localedef -i de_DE -f UTF-8 de_DE.UTF-8 &&
localedef -i en_HK -f ISO-8859-1 en_HK &&
localedef -i en_PH -f ISO-8859-1 en_PH &&
localedef -i en_US -f ISO-8859-1 en_US &&
localedef -i en_US -f UTF-8 en_US.UTF-8 &&
localedef -i es_MX -f ISO-8859-1 es_MX &&
localedef -i fa_IR -f UTF-8 fa_IR &&
localedef -i fr_FR -f ISO-8859-1 fr_FR &&
localedef -i fr_FR@euro -f ISO-8859-15 fr_FR@euro &&
localedef -i fr_FR -f UTF-8 fr_FR.UTF-8 &&
localedef -i it_IT -f ISO-8859-1 it_IT &&
localedef -i ja_JP -f EUC-JP ja_JP &&
localedef -i tr_TR -f UTF-8 tr_TR.UTF-8 &&
localedef -i zh_CN -f GB18030 zh_CN.GB18030 &&
( make localedata/install-locales 2>&1 | tee make-localdata.log && exit $PIPESTATUS ) &&
cat > /etc/nsswitch.conf << "EOF"
# Begin /etc/nsswitch.conf
passwd: files
group: files
shadow: files
hosts: files dns
networks: files
protocols: files
services: files
ethers: files
rpc: files
# End /etc/nsswitch.conf
EOF &&
tzselect &&
cp -v --remove-destination /usr/share/zoneinfo/Eastern \
/etc/localtime &&
cat > /etc/ << "EOF"
# Begin /etc/
EOF &&
cat >> /etc/ << "EOF"
# Add an include directory
include /etc/*.conf
EOF &&
mkdir /etc/ &&
date > ../FLAG &&
echo GOOD
Old 08-15-2012, 05:01 PM   #2
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Well ... first: can we please get you to use the CODE tags in the future?

And then ... what is the last file generated by the script? Since they're
all tied together with && it could have failed at the first step.

If all else fails insert meaningful echo statements after each && , e.g.,
DL=$(readelf -l /bin/sh | sed -n 's@.*interpret.*/tools\(.*\)]$@\1@p') &&
sed -i "s|libs -o|libs -L/usr/lib -Wl,-dynamic-linker=$DL -o|" \
scripts/ &&
echo  "After"
unset DL &&
to find out where it fails ...
Old 08-16-2012, 07:10 AM   #3
Registered: Jan 2011
Posts: 263

Original Poster
Rep: Reputation: 5
I don't understand a lot of what I'M doing here, I'M just following the steps at, so I couldn't really comment it anyway. But I did give the link to where I got the instructions.


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
How to pass command line arguments from one shell script to another shell script VijayaRaghavanLakshman Linux - Newbie 5 01-20-2012 09:12 PM
Executing a Shell script with 654 permissions inside another shell script. changusee2k Linux - Newbie 2 06-07-2011 07:58 PM
[SOLVED] a short shell script related to PIDs gujedan Programming 3 11-22-2010 04:54 AM
shell short question(stdout, stderr) blackzone Programming 4 11-11-2004 09:01 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:57 PM.

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