Changeset 0bad6ba


Ignore:
Timestamp:
09/27/2005 10:33:06 PM (19 years ago)
Author:
Manuel Canales Esparcia <manuel@…>
Branches:
0.2, 1.0, 2.3, 2.3.x, 2.4, ablfs, ablfs-more, legacy, new_features, trunk
Children:
b8bf2f8
Parents:
dc2fee8
Message:

Finished the handling of chapter04 and almost done chapter05.
At least now the generated Makefile can be used to build the temporally tools.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • jhalfs

    rdc2fee8 r0bad6ba  
    254254  >$MKFILE.tmp
    255255
    256   for file in chapter0{4,5}/* ; do
     256  for file in chapter05/* ; do
    257257  # Keep the script file name
    258258  i=`basename $file`
     
    260260  # First append each name of the script files to a list (this will become
    261261  # the names of the targets in the Makefile
    262   list="$list $i"
     262  chapter5="$chapter5 $i"
    263263
    264264  # Grab the name of the target (minus the -pass1 or -pass2 in the case of gcc
     
    282282
    283283    # Insert instructions for unpacking the package and changing directories
    284     echo -e "\t\$(call unpack,$FILE)" >> $MKFILE.tmp
     284    echo -e "\t\$(call unpack-lfs,$FILE) && \\" >> $MKFILE.tmp
    285285    echo -e "\tROOT=\`head -n1 /tmp/unpacked | sed 's@/.*@@'\` && \\" >> $MKFILE.tmp
    286     echo -e "\tcd \$(SRC)/\$\$ROOT && \\" >> $MKFILE.tmp
    287   fi
    288 
    289   # Run the script
    290   echo -e "\tsu - lfs -c \"/bin/bash $file\"" >> $MKFILE.tmp
     286    echo -e "\tcd \$(LFS)\$(SRC)/\$\$ROOT && \\" >> $MKFILE.tmp
     287  fi
     288
     289  # Insert the script run
     290  echo -e "\tsu lfs -c \". /home/lfs/.bashrc && $JHALFSDIR/commands/$file\" && \\" >> $MKFILE.tmp
    291291
    292292  # Include a touch of the target name so make can check if it's already been made.
    293293  echo -e "\ttouch \$@" >> $MKFILE.tmp
    294294  done
    295   # These seds turn the variables '$$LFS' into '$(LFS)' so make will understand,
    296   # and remove the ' && \'s from the end of each line of a cat command.
    297   sed -i -e 's|\$\$LFS|\$(LFS)|' -e '/^\tcat/,/^\tEOF/s/ \&\& \\//' $MKFILE.tmp
    298295
    299296  # Stick a variable and some defines at the top of the real makefile
    300297  echo "export SRC := /sources" > $MKFILE
    301298  echo "export LFS := $BUILDDIR" >> $MKFILE
     299  echo "define unpack-lfs" >> $MKFILE
     300  echo -e "\t@cd \$(LFS)\$(SRC) ; tar -xvjf \$(1) > /tmp/unpacked" >> $MKFILE
     301  echo -e "endef\n" >> $MKFILE
    302302  echo "define unpack" >> $MKFILE
    303303  echo -e "\t@cd \$(SRC) ; tar -xvf \$(1) > /tmp/unpacked" >> $MKFILE
    304304  echo -e "endef\n" >> $MKFILE
    305305
    306   # Drop in the list as the main target 'all:' with each sub-target as a dependency.
    307   echo "all: $list" >> $MKFILE
     306  # Drop in the main target 'all:' and the chapter targets with each sub-target
     307  # as a dependency.
     308  echo -e "all:  chapter4 chapter5\n" >> $MKFILE
     309  echo -e "chapter4:  020-creatingtoolsdir 021-addinguser 022-settingenvironment\n" >> $MKFILE
     310  echo -e "chapter5: $chapter5\n" >> $MKFILE
     311
     312  # Clean targets
     313  echo "clean-chapter4:" >> $MKFILE
     314  echo -e "\tuserdel lfs && \\" >> $MKFILE
     315  echo -e "\trm -r /home/lfs && \\" >> $MKFILE
     316  echo -e "\trm -r \$(LFS)/tools && \\" >> $MKFILE
     317  echo -e "\trm /tools" >> $MKFILE
     318  echo -e "\trm $JHALFSDIR/02*\n" >> $MKFILE
     319
     320  # The chapter4 sub-targets are hard-coded to can create the lfs user and
     321  # environment, and to make the scripts executables (as part of 021-addinguser).
     322  echo "020-creatingtoolsdir:" >> $MKFILE
     323  echo -e "\tmkdir \$(LFS)/tools && \\" >> $MKFILE
     324  echo -e "\tln -s \$(LFS)/tools / && \\" >> $MKFILE
     325  echo -e "\ttouch \$@\n" >> $MKFILE
     326
     327  echo "021-addinguser:" >> $MKFILE
     328  echo -e "\tgroupadd lfs && \\" >> $MKFILE
     329  echo -e "\tuseradd -s /bin/bash -g lfs -m -k /dev/null lfs && \\" >> $MKFILE
     330  echo -e "\tchown lfs \$(LFS)/tools && \\" >> $MKFILE
     331  echo -e "\tchown lfs \$(LFS)/sources && \\" >> $MKFILE
     332  # Make the scripts executables
     333  echo -e "\tchmod -R +x $JHALFSDIR/commands && \\" >> $MKFILE
     334  echo -e "\ttouch \$@\n" >> $MKFILE
     335
     336  echo "022-settingenvironment:" >> $MKFILE
     337  echo -e "\techo \"exec env -i HOME=\\\$\$HOME TERM=\\\$\$TERM PS1='\u:\w\$$ ' /bin/bash\" > /home/lfs/.bash_profile && \\" >> $MKFILE
     338  echo -e "\techo \"set +h\" > /home/lfs/.bashrc && \\" >> $MKFILE
     339  echo -e "\techo \"umask 022\" >> /home/lfs/.bashrc && \\" >> $MKFILE
     340  echo -e "\techo \"LFS=/mnt/lfs\" >> /home/lfs/.bashrc && \\" >> $MKFILE
     341  echo -e "\techo \"LC_ALL=POSIX\" >> /home/lfs/.bashrc && \\" >> $MKFILE
     342  echo -e "\techo \"PATH=/tools/bin:/bin:/usr/bin\" >> /home/lfs/.bashrc && \\" >> $MKFILE
     343  echo -e "\techo \"export LFS LC_ALL PATH\" >> /home/lfs/.bashrc && \\" >> $MKFILE
     344  echo -e "\tchown lfs /home/lfs/.bash* && \\" >> $MKFILE
     345  echo -e "\ttouch \$@\n" >> $MKFILE
     346
    308347
    309348  # Bring over the items from the Makefile.tmp
Note: See TracChangeset for help on using the changeset viewer.