LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   a short shell script (https://www.linuxquestions.org/questions/programming-9/a-short-shell-script-4175422234/)

Garrett85 08-15-2012 01:34 PM

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:
http://www.linuxfromscratch.org/lfs/...r06/glibc.html

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/test-installation.pl &&
unset DL &&
sed -i -e 's/"db1"/& \&\& $name ne "nss_test1"/' scripts/test-installation.pl &&
sed -i 's|@BASH@|/bin/bash|' elf/ldd.bash.in &&
( 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 ) &&
sed -i '195,213 s/PRIVATE_FUTEX/FUTEX_CLOCK_REALTIME/' \
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/ld.so.conf &&
( 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/ld.so.conf << "EOF"
# Begin /etc/ld.so.conf
/usr/local/lib
/opt/lib
EOF &&
cat >> /etc/ld.so.conf << "EOF"
# Add an include directory
include /etc/ld.so.conf.d/*.conf
EOF &&
mkdir /etc/ld.so.conf.d &&
date > ../FLAG &&
echo GOOD

Tinkster 08-15-2012 05:01 PM

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.,
Code:

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/test-installation.pl &&
echo  "After test-installation.pl"
unset DL &&

to find out where it fails ...

Garrett85 08-16-2012 07:10 AM

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


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