#!/bin/sh #2.2 dd if=/dev/zero of=lfs.image bs=1M count=6K #2.3 mke2fs lfs.image #2.4 mount -o loop lfs.image /mnt/ #3.1 mkdir /mnt/sources chmod a+wt /mnt/sources/ #3.2 cd /mnt/sources cat > getmd5 < ~/.bash_profile << "EOF" exec env -i HOME=$HOME TERM=$TERM PS1='\u:\w\$ ' /bin/bash EOF cat > ~/.bashrc << "EOF" set +h umask 022 LFS=/mnt/ LC_ALL=POSIX PATH=/tools/bin:/bin:/usr/bin export LFS LC_ALL PATH EOF source ~/.bash_profile #5.3 cd /mnt/sources/ tar -xjf binutils-2.16.1.tar.bz2 cd binutils-2.16.1 mkdir ../binutils-build cd ../binutils-build (../binutils-2.16.1/configure --prefix=/tools --disable-nls) 2>&1 | tee -a ../binutils1.out (make && make install) 2>&1 | tee -a ../binutils1.out (make -C ld clean && make -C ld LIB_PATH=/tools/lib) 2>&1 | tee -a ../binutils1.out cp ld/ld-new /tools/bin cd .. grep binutils1.out -ie '^make.*error' || (rm -rf binutils-2.16.1 && rm -rf binutils-build/) #5.4 tar -xjf gcc-4.0.3.tar.bz2 cd gcc-4.0.3 mkdir ../gcc-build cd ../gcc-build (../gcc-4.0.3/configure --prefix=/tools --with-local-prefix=/tools --disable-nls --enable-shared --enable-languages=c) 2>&1 | tee -a ../gcc1.out (make bootstrap && make install) 2>&1 | tee -a ../gcc1.out ln -s gcc /tools/bin/cc cd .. grep gcc1.out -ie '^make.*error' rm -rf gcc-4.0.3 rm -rf gcc-build/ #5.5 tar -xjf linux-libc-headers-2.6.12.0.tar.bz2 cd linux-libc-headers-2.6.12.0 cp -R include/asm-i386 /tools/include/asm cp -R include/linux /tools/include cd .. rm -rf linux-libc-headers-2.6.12.0 #5.6 tar -xjf glibc-2.3.6.tar.bz2 cd glibc-2.3.6 mkdir ../glibc-build cd ../glibc-build (../glibc-2.3.6/configure --prefix=/tools --disable-profile --enable-add-ons --enable-kernel=2.6.0 --with-binutils=/tools/bin --without-gd --with-headers=/tools/include --without-selinux) 2>&1 | tee -a ../glibc.out (make) 2>&1 | tee -a ../glibc.out mkdir /tools/etc touch /tools/etc/ld.so.conf (make install) 2>&1 | tee -a ../glibc.out cd .. grep glibc.out -ie '^make.*error' rm -rf glibc-2.3.6 rm -rf glibc-build/ #5.7 mv /tools/bin/{ld,ld-old} mv /tools/$(gcc -dumpmachine)/bin/{ld,ld-old} mv /tools/bin/{ld-new,ld} ln -s /tools/bin/ld /tools/$(gcc -dumpmachine)/bin/ld SPECFILE=`dirname $(gcc -print-libgcc-file-name)`/specs && gcc -dumpspecs > $SPECFILE && sed 's@^/lib/ld-linux.so.2@/tools&@g' $SPECFILE > tempspecfile && mv -f tempspecfile $SPECFILE && unset SPECFILE GCC_INCLUDEDIR=`dirname $(gcc -print-libgcc-file-name)`/include && find ${GCC_INCLUDEDIR}/* -maxdepth 0 -xtype d -exec rm -rf '{}' \; && rm -f `grep -l "DO NOT EDIT THIS FILE" ${GCC_INCLUDEDIR}/*` && unset GCC_INCLUDEDIR echo 'main(){}' > dummy.c cc dummy.c readelf -l a.out | grep ': /tools' rm dummy.c a.out #5.8 tar -xzf tcl8.4.13-src.tar.gz cd tcl8.4.13 cd unix (./configure --prefix=/tools) 2>&1 | tee -a ../../tcl.out (make && make install-private-headers) 2>&1 | tee -a ../../tcl.out (make install) 2>&1 | tee -a ../../tcl.out cd .. export TCLPATH=`pwd` ln -s tclsh8.4 /tools/bin/tclsh cd .. grep tcl.out -ie '^make.*error' || rm -rf tcl8.4.13 #5.9 tar -xzf expect-5.43.0.tar.gz cd expect-5.43 (patch -Np1 -i ../expect-5.43.0-spawn-1.patch) 2>&1 | tee -a ../expect.out (./configure --prefix=/tools --with-tcl=/tools/lib --with-tclinclude=/tools/include --with-x=no) 2>&1 | tee -a ../expect.out (make && make SCRIPTS="" install) 2>&1 | tee -a ../expect.out unset TCLPATH cd .. grep expect.out -ie '^make.*error' || rm -rf expect-5.43 #5.10 tar -xzf dejagnu-1.4.4.tar.gz cd dejagnu-1.4.4 (./configure --prefix=/tools) 2>&1 | tee -a ../dejagnu.out (make install) 2>&1 | tee -a ../dejagnu.out cd .. grep dejagnu.out -ie '^make.*error' || rm -rf dejagnu-1.4.4 #5.11 expect -c "spawn ls" tar -xjf gcc-4.0.3.tar.bz2 cd gcc-4.0.3 cp gcc/Makefile.in{,.orig} && sed 's@\./fixinc\.sh@-c true@' gcc/Makefile.in.orig > gcc/Makefile.in cp gcc/Makefile.in{,.tmp} && sed 's/^XCFLAGS =$/& -fomit-frame-pointer/' gcc/Makefile.in.tmp > gcc/Makefile.in (patch -Np1 -i ../gcc-4.0.3-specs-1.patch) 2>&1 | tee -a ../gcc2.out mkdir ../gcc-build cd ../gcc-build (../gcc-4.0.3/configure --prefix=/tools --with-local-prefix=/tools --enable-clocale=gnu --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-languages=c,c++ --disable-libstdcxx-pch) 2>&1 | tee -a ../gcc2.out (make && make install) 2>&1 | tee -a ../gcc2.out cd .. echo 'main(){}' > dummy.c cc dummy.c readelf -l a.out | grep ': /tools' rm dummy.c a.out grep gcc2.out -ie '^make.*error' rm -rf gcc-build/ rm -rf gcc-4.0.3 #5.12 tar -xjf binutils-2.16.1.tar.bz2 cd binutils-2.16.1 mkdir ../binutils-build cd ../binutils-build/ (../binutils-2.16.1/configure --prefix=/tools --disable-nls --with-lib-path=/tools/lib) 2>&1 | tee -a ../binutils2.out (make && make install) 2>&1 | tee -a ../binutils2.out (make -C ld clean && make -C ld LIB_PATH=/tools/lib) 2>&1 | tee -a ../binutils2.out cp ld/ld-new /tools/bin cd .. grep binutils2.out -ie '^make.*error' || (rm -rf binutils-2.16.1 && rm -rf binutils-build/) #5.13 tar -xzf ncurses-5.5.tar.gz cd ncurses-5.5 (./configure --prefix=/tools --with-shared --without-debug --without-ada --enable-overwrite && make && make install) 2>&1 | tee -a ../ncurses.out cd .. grep ncurses.out -ie '^make.*error' rm -rf ncurses-5.5 #5.14 tar -xzf bash-3.1.tar.gz cd bash-3.1 (patch -Np1 -i ../bash-3.1-fixes-8.patch) 2>&1 | tee -a ../bash.out (./configure --prefix=/tools --without-bash-malloc && make && make install) 2>&1 | tee -a ../bash.out ln -s bash /tools/bin/sh cd .. grep bash.out -ie '^make.*error' || rm -rf bash-3.1 #5.15 tar -xzf bzip2-1.0.3.tar.gz cd bzip2-1.0.3 (make && make PREFIX=/tools install) 2>&1 | tee -a ../bzip2.out cd .. grep bzip2.out -ie '^make.*error' || rm -rf bzip2-1.0.3 #5.16 tar -xjf coreutils-5.96.tar.bz2 cd coreutils-5.96 (./configure --prefix=/tools && make && make install) 2>&1 | tee -a ../coreutils.out cd .. grep coreutils.out -ie '^make.*error' || rm -rf coreutils-5.96 #5.17 tar -xzf diffutils-2.8.1.tar.gz cd diffutils-2.8.1 (./configure --prefix=/tools && make && make install) 2>&1 | tee -a ../diffutils.out cd .. grep diffutils.out -ie '^make.*error' || rm -rf diffutils-2.8.1 #5.18 tar -xzf findutils-4.2.27.tar.gz cd findutils-4.2.27 (./configure --prefix=/tools && make && make install) 2>&1 | tee -a ../findutils.out cd .. grep findutils.out -ie '^make.*error' || rm -rf findutils-4.2.27 #5.19 tar -xjf gawk-3.1.5.tar.bz2 cd gawk-3.1.5 (./configure --prefix=/tools) 2>&1 | tee -a ../gawk.out cat >>config.h <<"EOF" #define HAVE_LANGINFO_CODESET 1 #define HAVE_LC_MESSAGES 1 EOF (make && make install) 2>&1 | tee -a ../gawk.out cd .. grep gawk.out -ie '^make.*error' || rm -rf gawk-3.1.5 #5.20 tar -xzf gettext-0.14.5.tar.gz cd gettext-0.14.5 cd gettext-tools (./configure --prefix=/tools --disable-shared && make -C lib && make -C src msgfmt) 2>&1 | tee -a ../../gettext.out cp src/msgfmt /tools/bin cd ../.. grep gettext.out -ie '^make.*error' || rm -rf gettext-0.14.5 #5.21 tar -xjf grep-2.5.1a.tar.bz2 cd grep-2.5.1a (./configure --prefix=/tools --disable-perl-regexp && make && make install) 2>&1 | tee -a ../grep.out cd .. grep grep.out -ie '^make.*error' || rm -rf grep-2.5.1a #5.22 tar -xzf gzip-1.3.5.tar.gz cd gzip-1.3.5 (./configure --prefix=/tools && make && make install) 2>&1 | tee -a ../gzip.out cd .. grep gzip.out -ie '^make.*error' || rm -rf gzip-1.3.5 #5.23 tar -xzf m4-1.4.4.tar.gz cd m4-1.4.4 (./configure --prefix=/tools && make && make install) 2>&1 | tee -a ../m4.out cd .. grep m4.out -ie '^make.*error' || rm -rf m4-1.4.4 #5.24 tar -xjf make-3.80.tar.bz2 cd make-3.80 (./configure --prefix=/tools && make && make install) 2>&1 | tee -a ../make.out cd .. grep make.out -ie '^make.*error' || rm -rf make-3.80 #5.25 tar -xzf patch-2.5.4.tar.gz cd patch-2.5.4 (./configure --prefix=/tools && make && make install) 2>&1 | tee -a ../patch.out cd .. grep patch.out -ie '^make.*error' || rm -rf patch-2.5.4 #5.26 tar -xjf perl-5.8.8.tar.bz2 cd perl-5.8.8 (patch -Np1 -i ../perl-5.8.8-libc-2.patch) 2>&1 | tee -a ../perl.out (./configure.gnu --prefix=/tools -Dstatic_ext='Data/Dumper Fcntl IO POSIX' && make perl utilities) 2>&1 | tee -a ../perl.out cp perl pod/pod2man /tools/bin mkdir -p /tools/lib/perl5/5.8.8 cp -R lib/* /tools/lib/perl5/5.8.8 cd .. grep perl.out -ie '^make.*error' || rm -rf perl-5.8.8 #5.27 tar -xzf sed-4.1.5.tar.gz cd sed-4.1.5 (./configure --prefix=/tools && make && make install) 2>&1 | tee -a ../sed.out cd .. grep sed.out -ie '^make.*error' || rm -rf sed-4.1.5 #5.28 tar -xjf tar-1.15.1.tar.bz2 cd tar-1.15.1 (./configure --prefix=/tools && make && make install) 2>&1 | tee -a ../tar.out cd .. grep tar.out -ie '^make.*error' || rm -rf tar-1.15.1 #5.29 tar -xjf texinfo-4.8.tar.bz2 cd texinfo-4.8 (./configure --prefix=/tools && make && make install) 2>&1 | tee -a ../texinfo.out cd .. grep texinfo.out -ie '^make.*error' || rm -rf texinfo-4.8 #5.30 tar -xjf util-linux-2.12r.tar.bz2 cd util-linux-2.12r sed -i 's@/usr/include@/tools/include@g' configure (./configure && make -C lib && make -C mount mount umount && make -C text-utils more) 2>&1 | tee -a ../util-linux.out cp mount/{,u}mount text-utils/more /tools/bin cd .. grep util-linux.out -ie '^make.*error' || rm -rf util-linux-2.12r #5.32 exit chown -R root:root /mnt/tools #6.2 mkdir -p /mnt/{dev,proc,sys} mknod -m 600 /mnt/dev/console c 5 1 mknod -m 666 /mnt/dev/null c 1 3 mknod -m 660 /mnt/dev/ram0 b 1 0 mknod -m 660 /mnt/dev/ram1 b 1 1 mknod -m 660 /mnt/dev/ram2 b 1 2 #6.4 # this must be used to enter lfs chroot mode cat > /root/bin/lfsetup << "EOF" mount --bind /dev /mnt/dev mount -t devpts devpts /mnt/dev/pts mount -t tmpfs shm /mnt/dev/shm mount -t proc proc /mnt/proc mount -t sysfs sysfs /mnt/sys chroot "/mnt" /tools/bin/env -i HOME=/root TERM="$TERM" PS1='\u:\w\$ ' PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin /tools/bin/bash --login +h umount /mnt/sys umount /mnt/proc umount /mnt/dev/shm umount /mnt/dev/pts umount /mnt/dev EOF chmod 700 /root/bin/lfsetup lfsetup #6.5 install -d /var/{etc,home,root,srv,tmp} cd / ln -s var/etc etc ln -s var/home home ln -s var/root root ln -s var/srv srv ln -s var/tmp tmp chmod 0750 /var/root chmod 1777 /var/tmp mkdir -p /{bin,boot,etc/opt,lib,mnt,opt} mkdir -p /{media/{floppy,cdrom,usbstg},sbin} mkdir -p /usr/{,local/}{bin,include,lib,sbin,src} mkdir -p /usr/{,local/}share/{doc,info,locale,man} mkdir /usr/{,local/}share/{misc,terminfo,zoneinfo} mkdir -p /usr/{,local/}share/man/man{1..8} for dir in /usr /usr/local; do ln -s share/{man,doc,info} $dir done mkdir /var/{lock,log,mail,run,spool} mkdir -p /var/{opt,cache,lib/{misc,locate},local} #6.6 ln -s /tools/bin/{bash,cat,grep,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 touch /etc/mtab cat > /etc/passwd << "EOF" root:x:0:0:root:/root:/bin/bash EOF cat > /etc/group << "EOF" root:x:0: bin:x:1: sys:x:2: kmem:x:3: tty:x:4: tape:x:5: daemon:x:6: floppy:x:7: disk:x:8: lp:x:9: dialout:x:10: audio:x:11: video:x:12: utmp:x:13: usb:x:14: cdrom:x:15: EOF exec /tools/bin/bash --login +h touch /var/run/utmp /var/log/{btmp,lastlog,wtmp} chgrp utmp /var/run/utmp /var/log/lastlog chmod 664 /var/run/utmp /var/log/lastlog #6.7 mkdir /build cd sources tar -czf /build/toolchain.out.tgz *.out rm *.out tar -xjf linux-libc-headers-2.6.12.0.tar.bz2 cd linux-libc-headers-2.6.12.0 patch -Np1 -i ../linux-libc-headers-2.6.12.0-inotify-3.patch install -d /usr/include/asm cp -R include/asm-i386/* /usr/include/asm cp -R include/linux /usr/include chown -R root:root /usr/include/{asm,linux} find /usr/include/{asm,linux} -type d -exec chmod 755 {} \; find /usr/include/{asm,linux} -type f -exec chmod 644 {} \; cd .. rm -rf linux-libc-headers-2.6.12.0 #6.8 tar -xjf man-pages-2.34.tar.bz2 cd man-pages-2.34 (make install) 2>&1 | tee -a ../man-pages.out cd .. grep man-pages.out -ie '^make.*error' || rm -rf man-pages-2.34 #6.9 tar -xjf glibc-2.3.6.tar.bz2 cd glibc-2.3.6 tar -xf ../glibc-libidn-2.3.6.tar.bz2 (patch -Np1 -i ../glibc-2.3.6-linux_types-1.patch) 2>&1 | tee -a ../glibc.out (patch -Np1 -i ../glibc-2.3.6-inotify-1.patch) 2>&1 | tee -a ../glibc.out sed -i '/vi_VN.TCVN/d' localedata/SUPPORTED sed -i 's|libs -o|libs -L/usr/lib -Wl,-dynamic-linker=/lib/ld-linux.so.2 -o|' scripts/test-installation.pl mkdir ../glibc-build cd ../glibc-build (../glibc-2.3.6/configure --prefix=/usr --disable-profile --enable-add-ons --enable-kernel=2.6.0 --libexecdir=/usr/lib/glibc) 2>&1 | tee -a ../glibc.out (make) 2>&1 | tee -a ../glibc.out grep ../glibc.out -ie '^make.*error' (make -k check 2>&1 | tee glibc-check-log) 2>&1 | tee -a ../glibc.out grep Error glibc-check-log # test-canon expect 7 errors because we have /var/etc instead of /etc touch /etc/ld.so.conf (make install) 2>&1 | tee -a ../glibc.out cp ../glibc-2.3.6/sysdeps/unix/sysv/linux/inotify.h /usr/include/sys mkdir -p /usr/lib/locale localedef -i de_DE -f ISO-8859-1 de_DE localedef -i de_DE@euro -f ISO-8859-15 de_DE@euro 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 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 # do tzselect INTERACTIVELY before proceding if America/New_York is not in your time zone cp --remove-destination /usr/share/zoneinfo/America/New_York /etc/localtime cat > /etc/ld.so.conf << "EOF" # Begin /etc/ld.so.conf /usr/local/lib /opt/lib # End /etc/ld.so.conf EOF cd .. grep glibc.out -ie '^make.*error' rm -rf glibc-2.3.6 rm -rf glibc-build/ #6.10 mv /tools/bin/{ld,ld-old} mv /tools/$(gcc -dumpmachine)/bin/{ld,ld-old} mv /tools/bin/{ld-new,ld} ln -s /tools/bin/ld /tools/$(gcc -dumpmachine)/bin/ld gcc -dumpspecs | perl -p -e 's@/tools/lib/ld-linux.so.2@/lib/ld-linux.so.2@g;' -e 's@\*startfile_prefix_spec:\n@$_/usr/lib/ @g;' > `dirname $(gcc --print-libgcc-file-name)`/specs echo 'main(){}' > dummy.c cc dummy.c -Wl,--verbose &> dummy.log readelf -l a.out | grep ': /lib' grep -o '/usr/lib.*/crt[1in].* .*' dummy.log grep 'SEARCH.*/usr/lib' dummy.log |sed 's|; |\n|g' grep "/lib/libc.so.6 " dummy.log grep found dummy.log rm dummy.c a.out dummy.log #6.11 expect -c "spawn ls" tar -xjf binutils-2.16.1.tar.bz2 cd binutils-2.16.1 mkdir ../binutils-build cd ../binutils-build/ (../binutils-2.16.1/configure --prefix=/usr --enable-shared) 2>&1 | tee -a ../binutils.out (make tooldir=/usr) 2>&1 | tee -a ../binutils.out (make check) 2>&1 | tee -a ../binutils.out (make tooldir=/usr install) 2>&1 | tee -a ../binutils.out cp ../binutils-2.16.1/include/libiberty.h /usr/include cd .. grep binutils.out -ie '^make.*error' || rm -rf binutils-2.16.1/ rm -rf binutils-build/ #6.12 tar -xjf gcc-4.0.3.tar.bz2 cd gcc-4.0.3 sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in sed -i 's/^XCFLAGS =$/& -fomit-frame-pointer/' gcc/Makefile.in sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in sed -i 's/@have_mktemp_command@/yes/' gcc/gccbug.in mkdir ../gcc-build cd ../gcc-build (../gcc-4.0.3/configure --prefix=/usr --libexecdir=/usr/lib --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-languages=c,c++) 2>&1 | tee -a ../gcc.out (make) 2>&1 | tee -a ../gcc.out (make -k check) 2>&1 | tee -a ../gcc.out (../gcc-4.0.3/contrib/test_summary | grep -A7 Summ) 2>&1 | tee -a ../gcc.out (make install) 2>&1 | tee -a ../gcc.out ln -s ../usr/bin/cpp /lib ln -s gcc /usr/bin/cc cd .. grep gcc.out -ie '^make.*error' rm -rf gcc-4.0.3 rm -rf gcc-build/ echo 'main(){}' > dummy.c cc dummy.c -Wl,--verbose &> dummy.log readelf -l a.out | grep ': /lib' grep -o '/usr/lib.*/crt[1in].* .*' dummy.log grep 'SEARCH.*/usr/lib' dummy.log |sed 's|; |\n|g' grep "/lib/libc.so.6 " dummy.log grep found dummy.log rm dummy.c a.out dummy.log #6.13 tar -xzf db-4.4.20.tar.gz cd db-4.4.20 (patch -Np1 -i ../db-4.4.20-fixes-1.patch) 2>&1 | tee -a ../db.out (cd build_unix && ../dist/configure --prefix=/usr --enable-compat185 --enable-cxx) 2>&1 | tee -a ../db.out (cd build_unix && make && make docdir=/usr/share/doc/db-4.4.20 install) 2>&1 | tee -a ../db.out chown root:root /usr/bin/db_* /usr/lib/libdb* /usr/include/db* && chown -R root:root /usr/share/doc/db-4.4.20 cd .. grep db.out -ie '^make.*error' || rm -rf db-4.4.20 #6.14 tar -xjf coreutils-5.96.tar.bz2 cd coreutils-5.96 (patch -Np1 -i ../coreutils-5.96-uname-1.patch) 2>&1 | tee -a ../coreutils.out (patch -Np1 -i ../coreutils-5.96-suppress_uptime_kill_su-1.patch) 2>&1 | tee -a ../coreutils.out (patch -Np1 -i ../coreutils-5.96-i18n-1.patch) 2>&1 | tee -a ../coreutils.out chmod +x tests/sort/sort-mb-tests sed -i 's/_LEN 6/_LEN 20/' src/who.c (./configure --prefix=/usr) 2>&1 | tee -a ../coreutils.out (make) 2>&1 | tee -a ../coreutils.out echo "dummy1:x:1000:" >> /etc/group echo "dummy2:x:1001:dummy" >> /etc/group echo "dummy:x:1000:1000::/root:/bin/bash" >> /etc/passwd (make NON_ROOT_USERNAME=dummy check-root) 2>&1 | tee -a ../coreutils.out (src/su dummy -c "make RUN_EXPENSIVE_TESTS=yes check") 2>&1 | tee -a ../coreutils.out sed -i '/dummy/d' /etc/passwd /etc/group (make install) 2>&1 | tee -a ../coreutils.out mv /usr/bin/{cat,chgrp,chmod,chown,cp,date,dd,df,echo} /bin mv /usr/bin/{false,hostname,ln,ls,mkdir,mknod,mv,pwd,rm} /bin mv /usr/bin/{rmdir,stty,sync,true,uname} /bin mv /usr/bin/chroot /usr/sbin mv /usr/bin/{head,sleep,nice} /bin cd .. grep coreutils.out -ie '^make.*error' || rm -rf coreutils-5.96 #6.15 tar -xjf iana-etc-2.10.tar.bz2 cd iana-etc-2.10 (make && make install) 2>&1 | tee -a ../iana-etc.out cd .. grep iana-etc.out -ie '^make.*error' || rm -rf iana-etc-2.10 #6.16 tar -xzf m4-1.4.4.tar.gz cd m4-1.4.4 (./configure --prefix=/usr && make && make check) 2>&1 | tee -a ../m4.out (make install) 2>&1 | tee -a ../m4.out cd .. grep m4.out -ie '^make.*error' || rm -rf m4-1.4.4 #6.17 tar -xjf bison-2.2.tar.bz2 cd bison-2.2 (./configure --prefix=/usr) 2>&1 | tee -a ../bison.out echo '#define YYENABLE_NLS 1' >> config.h (make && make check) 2>&1 | tee -a ../bison.out (make install) 2>&1 | tee -a ../bison.out cd .. grep bison.out -ie '^make.*error' || rm -rf bison-2.2 #6.18 tar -xzf ncurses-5.5.tar.gz cd ncurses-5.5 (patch -Np1 -i ../ncurses-5.5-fixes-1.patch) 2>&1 | tee -a ../ncurses.out (./configure --prefix=/usr --with-shared --without-debug --enable-widec && make && make install) 2>&1 | tee -a ../ncurses.out chmod 755 /usr/lib/*.5.5 chmod 644 /usr/lib/libncurses++w.a mv /usr/lib/libncursesw.so.5* /lib ln -sf ../../lib/libncursesw.so.5 /usr/lib/libncursesw.so for lib in curses ncurses form panel menu ; do \ rm -f /usr/lib/lib${lib}.so ; \ echo "INPUT(-l${lib}w)" >/usr/lib/lib${lib}.so ; \ ln -sf lib${lib}w.a /usr/lib/lib${lib}.a ; \ done && ln -sf libncurses++w.a /usr/lib/libncurses++.a echo "INPUT(-lncursesw)" >/usr/lib/libcursesw.so && ln -sf libncurses.so /usr/lib/libcurses.so && ln -sf libncursesw.a /usr/lib/libcursesw.a && ln -sf libncurses.a /usr/lib/libcurses.a (make distclean && ./configure --prefix=/usr --with-shared --without-normal --without-debug --without-cxx-binding && make sources libs && cp -a lib/lib*.so.5* /usr/lib) 2>&1 | tee -a ../ncurses.out cd .. grep ncurses.out -ie '^make.*error' rm -rf ncurses-5.5 #6.19 tar -xzf procps-3.2.6.tar.gz cd procps-3.2.6 (make && make install) 2>&1 | tee -a ../procps.out cd .. grep procps.out -ie '^make.*error' || rm -rf procps-3.2.6 #6.20 tar -xzf sed-4.1.5.tar.gz cd sed-4.1.5 (./configure --prefix=/usr --bindir=/bin --enable-html && make && make check) 2>&1 | tee -a ../sed.out (make install) 2>&1 | tee -a ../sed.out cd .. grep sed.out -ie '^make.*error' || rm -rf sed-4.1.5 #6.21 tar -xzf libtool-1.5.22.tar.gz cd libtool-1.5.22 (./configure --prefix=/usr && make && make check) 2>&1 | tee -a ../libtool.out (make install) 2>&1 | tee -a ../libtool.out cd .. grep libtool.out -ie '^make.*error' || rm -rf libtool-1.5.22 #6.22 tar -xjf perl-5.8.8.tar.bz2 cd perl-5.8.8 echo "127.0.0.1 localhost $(hostname)" > /etc/hosts (./configure.gnu --prefix=/usr -Dman1dir=/usr/share/man/man1 -Dman3dir=/usr/share/man/man3 -Dpager="/usr/bin/less -isR") 2>&1 | tee -a ../perl.out (make && make test) 2>&1 | tee -a ../perl.out (make install) 2>&1 | tee -a ../perl.out cd .. grep perl.out -ie '^make.*error' rm -rf perl-5.8.8 #6.23 tar -xzf readline-5.1.tar.gz cd readline-5.1 (patch -Np1 -i ../readline-5.1-fixes-3.patch) 2>&1 | tee -a ../readline.out sed -i '/MV.*old/d' Makefile.in sed -i '/{OLDSUFF}/c:' support/shlib-install (./configure --prefix=/usr --libdir=/lib && make SHLIB_LIBS=-lncurses && make install) 2>&1 | tee -a ../readline.out chmod 755 /lib/lib{readline,history}.so* mv /lib/lib{readline,history}.a /usr/lib rm /lib/lib{readline,history}.so ln -sf ../../lib/libreadline.so.5 /usr/lib/libreadline.so ln -sf ../../lib/libhistory.so.5 /usr/lib/libhistory.so cd .. grep readline.out -ie '^make.*error' || rm -rf readline-5.1 #6.24 tar -xzf zlib-1.2.3.tar.gz cd zlib-1.2.3 (./configure --prefix=/usr --shared --libdir=/lib) 2>&1 | tee -a ../zlib.out (make && make check) 2>&1 | tee -a ../zlib.out (make install) 2>&1 | tee -a ../zlib.out rm /lib/libz.so ln -sf ../../lib/libz.so.1.2.3 /usr/lib/libz.so (make clean && ./configure --prefix=/usr && make && make check) 2>&1 | tee -a ../zlib.out (make install) 2>&1 | tee -a ../zlib.out chmod 644 /usr/lib/libz.a cd .. grep zlib.out -ie '^make.*error' || rm -rf zlib-1.2.3 #6.25 tar -xjf autoconf-2.59.tar.bz2 cd autoconf-2.59 (./configure --prefix=/usr && make && make check) 2>&1 | tee -a ../autoconf.out (make install) 2>&1 | tee -a ../autoconf.out cd .. grep autoconf.out -ie '^make.*error' || rm -rf autoconf-2.59 #6.26 tar -xjf automake-1.9.6.tar.bz2 cd automake-1.9.6 (./configure --prefix=/usr && make && make check) 2>&1 | tee -a ../automake.out (make install) 2>&1 | tee -a ../automake.out cd .. grep automake.out -ie '^make.*error' || rm -rf automake-1.9.6 #6.27 tar -xzf bash-3.1.tar.gz cd bash-3.1 tar -xzf ../bash-doc-3.1.tar.gz && sed -i "s|htmldir = @htmldir@|htmldir = /usr/share/doc/bash-3.1|" Makefile.in (patch -Np1 -i ../bash-3.1-fixes-8.patch) 2>&1 | tee -a ../bash.out (./configure --prefix=/usr --bindir=/bin --without-bash-malloc --with-installed-readline && make && make tests) 2>&1 | tee -a ../bash.out (make install) 2>&1 | tee -a ../bash.out cd .. grep bash.out -ie '^make.*error' || rm -rf bash-3.1 exec /bin/bash --login +h #6.28 tar -xzf bzip2-1.0.3.tar.gz cd bzip2-1.0.3 (patch -Np1 -i ../bzip2-1.0.3-install_docs-1.patch) 2>&1 | tee -a ../bzip2.out (patch -Np1 -i ../bzip2-1.0.3-bzgrep_security-1.patch) 2>&1 | tee -a ../bzip2.out sed -i 's@tempfile -d /tmp -p bz@mktemp -p /tmp@' bzdiff (make -f Makefile-libbz2_so && make clean && make) 2>&1 | tee -a ../bzip2.out (make install) 2>&1 | tee -a ../bzip2.out cp bzip2-shared /bin/bzip2 cp -a libbz2.so* /lib ln -s ../../lib/libbz2.so.1.0 /usr/lib/libbz2.so rm /usr/bin/{bunzip2,bzcat,bzip2} ln -s bzip2 /bin/bunzip2 ln -s bzip2 /bin/bzcat cd .. grep bzip2.out -ie '^make.*error' || rm -rf bzip2-1.0.3 #6.29 tar -xzf diffutils-2.8.1.tar.gz cd diffutils-2.8.1 (patch -Np1 -i ../diffutils-2.8.1-i18n-1.patch) 2>&1 | tee -a ../diffutils.out touch man/diff.1 (./configure --prefix=/usr && make && make install) 2>&1 | tee -a ../diffutils.out cd .. grep diffutils.out -ie '^make.*error' || rm -rf diffutils-2.8.1 #6.30 tar -xzf e2fsprogs-1.39.tar.gz cd e2fsprogs-1.39 mkdir build cd build (../configure --prefix=/usr --with-root-prefix="" --enable-elf-shlibs --disable-evms && make && make -k check) 2>&1 | tee -a ../../e2fsprogs.out (make install && make install-libs) 2>&1 | tee -a ../../e2fsprogs.out cd ../.. grep e2fsprogs.out -ie '^make.*error' rm -rf e2fsprogs-1.39 #6.31 tar -xzf file-4.17.tar.gz cd file-4.17 (./configure --prefix=/usr && make && make install) 2>&1 | tee -a ../file.out cd .. grep file.out -ie '^make.*error' || rm -rf file-4.17 #6.32 tar -xzf findutils-4.2.27.tar.gz cd findutils-4.2.27 (./configure --prefix=/usr --libexecdir=/usr/lib/findutils --localstatedir=/var/lib/locate && make && make check) 2>&1 | tee -a ../findutils.out (make install) 2>&1 | tee -a ../findutils.out mv /usr/bin/find /bin sed -i -e 's/find:=${BINDIR}/find:=\/bin/' /usr/bin/updatedb cd .. grep findutils.out -ie '^make.*error' || rm -rf findutils-4.2.27 #6.33 tar -xjf flex-2.5.33.tar.bz2 cd flex-2.5.33 (./configure --prefix=/usr && make && make check) 2>&1 | tee -a ../flex.out (make install) 2>&1 | tee -a ../flex.out ln -s libfl.a /usr/lib/libl.a cat > /usr/bin/lex << "EOF" #!/bin/sh # Begin /usr/bin/lex exec /usr/bin/flex -l "$@" # End /usr/bin/lex EOF chmod 755 /usr/bin/lex cd .. grep flex.out -ie '^make.*error' || rm -rf flex-2.5.33 #6.34 tar -xzf grub-0.97.tar.gz cd grub-0.97 (patch -Np1 -i ../grub-0.97-disk_geometry-1.patch) 2>&1 | tee -a ../grub.out (./configure --prefix=/usr && make && make check) 2>&1 | tee -a ../grub.out (make install) 2>&1 | tee -a ../grub.out mkdir /boot/grub cp /usr/lib/grub/i386-pc/stage{1,2} /boot/grub cp /usr/lib/grub/i386-pc/{e2fs,iso9660}* /boot/grub cd .. grep grub.out -ie '^make.*error' || rm -rf grub-0.97 #6.35 tar -xjf gawk-3.1.5.tar.bz2 cd gawk-3.1.5 (patch -Np1 -i ../gawk-3.1.5-segfault_fix-1.patch) 2>&1 | tee -a ../gawk.out (./configure --prefix=/usr --libexecdir=/usr/lib) 2>&1 | tee -a ../gawk.out cat >>config.h <<"EOF" #define HAVE_LANGINFO_CODESET 1 #define HAVE_LC_MESSAGES 1 EOF (make && make check) 2>&1 | tee -a ../gawk.out (make install) 2>&1 | tee -a ../gawk.out cd .. grep gawk.out -ie '^make.*error' || rm -rf gawk-3.1.5 #6.36 tar -xzf gettext-0.14.5.tar.gz cd gettext-0.14.5 (./configure --prefix=/usr && make && make check) 2>&1 | tee -a ../gettext.out (make install) 2>&1 | tee -a ../gettext.out cd .. grep gettext.out -ie '^make.*error' || rm -rf gettext-0.14.5 #6.37 tar -xjf grep-2.5.1a.tar.bz2 cd grep-2.5.1a (patch -Np1 -i ../grep-2.5.1a-redhat_fixes-2.patch) 2>&1 | tee -a ../grep.out chmod +x tests/fmbtest.sh (./configure --prefix=/usr --bindir=/bin && make && make check) 2>&1 | tee -a ../grep.out (make install) 2>&1 | tee -a ../grep.out cd .. grep grep.out -ie '^make.*error' || rm -rf grep-2.5.1a #6.38 tar -xzf groff-1.18.1.1.tar.gz cd groff-1.18.1.1 (patch -Np1 -i ../groff-1.18.1.1-debian_fixes-1.patch) 2>&1 | tee -a ../groff.out sed -i -e 's/2010/002D/' -e 's/2212/002D/' -e 's/2018/0060/' -e 's/2019/0027/' font/devutf8/R.proto (PAGE=letter ./configure --prefix=/usr --enable-multibyte && make && make install) 2>&1 | tee -a ../groff.out ln -s eqn /usr/bin/geqn ln -s tbl /usr/bin/gtbl cd .. grep groff.out -ie '^make.*error' || rm -rf groff-1.18.1.1 #6.39 tar -xzf gzip-1.3.5.tar.gz cd gzip-1.3.5 (patch -Np1 -i ../gzip-1.3.5-security_fixes-1.patch) 2>&1 | tee -a ../gzip.out (./configure --prefix=/usr) 2>&1 | tee -a ../gzip.out sed -i 's@"BINDIR"@/bin@g' gzexe.in (make && make install) 2>&1 | tee -a ../gzip.out mv /usr/bin/gzip /bin rm /usr/bin/{gunzip,zcat} ln -s gzip /bin/gunzip ln -s gzip /bin/zcat ln -s gzip /bin/compress ln -s gunzip /bin/uncompress cd .. grep gzip.out -ie '^make.*error' || rm -rf gzip-1.3.5 #6.40 tar -xzf inetutils-1.4.2.tar.gz cd inetutils-1.4.2 (patch -Np1 -i ../inetutils-1.4.2-gcc4_fixes-3.patch) 2>&1 | tee -a ../inetutils.out (patch -Np1 -i ../inetutils-1.4.2-no_server_man_pages-1.patch) 2>&1 | tee -a ../inetutils.out (./configure --prefix=/usr --libexecdir=/usr/sbin --sysconfdir=/etc --localstatedir=/var --disable-logger --disable-syslogd --disable-whois --disable-servers && make && make install) 2>&1 | tee -a ../inetutils.out mv /usr/bin/ping /bin cd .. grep inetutils.out -ie '^make.*error' || rm -rf inetutils-1.4.2 #6.41 tar -xzf iproute2-2.6.16-060323.tar.gz cd iproute2-2.6.16-060323 (make SBINDIR=/sbin && make SBINDIR=/sbin install) 2>&1 | tee -a ../iproute2.out mv /sbin/arpd /usr/sbin cd .. grep iproute2.out -ie '^make.*error' || rm -rf iproute2-2.6.16-060323 #6.42 tar -xjf kbd-1.12.tar.bz2 cd kbd-1.12 (patch -Np1 -i ../kbd-1.12-backspace-1.patch) 2>&1 | tee -a ../kbd.out (patch -Np1 -i ../kbd-1.12-gcc4_fixes-1.patch) 2>&1 | tee -a ../kbd.out (./configure --datadir=/lib/kbd && make && make install) 2>&1 | tee -a ../kbd.out mv /usr/bin/{kbd_mode,openvt,setfont} /bin cd .. grep kbd.out -ie '^make.*error' || rm -rf kbd-1.12 #6.43 tar -xzf less-394.tar.gz cd less-394 (./configure --prefix=/usr --sysconfdir=/etc && make && make install) 2>&1 | tee -a ../less.out cd .. grep less.out -ie '^make.*error' || rm -rf less-394 #6.44 tar -xjf make-3.80.tar.bz2 cd make-3.80 (./configure --prefix=/usr && make && make check) 2>&1 | tee -a ../make.out (make install) 2>&1 | tee -a ../make.out cd .. grep make.out -ie '^make.*error' || rm -rf make-3.80 #6.45 tar -xzf man-db-2.4.3.tar.gz cd man-db-2.4.3 mv man/de{_DE.88591,} && mv man/es{_ES.88591,} && mv man/it{_IT.88591,} && mv man/ja{_JP.eucJP,} && sed -i 's,\*_\*,??,' man/Makefile.in sed -i '/\t\/usr\/man/d' src/man_db.conf.in cat >>include/manconfig.h.in <<"EOF" #define WEB_BROWSER "exec /usr/bin/lynx" #define COL "/usr/bin/col" #define VGRIND "/usr/bin/vgrind" #define GRAP "/usr/bin/grap" EOF (./configure --prefix=/usr --enable-mb-groff --disable-setuid && make && make install) 2>&1 | tee -a ../man-db.out cat >>convert-mans <<"EOF" #!/bin/sh -e FROM="$1" TO="$2" shift ; shift while [ $# -gt 0 ] do FILE="$1" shift iconv -f "$FROM" -t "$TO" "$FILE" >.tmp.iconv mv .tmp.iconv "$FILE" done EOF install -m755 convert-mans /usr/bin cd .. grep man-db.out -ie '^make.*error' rm -rf man-db-2.4.3 #6.46 tar -xzf mktemp-1.5.tar.gz cd mktemp-1.5 (patch -Np1 -i ../mktemp-1.5-add_tempfile-3.patch) 2>&1 | tee -a ../mktemp.out (./configure --prefix=/usr --with-libc && make && make install && make install-tempfile) 2>&1 | tee -a ../mktemp.out cd .. grep mktemp.out -ie '^make.*error' || rm -rf mktemp-1.5 #6.47 tar -xjf module-init-tools-3.2.2.tar.bz2 cd module-init-tools-3.2.2 (patch -Np1 -i ../module-init-tools-3.2.2-modprobe-1.patch) 2>&1 | tee -a ../module-init-tools.out (./configure && make check && make distclean) 2>&1 | tee -a ../module-init-tools.out (./configure --prefix=/ --enable-zlib && make && make INSTALL=install install) 2>&1 | tee -a ../module-init-tools.out cd .. grep module-init-tools.out -ie '^make.*error' || rm -rf module-init-tools-3.2.2 #6.48 tar -xzf patch-2.5.4.tar.gz cd patch-2.5.4 (./configure --prefix=/usr && make && make install) 2>&1 | tee -a ../patch.out cd .. grep patch.out -ie '^make.*error' || rm -rf patch-2.5.4 #6.49 tar -xzf psmisc-22.2.tar.gz cd psmisc-22.2 (./configure --prefix=/usr --exec-prefix="" && make && make install) 2>&1 | tee -a ../psmisc.out mv /bin/pstree* /usr/bin cd .. grep psmisc.out -ie '^make.*error' || rm -rf psmisc-22.2 #6.50 tar -xjf shadow-4.0.15.tar.bz2 cd shadow-4.0.15 (./configure --libdir=/lib --enable-shared --without-selinux) 2>&1 | tee -a ../shadow.out sed -i 's/groups$(EXEEXT) //' src/Makefile find man -name Makefile -exec sed -i '/groups/d' {} \; sed -i -e 's/ ko//' -e 's/ zh_CN zh_TW//' man/Makefile for i in de es fi fr id it pt_BR; do convert-mans UTF-8 ISO-8859-1 man/${i}/*.? done for i in cs hu pl; do convert-mans UTF-8 ISO-8859-2 man/${i}/*.? done convert-mans UTF-8 EUC-JP man/ja/*.? convert-mans UTF-8 KOI8-R man/ru/*.? convert-mans UTF-8 ISO-8859-9 man/tr/*.? (make && make install) 2>&1 | tee -a ../shadow.out cp etc/{limits,login.access} /etc sed -e's@#MD5_CRYPT_ENAB.no@MD5_CRYPT_ENAB yes@' -e 's@/var/spool/mail@/var/mail@' etc/login.defs > /etc/login.defs mv /usr/bin/passwd /bin mv /lib/libshadow.*a /usr/lib rm /lib/libshadow.so ln -sf ../../lib/libshadow.so.0 /usr/lib/libshadow.so mkdir /etc/default pwconv grpconv passwd root cd .. grep shadow.out -ie '^make.*error' || rm -rf shadow-4.0.15 #6.51 tar -xzf sysklogd-1.4.1.tar.gz cd sysklogd-1.4.1 (patch -Np1 -i ../sysklogd-1.4.1-fixes-1.patch) 2>&1 | tee -a ../sysklogd.out (patch -Np1 -i ../sysklogd-1.4.1-8bit-1.patch) 2>&1 | tee -a ../sysklogd.out (make && make install) 2>&1 | tee -a ../sysklogd.out cat > /etc/syslog.conf << "EOF" # Begin /etc/syslog.conf authpriv.* /var/log/secure *.*;mail.none;authpriv.none /var/log/messages mail.* -/var/log/maillog *.emerg * # End /etc/syslog.conf EOF cd .. grep sysklogd.out -ie '^make.*error' || rm -rf sysklogd-1.4.1 #6.52 tar -xzf sysvinit-2.86.tar.gz cd sysvinit-2.86 sed -i 's@Sending processes@& started by init@g' src/init.c (make -C src && make -C src install) 2>&1 | tee -a ../sysvinit.out cat > /etc/inittab << "EOF" # Begin /etc/inittab id:3:initdefault: si::sysinit:/etc/rc.d/init.d/rc sysinit l0:0:wait:/etc/rc.d/init.d/rc 0 l1:S1:wait:/etc/rc.d/init.d/rc 1 l2:2:wait:/etc/rc.d/init.d/rc 2 l3:3:wait:/etc/rc.d/init.d/rc 3 l4:4:wait:/etc/rc.d/init.d/rc 4 l5:5:wait:/etc/rc.d/init.d/rc 5 l6:6:wait:/etc/rc.d/init.d/rc 6 ca:12345:ctrlaltdel:/sbin/shutdown -h now pf::powerfail:/sbin/shutdown -f -h +2 "Power Failure; System Shutting Down" pr:12345:powerokwait:/sbin/shutdown -c "Power Restored; Shutdown Cancelled" su:S016:once:/sbin/sulogin 1:2345:respawn:/sbin/agetty -I '\033(K' tty1 9600 2:2345:respawn:/sbin/agetty -I '\033(K' tty2 9600 3:2345:respawn:/sbin/agetty -I '\033(K' tty3 9600 4:2345:respawn:/sbin/agetty -I '\033(K' tty4 9600 5:2345:respawn:/sbin/agetty -I '\033(K' tty5 9600 6:2345:respawn:/sbin/agetty -I '\033(K' tty6 9600 # End /etc/inittab EOF cd .. grep sysvinit.out -ie '^make.*error' || rm -rf sysvinit-2.86 #6.53 tar -xjf tar-1.15.1.tar.bz2 cd tar-1.15.1 (patch -Np1 -i ../tar-1.15.1-gcc4_fix_tests-1.patch) 2>&1 | tee -a ../tar.out (patch -Np1 -i ../tar-1.15.1-sparse_fix-1.patch) 2>&1 | tee -a ../tar.out (patch -Np1 -i ../tar-1.15.1-security_fixes-1.patch) 2>&1 | tee -a ../tar.out (./configure --prefix=/usr --bindir=/bin --libexecdir=/usr/sbin && make && make check) 2>&1 | tee -a ../tar.out (make install) 2>&1 | tee -a ../tar.out cd .. grep tar.out -ie '^make.*error' || rm -rf tar-1.15.1 #6.54 tar -xjf texinfo-4.8.tar.bz2 cd texinfo-4.8 (patch -Np1 -i ../texinfo-4.8-multibyte-1.patch) 2>&1 | tee -a ../texinfo.out (patch -Np1 -i ../texinfo-4.8-tempfile_fix-2.patch) 2>&1 | tee -a ../texinfo.out (./configure --prefix=/usr && make && make check) 2>&1 | tee -a ../texinfo.out (make install && make TEXMF=/usr/share/texmf install-tex) 2>&1 | tee -a ../texinfo.out cd /usr/share/info rm dir for f in * do install-info $f dir 2>/dev/null done cd /sources grep texinfo.out -ie '^make.*error' || rm -rf texinfo-4.8 #6.55 tar -xjf udev-096.tar.bz2 cd udev-096 tar -xjf ../udev-config-6.2.tar.bz2 install -d /lib/{firmware,udev/devices/{pts,shm}} mknod -m0666 /lib/udev/devices/null c 1 3 ln -s /proc/self/fd /lib/udev/devices/fd ln -s /proc/self/fd/0 /lib/udev/devices/stdin ln -s /proc/self/fd/1 /lib/udev/devices/stdout ln -s /proc/self/fd/2 /lib/udev/devices/stderr ln -s /proc/kcore /lib/udev/devices/core (make EXTRAS="extras/ata_id extras/cdrom_id extras/edd_id extras/firmware extras/floppy extras/path_id extras/scsi_id extras/usb_id extras/volume_id" && make test) 2>&1 | tee -a ../udev.out (make DESTDIR=/ EXTRAS="extras/ata_id extras/cdrom_id extras/edd_id extras/firmware extras/floppy extras/path_id extras/scsi_id extras/usb_id extras/volume_id" install) 2>&1 | tee -a ../udev.out cp udev-config-6.2/[0-9]* /etc/udev/rules.d/ install -m644 -D docs/writing_udev_rules/index.html /usr/share/doc/udev-096/index.html cd .. grep udev.out -ie '^make.*error' || rm -rf udev-096 #6.56 tar -xjf util-linux-2.12r.tar.bz2 cd util-linux-2.12r sed -i 's@etc/adjtime@var/lib/hwclock/adjtime@g' hwclock/hwclock.c mkdir -p /var/lib/hwclock (patch -Np1 -i ../util-linux-2.12r-cramfs-1.patch) 2>&1 | tee -a ../util-linux.out (./configure && make HAVE_KILL=yes HAVE_SLN=yes && make HAVE_KILL=yes HAVE_SLN=yes install) 2>&1 | tee -a ../util-linux.out cd .. grep util-linux.out -ie '^make.*error' || rm -rf util-linux-2.12r #6.57 tar -xjf vim-7.0.tar.bz2 cd vim70/ (patch -Np1 -i ../vim-7.0-fixes-7.patch) 2>&1 | tee -a ../vim.out (patch -Np1 -i ../vim-7.0-mandir-1.patch) 2>&1 | tee -a ../vim.out (patch -Np1 -i ../vim-7.0-spellfile-1.patch) 2>&1 | tee -a ../vim.out echo '#define SYS_VIMRC_FILE "/etc/vimrc"' >> src/feature.h (./configure --prefix=/usr --enable-multibyte && make) 2>&1 | tee -a ../vim.out (make test) 2>&1 >> ../vim.out (make install) 2>&1 | tee -a ../vim.out rm -f /usr/share/vim/vim70/tutor/tutor.{gr,pl,ru,sk} rm -f /usr/share/vim/vim70/tutor/tutor.??.* ln -s vim /usr/bin/vi for L in "" fr it pl ru; do ln -s vim.1 /usr/share/man/$L/man1/vi.1 done ln -s ../vim/vim70/doc /usr/share/doc/vim-7.0 cat > /etc/vimrc << "EOF" " Begin /etc/vimrc set compatible set backspace=2 syntax on if (&term == "iterm") || (&term == "putty") set background=dark endif " End /etc/vimrc EOF cd .. grep vim.out -ie '^make.*error' || rm -rf vim70/ tar -xzf joe-3.5.tar.gz cd joe-3.5 (./configure --sysconfdir=/etc --prefix=/usr && make && make install) 2>&1 | tee -a ../joe.out cd .. grep joe.out -ie '^make.*error' || rm -rf joe-3.5/ #6.60 exit sed -i -e 's%/tools/bin/env%/usr/bin/env%' -e 's%:/tools/bin /tools/bin/bash --login +h% /bin/bash --login%' bin/lfsetup tar -czf /mnt/build/tools.tgz /mnt/tools rm -rf /mnt/tools lfsetup cd /sources #7.2 tar -xjf lfs-bootscripts-6.2.tar.bz2 cd lfs-bootscripts-6.2 (make install) 2>&1 | tee -a ../lfs-bootscripts.out cd .. grep lfs-bootscripts.out -ie '^make.*error' || rm -rf lfs-bootscripts-6.2 mv /etc/rc.d/rc1.d/K90sysklogd /etc/rc.d/rc1.d/S10sysklogd mv /etc/rc.d/rc2.d/K90sysklogd /etc/rc.d/rc2.d/S10sysklogd mkdir /etc/sysconfig/network-devices/ifconfig.eth0 # KEEP YOUR FINGER OFF THE TAB KEY IF YOU'RE EDITING THESE here DOCS USING EMACS # AND CUTTING AND PASTING TO CREATE THE FILES - INDENT BY HAND USING THE SPACE KEY !!! cat > /etc/rc.d/init.d/configure << "EOF" #!/bin/bash if (grep /proc/mounts -e '/dev/root' | grep -ie 'iso9660' > /dev/null) ; then passwd fi if [ ! -f /etc/sysconfig/network ]; then read -p 'Enter hostname (ie., ken.local): ' hn h=$(echo $hn | sed -e 's/\..*$//') echo "HOSTNAME=$h" > /etc/sysconfig/network read -p 'Enter IP address, DHCP or none: ' ip else h=$(grep /etc/sysconfig/network -e 'HOSTNAME=' | sed -e 's/HOSTNAME=//') hn=$(echo "$h" ".local" | sed -e 's/ //g') fi if [ ! -f /etc/hosts ]; then if [ "$ip" = DHCP -o "$ip" = none ]; then echo "127.0.0.1 $hn $h localhost" > /etc/hosts else echo "127.0.0.1 localhost" > /etc/hosts echo "$ip $hn $h" >> /etc/hosts fi else if [ "$ip" != DHCP -a "$ip" != none ]; then ip=$(grep /etc/hosts -e '[0-9]*\.[0-9]*\.[0-9]*\.[0-9]' | grep -ve '127\.0\.0\.1' | tr -s ' ' | cut -f2 -d' ') fi fi if [ ! -f /etc/sysconfig/network-devices/ifconfig.eth0/ipv4 -a "$ip" != none ]; then echo "ONBOOT=yes" > /etc/sysconfig/network-devices/ifconfig.eth0/ipv4 if [ "$ip" = DHCP ]; then echo "SERVICE=dhcpcd" >> /etc/sysconfig/network-devices/ifconfig.eth0/ipv4 else echo "SERVICE=ipv4-static" >> /etc/sysconfig/network-devices/ifconfig.eth0/ipv4 echo "IP=$ip" >> /etc/sysconfig/network-devices/ifconfig.eth0/ipv4 read -p 'Enter IP address of gateway: ' gw echo "GATEWAY=$gw" >> /etc/sysconfig/network-devices/ifconfig.eth0/ipv4 read -p 'Enter number of bits in the network portion of your IP address: ' nm echo "PREFIX=$nm" >> /etc/sysconfig/network-devices/ifconfig.eth0/ipv4 read -p 'Enter broadcast address: ' bc echo "BROADCAST=$bc" >> /etc/sysconfig/network-devices/ifconfig.eth0/ipv4 fi fi if [ ! -f /etc/resolv.conf -a "$ip" != none -a "$ip" != DHCP ]; then read -p 'Enter IP address of DNS server: ' dns echo "nameserver $dns" > /etc/resolv.conf fi if [ ! -f /etc/printcap ]; then read -p 'Enter IP address of postscript print server or none: ' pip if [ "$pip" != none ]; then echo "lp:sd=/var/spool/lpd/lp:sh:mx=0:mc=0:af=/var/spool/lpd/lp/acct.log:lp=lp@$pip" > /etc/printcap fi fi EOF chmod 754 /etc/rc.d/init.d/configure ln -s ../init.d/configure /etc/rc.d/rcsysinit.d/S75configure #this is necessary for configure to run completely the first time rm /etc/hosts (patch -ubz .lfs /etc/rc.d/init.d/mountfs krk.mountfs-6.2.patch) 2>&1 | tee -a lfs-bootscripts.out (patch -ubz .lfs /etc/rc.d/init.d/mountkernfs krk.mountkernfs-6.2.patch) 2>&1 | tee -a lfs-bootscripts.out (patch -ubz .lfs /etc/sysconfig/network-devices/ifup krk.ifup-6.2.patch) 2>&1 | tee -a lfs-bootscripts.out (patch -ubz .lfs /etc/rc.d/init.d/functions krk.functions-6.2.patch) 2>&1 | tee -a lfs-bootscripts.out mv /usr/bin/logger /bin/ cat > /etc/rc.d/init.d/firewall << "EOF" #!/bin/sh modprobe ip_tables modprobe iptable_filter modprobe ip_conntrack modprobe ip_conntrack_ftp modprobe ipt_state modprobe ipt_LOG # be verbose on dynamic ip-addresses (not needed in case of static IP) #echo 2 > /proc/sys/net/ipv4/ip_dynaddr echo "0" > /proc/sys/net/ipv4/tcp_ecn echo "1" > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts echo "0" > /proc/sys/net/ipv4/conf/all/accept_source_route echo "1" > /proc/sys/net/ipv4/tcp_syncookies echo "0" > /proc/sys/net/ipv4/conf/all/accept_redirects echo "0" > /proc/sys/net/ipv4/conf/all/send_redirects echo "1" > /proc/sys/net/ipv4/conf/all/rp_filter echo "1" > /proc/sys/net/ipv4/conf/all/log_martians iptables -F iptables -X iptables -Z iptables -t nat -F iptables -P INPUT DROP iptables -P FORWARD DROP iptables -P OUTPUT ACCEPT iptables -A INPUT -i lo -j ACCEPT iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT iptables -A INPUT -p icmp -m icmp --icmp-type echo-request -j ACCEPT #allow ssh from instructor's station in 265 lab iptables -A INPUT -s 192.168.1.150 -p tcp --dport 22 -j ACCEPT EOF chmod 754 /etc/rc.d/init.d/firewall ln -s ../init.d/firewall /etc/rc.d/rc3.d/S15firewall ln -s ../init.d/firewall /etc/rc.d/rc4.d/S15firewall ln -s ../init.d/firewall /etc/rc.d/rc5.d/S15firewall cat > /etc/rc.d/init.d/varupd << "EOF" #!/bin/bash if ((grep /etc/fstab -e '/var' > /dev/null) || (test -f /etc/.novar > /dev/null)) ; then exit 0 fi dname="" while [ -z "$dname" ]; do echo If using a usb device, insert it before answering the next prompt. read -p "Enter device name for backup (ie., fd0, sda1, none): " dname if [ "$dname" != none ]; then if [ ! -b /dev/$dname ]; then echo "/dev/$dname is not a valid block device" dname="" else mount -nt auto /dev/$dname /mnt if [ $? -ne 0 ]; then echo "unable to mount /dev/$dname" dname="" fi fi fi done if [ "$dname" = none ]; then exit 0 fi case "$1" in start) if [ -f /mnt/varupd.tgz ]; then tar -xzpPf /mnt/varupd.tgz res=$? else res=1 fi ;; stop) find /var -newer /root/.varupd | grep -ve '/dev\|/tmp' | tar -czpPf /mnt/varupd.tgz -T - res=$? ;; *) echo "Usage: $0 {start|stop}" res=1 ;; esac umount /mnt exit $res EOF chmod 754 /etc/rc.d/init.d/varupd ln -s ../init.d/varupd /etc/rc.d/rc0.d/K89varupd ln -s ../init.d/varupd /etc/rc.d/rc6.d/K89varupd #7.5 cat > /etc/sysconfig/clock << "EOF" # Begin /etc/sysconfig/clock UTC=0 # End /etc/sysconfig/clock EOF #7.8 cat > /etc/inputrc << "EOF" # Begin /etc/inputrc # Modified by Chris Lynn # Allow the command prompt to wrap to the next line set horizontal-scroll-mode Off # Enable 8bit input set meta-flag On set input-meta On # Turns off 8th bit stripping set convert-meta Off # Keep the 8th bit for display set output-meta On # none, visible or audible set bell-style none # All of the following map the escape sequence of the # value contained inside the 1st argument to the # readline specific functions "\eOd": backward-word "\eOc": forward-word # for linux console "\e[1~": beginning-of-line "\e[4~": end-of-line "\e[5~": beginning-of-history "\e[6~": end-of-history "\e[3~": delete-char "\e[2~": quoted-insert # for xterm "\eOH": beginning-of-line "\eOF": end-of-line # for Konsole "\e[H": beginning-of-line "\e[F": end-of-line # End /etc/inputrc EOF #7.9 cat > /etc/profile << "EOF" # Begin /etc/profile export LANG=en_US.ISO-8859-1 export INPUTRC=/etc/inputrc # End /etc/profile EOF #8.2 cat > /etc/fstab << "EOF" # Begin /etc/fstab # file system mount-point type options dump fsck # order /dev/hda2 / ext2 ro 1 1 /dev/hda6 /var ext2 defaults 0 0 /dev/hda3 swap swap pri=1 0 0 proc /proc proc defaults 0 0 sysfs /sys sysfs defaults 0 0 devpts /dev/pts devpts gid=4,mode=620 0 0 shm /dev/shm tmpfs defaults 0 0 usbfs /proc/bus/usb usbfs devgid=14,devmode=0660 0 0 /dev/hdc /media/cdrom iso9660 noauto,user,ro 0 0 /dev/fd0 /media/floppy auto noauto,user 0 0 /dev/sda1 /media/usbstg auto noauto,user 0 0 # End /etc/fstab EOF #8.3 tar -xjf linux-2.6.16.27.tar.bz2 cd linux-2.6.16.27 (patch -Np1 -i ../linux-2.6.16.27-utf8_input-1.patch) 2>&1 | tee -a ../linux.out (make mrproper) 2>&1 | tee -a ../linux.out make menuconfig (make) 2>&1 | tee -a ../linux.out (make modules_install) 2>&1 | tee -a ../linux.out cp arch/i386/boot/bzImage /boot/lfskernel-2.6.16.27 cp System.map /boot/System.map-2.6.16.27 cp .config /boot/config-2.6.16.27 cp vmlinux /boot/vmlinux-2.6.16.27 install -d /usr/share/doc/linux-2.6.16.27 && cp -r Documentation/* /usr/share/doc/linux-2.6.16.27 cd .. chown -R 0:0 linux-2.6.16.27 grep linux.out -ie '^make.*error' tar -czf ../build/lfsbuild.out.tgz *.out rm *.out tar -cf ../build/lfs.sources.tar *.{gz,bz2,patch} rm *.{gz,bz2,patch} #8.4 #we will be dual booting alongside existing system on /dev/hda1, so #added the following lines to the /boot/grub/menu.lst on /dev/hda1 #and copy menu.lst to our /boot #title LFS 6.2 - 2.6.16.27 #root (hd0,1) #kernel /boot/lfskernel-2.6.16.27 root=/dev/hda2 #if booting this from a cd-rom, execute the following AFTER logout # cd /mnt/var # tar -czf /root/var.tgz * # cp /root/var.tgz /mnt/root/ #if not, mount /dev/hda6 and cp -a /mnt/var/* to it mkdir /etc/grub && ln -s /boot/grub/menu.lst /etc/grub exit #this is necessary to allow mounting /var before udev has run mknod -m 660 /mnt/dev/hda6 b 3 6 #or mknod -m 660 /mnt/dev/sda b 8 0 && mknod -m 660 /mnt/dev/sda(var) b 8 (var)