-Fixed bug when moving "mv" command from /usr/bin to /bin
[hvlinux.git] / stage2 / cis-ncurses
index 3b7e884..54e594b 100755 (executable)
@@ -1,4 +1,6 @@
 #!/bin/sh
+set -o errexit
+
 # First argument of this script is the package name
 
 # Reading system configuration informations, functions and package versions.
@@ -7,44 +9,42 @@ source ../functions
 source ../packages-list
 
 # Applying patches (if any)
-apply_patches ${1} &&
+apply_patches ${1}
 
-cd ${LFS_TMP}/${1}-build &&
+cd ${LFS_TMP}/${1}-build
 ../${1}/configure \
     --prefix=/usr \
     --with-shared \
     --without-debug \
-    --enable-widec &&
-make -j ${MAKEJOBS} &&
-make install &&
-
-# Fix a library that shouldn't be executable.
-chmod -v 644 /usr/lib/libncurses++w.a &&
+    --enable-widec
+make -j ${MAKEJOBS}
+make install
 
-# To be FHS compliant...
-mv -fv /usr/lib/libncursesw.so.5* /lib &&
+# Move the libraries to the /lib  directory, where they are expected to reside:
+mv -fv /usr/lib/libncursesw.so.5* /lib
 
-# Fixing some symlinks after the move
-ln -sfv ../../lib/libncursesw.so.5 /usr/lib/libncursesw.so &&
+# Because the libraries have been moved, one symlink points to a non-existent file:
+ln -sfvT ../../lib/libncursesw.so.5 /usr/lib/libncursesw.so
 
 # Many applications still expect the linker to be able to find
 # non-wide-character Ncurses libraries. Trick such applications
 # into linking with wide-character libraries by means of symlinks
 # and linker scripts:
-for lib in curses ncurses form panel menu ; do
+for lib in ncurses form panel menu ; do
     rm -vf /usr/lib/lib${lib}.so
     echo "INPUT(-l${lib}w)" >/usr/lib/lib${lib}.so
-    ln -sfv lib${lib}w.a /usr/lib/lib${lib}.a
+    ln -sfvT lib${lib}w.a /usr/lib/lib${lib}.a
 done
-ln -sfv libncurses++w.a /usr/lib/libncurses++.a &&
+ln -sfvT libncurses++w.a /usr/lib/libncurses++.a
 
 # Finally, make sure that old applications that look for
 # -lcurses at build time are still buildable:
-rm -vf /usr/lib/libcursesw.so &&
-echo "INPUT(-lncursesw)" >/usr/lib/libcursesw.so &&
-ln -sfv libncurses.so /usr/lib/libcurses.so &&
-ln -sfv libncursesw.a /usr/lib/libcursesw.a &&
+rm -vf /usr/lib/libcursesw.so
+echo "INPUT(-lncursesw)" >/usr/lib/libcursesw.so
+ln -sfv libncurses.so /usr/lib/libcurses.so
+ln -sfv libncursesw.a /usr/lib/libcursesw.a
 ln -sfv libncurses.a /usr/lib/libcurses.a
 
-# Return last error
+ldconfig
+
 exit $?