#!/bin/bash
LFS="/mnt/lfs"
DIR_LFSINSTALL=".."
DIR_LFSINSTALL2="/usr/lib/lfs-install"

cd $LFS/usr/src
rm -rf bash-2.05a
rm -rf binutils-2.12 binutils-build 
rm -rf bzip2-1.0.2
rm -rf diffutils-2.8
rm -rf fileutils-4.1
rm -rf gawk-3.1.0
rm -rf gcc-2.95.3 gcc-build
rm -rf grep-2.5
rm -rf gzip-1.2.4a
rm -rf make-3.79.1
rm -rf patch-2.5.4
rm -rf sed-3.02
rm -rf sh-utils-2.0
rm -rf tar-1.13
rm -rf texinfo-4.1
rm -rf textutils-2.0

tar xfj bash-2.05a.tar.bz2
tar xfj binutils-2.12.tar.bz2
tar xfj bzip2-1.0.2.tar.bz2
tar xfj diffutils-2.8.tar.bz2
tar xfj fileutils-4.1.tar.bz2
tar xfj gawk-3.1.0.tar.bz2
tar xfj gcc-2.95.3.tar.bz2
tar xfj grep-2.5.tar.bz2
tar xfj gzip-1.2.4a.tar.bz2
tar xfj make-3.79.1.tar.bz2
tar xfj patch-2.5.4.tar.bz2
tar xfj sed-3.02.tar.bz2
tar xfj sh-utils-2.0.tar.bz2
tar xfj tar-1.13.tar.bz2
tar xfj texinfo-4.1.tar.bz2
tar xfj textutils-2.0.tar.bz2

cd -
mkdir $LFS/usr/lib/lfs-install
cp -r $DIR_LFSINSTALL/lfs-commands-3.3 $LFS/usr/lib/lfs-install

cd $DIR_LFSINSTALL/lfs-commands-3.3/chapter5
./creating_passwd_group
./mounting_lfs_proc

cd ../chapter6
./creating_lfs_root

chroot $LFS $DIR_LFSINSTALL2/lfs-commands-3.3/chapter6/changing_ownership_lfs
chroot $LFS $DIR_LFSINSTALL2/lfs-commands-3.3/chapter6/creating_etc_mtab
