r2128 - jhalfs/trunk

manuel at linuxfromscratch.org manuel at linuxfromscratch.org
Mon Oct 24 10:53:51 PDT 2005


Author: manuel
Date: 2005-10-24 11:53:50 -0600 (Mon, 24 Oct 2005)
New Revision: 2128

Added:
   jhalfs/trunk/jhalfs.conf
Modified:
   jhalfs/trunk/jhalfs
Log:
Reorganized the script.
Added jhalfs.conf to have more control over the configuration.
Many thanks to George B.

Modified: jhalfs/trunk/jhalfs
===================================================================
--- jhalfs/trunk/jhalfs	2005-10-16 19:41:03 UTC (rev 2127)
+++ jhalfs/trunk/jhalfs	2005-10-24 17:53:50 UTC (rev 2128)
@@ -1,5 +1,11 @@
 #!/bin/sh
 
+#
+# Load the configuration file
+#
+ . jhalfs.conf
+
+
 version="
 jhalfs development \$Date$
 
@@ -75,182 +81,21 @@
 echo \"Could not find a way to download the LFS sources.\" >&2
 echo \"Attempting to continue.\" >&2"
 
-while test $# -gt 0 ; do
-  case $1 in
-    --version | -V )
-      echo "$version"
-      exit 0
-      ;;
 
-    --help | -h )
-      echo "$usage"
-      exit 0
-      ;;
-
-    --LFS-version | -L )
-      test $# = 1 && eval "$exit_missing_arg"
-      shift
-      case $1 in
-        dev* | SVN | trunk )
-          LFSVRS=development
-          ;;
-        testing | 6.1.1 )
-          LFSVRS=6.1.1
-          ;;
-        * )
-          echo "$1 is an unsupported version at this time."
-          exit 1
-          ;;
-      esac
-      shift
-      ;;
-
-    --directory | -d )
-      test $# = 1 && eval "$exit_missing_arg"
-      shift
-      BUILDDIR=$1
-      shift
-      ;;
-
-    --download-client | -D )
-      test $# = 1 && eval "$exit_missing_arg"
-      shift
-      DL=$1
-      shift
-      ;;
-
-    --working-copy | -W )
-      test $# = 1 && eval "$exit_missing_arg"
-      shift
-      if [ -f $1/patches.ent ] ; then
-      WC=1
-      BOOK=$1
-      else
-        echo -e "\nLook like $1 isn't a supported working copy."
-        echo -e "Verify your selection and the command line.\n"
-        exit 1
-      fi
-      shift
-      ;;
-
-    --testsuites | -T )
-      TEST=1
-      shift
-      ;;
-
-    --get-packages | -P )
-      HPKG=1
-      shift
-      ;;
-
-    --run-make | -M )
-      RUNMAKE=1
-      shift
-      ;;
-
-    --page_size )
-      test $# = 1 && eval "$exit_missing_arg"
-      shift
-      case $1 in
-        letter | A4 )
-          PAGE=$1
-          ;;
-        * )
-          echo "$1 isn't a supported page size."
-          exit 1
-          ;;
-      esac
-      shift
-      ;;
-
-    --no-toolchain-test )
-      TOOLCHAINTEST=0
-      shift
-      ;;
-
-    --timezone )
-      test $# = 1 && eval "$exit_missing_arg"
-      shift
-      if [ -f /usr/share/zoneinfo/$1 ] ; then
-        TIMEZONE=$1
-      else
-        echo -e "\nLook like $1 isn't a valid timezone description."
-        echo -e "Verify your selection and the command line.\n"
-        exit 1
-      fi
-      shift
-      ;;
-
-    --fstab )
-      test $# = 1 && eval "$exit_missing_arg"
-      shift
-      if [ -f $1 ] ; then
-        FSTAB=$1
-      else
-        echo -e "\nFile $1 not found. Verify your command line.\n"
-        exit 1
-      fi
-      shift
-      ;;
-
-    --kernel-config | -C )
-      test $# = 1 && eval "$exit_missing_arg"
-      shift
-      if [ -f $1 ] ; then
-        CONFIG=$1
-      else
-        echo -e "\nFile $1 not found. Verify your command line.\n"
-        exit 1
-      fi
-      shift
-      ;;
-
-    * )
-      echo "$usage"
-      exit 1
-      ;;
-  esac
-done
-
-# Test to make sure we're running the build as root
-
-if [ "$UID" != "0" ] ; then
-  echo "You must be logged in as root to successfully build LFS."
-  exit 1
-fi
-
-# Find the download client to use, if not already specified.
-
-if [ -z $DL ] ; then
-  if [ `type -p wget` ] ; then
-    DL=wget
-  elif [ `type -p curl` ] ; then
-    DL=curl
-  else
-    eval "$no_dl_client"
-  fi
-fi
-
-SVN="svn://svn.linuxfromscratch.org"
-HTTP=http://ftp.lfs-matrix.net/pub/lfs/lfs-packages/conglomeration
-if [ -z $BUILDDIR ] ; then BUILDDIR=/mnt/lfs ; fi
-JHALFSDIR=$BUILDDIR/jhalfs
-LOGDIR=$JHALFSDIR/logs
-LOG=000-jhalfs.log
-MKFILE=$JHALFSDIR/Makefile
-XSL=dump-lfs-scripts.xsl
-FNC=functions
-if [ -z $TEST ] ; then TEST=0 ; fi
-if [ -z $TOOLCHAINTEST ] ; then TOOLCHAINTEST=1 ; fi
-if [ -z $PAGE ] ; then PAGE=letter ; fi
-if [ -z $TIMEZONE ] ; then TIMEZONE=Europe/London ; fi
-
 HEADER="# This file is automatically generated by jhalfs
 # DO NOT EDIT THIS FILE MANUALLY
 #
 # Generated on `date \"+%F %X %Z\"`"
 
+
+###################################
+###	    FUNCTIONS		###
+###################################
+
+
+#----------------------------#
 get_book() {
+#----------------------------#
   # Check for Subversion instead of just letting the script hit 'svn' and fail.
   test `type -p svn` || eval "echo \"This feature requires Subversion.\"
   exit 1"
@@ -296,7 +141,9 @@
   VERSION=`grep "ENTITY version " $BOOK/general.ent | sed -e 's@<!ENTITY version "@@' -e 's@">@@'`
 }
 
+#----------------------------#
 extract_commands() {
+#----------------------------#
   # Check for libxslt instead of just letting the script hit 'xsltproc' and fail.
   test `type -p xsltproc` || eval "echo \"This feature requires libxslt.\"
   exit 1"
@@ -331,7 +178,9 @@
   get_sources
 }
 
+#----------------------------#
 download() {
+#----------------------------#
   cd $BUILDDIR/sources
 
   # Hackish fix for the bash-doc and glibc-{linuxthreads,libidn} packages that
@@ -371,7 +220,9 @@
   fi
 }
 
+#----------------------------#
 get_sources() {
+#----------------------------#
 
   # Test if the packages must be downloaded
   if [ "$HPKG" = "1" ] ; then
@@ -426,13 +277,44 @@
   fi
 }
 
-build_Makefile() {
-  echo -n "Creating Makefile... "
-  cd $JHALFSDIR/commands
+#----------------------------#
+chapter4_Makefiles() {
+#----------------------------#
+(
+    cat << EOF
+020-creatingtoolsdir:
+	@\$(call echo_message, Building)
+	@mkdir -v \$(LFS)/tools && \\
+	ln -sv \$(LFS)/tools / && \\
+	touch \$@
 
-  # Start with a clean Makefile.tmp file
-  >$MKFILE.tmp
+021-addinguser:  020-creatingtoolsdir
+	@\$(call echo_message, Building)
+	@groupadd lfs && \\
+	useradd -s /bin/bash -g lfs -m -k /dev/null lfs && \\
+	chown lfs \$(LFS)/tools && \\
+	chown lfs \$(LFS)/sources && \\
+	touch \$@
 
+022-settingenvironment:  021-addinguser
+	@\$(call echo_message, Building)
+	@echo "set +h" > /home/lfs/.bashrc && \\
+	echo "umask 022" >> /home/lfs/.bashrc && \\
+	echo "LFS=/mnt/lfs" >> /home/lfs/.bashrc && \\
+	echo "LC_ALL=POSIX" >> /home/lfs/.bashrc && \\
+	echo "PATH=/tools/bin:/bin:/usr/bin" >> /home/lfs/.bashrc && \\
+	echo "export LFS LC_ALL PATH" >> /home/lfs/.bashrc && \\
+	echo "source $JHALFSDIR/envars" >> /home/lfs/.bashrc && \\
+	chown lfs:lfs /home/lfs/.bashrc && \\
+	touch envars && \\
+	touch \$@
+EOF
+) >> $MKFILE.tmp
+}
+
+#----------------------------#
+chapter5_Makefiles() {
+#----------------------------#
   for file in chapter05/* ; do
     # Keep the script file name
     i=`basename $file`
@@ -588,8 +470,12 @@
 
     # Keep the script file name for Makefile dependencies.
     PREV=$i
-  done
+  done  # end for file in chapter05/*
+}
 
+#----------------------------#
+chapter6_Makefiles() {
+#----------------------------#
   for file in chapter06/* ; do
     # Keep the script file name
     i=`basename $file`
@@ -722,8 +608,12 @@
 
     # Keep the script file name for Makefile dependencies.
     PREV=$i
-  done
+  done # end for file in chapter06/*
+}
 
+#----------------------------#
+chapter789_Makefiles() {
+#----------------------------#
   for file in chapter0{7,8,9}/* ; do
     # Keep the script file name
     i=`basename $file`
@@ -827,8 +717,25 @@
 
     # Keep the script file name for Makefile dependencies.
     PREV=$i
-  done
+  done  # for file in chapter0{7,8,9}/*
+} 
 
+
+#----------------------------#
+build_Makefile() {
+#----------------------------#
+  echo -n "Creating Makefile... "
+  cd $JHALFSDIR/commands
+
+  # Start with a clean Makefile.tmp file
+  >$MKFILE.tmp
+
+  chapter4_Makefiles
+  chapter5_Makefiles
+  chapter6_Makefiles  
+  chapter789_Makefiles  
+
+
   # Add a header, some variables and include the function file
   # to the top of the real Makefile.
 (
@@ -850,7 +757,8 @@
   i=1
   for file in chapter06/*chroot* ; do
     chroot=`cat $file | sed -e '/#!\/bin\/sh/d' -e 's@ \\\@ @g' | tr -d '\n' | sed \
-      -e 's/  */ /g' -e 's|\\$|&&|g' -e 's|exit||g' -e 's|$| -c|' -e 's|"$$LFS"|$(LFS)|'`
+      -e 's/  */ /g' -e 's|\\$|&&|g' -e 's|exit||g' -e 's|$| -c|' \
+      -e 's|"$$LFS"|$(LFS)|' -e 's|set -e||'`
     echo -e "CHROOT$i= $chroot\n" >> $MKFILE
     i=`expr $i + 1`
   done
@@ -888,32 +796,6 @@
 	rm -f $chapter5
 	cd logs && rm -f $chapter5 && cd ..
 
-020-creatingtoolsdir:
-	@\$(call echo_message, Building)
-	@mkdir -v \$(LFS)/tools && \\
-	ln -sv \$(LFS)/tools / && \\
-	touch \$@
-
-021-addinguser:  020-creatingtoolsdir
-	@\$(call echo_message, Building)
-	@groupadd lfs && \\
-	useradd -s /bin/bash -g lfs -m -k /dev/null lfs && \\
-	chown lfs \$(LFS)/tools && \\
-	chown lfs \$(LFS)/sources && \\
-	touch \$@
-
-022-settingenvironment:  021-addinguser
-	@\$(call echo_message, Building)
-	@echo "set +h" > /home/lfs/.bashrc && \\
-	echo "umask 022" >> /home/lfs/.bashrc && \\
-	echo "LFS=/mnt/lfs" >> /home/lfs/.bashrc && \\
-	echo "LC_ALL=POSIX" >> /home/lfs/.bashrc && \\
-	echo "PATH=/tools/bin:/bin:/usr/bin" >> /home/lfs/.bashrc && \\
-	echo "export LFS LC_ALL PATH" >> /home/lfs/.bashrc && \\
-	echo "source $JHALFSDIR/envars" >> /home/lfs/.bashrc && \\
-	chown lfs:lfs /home/lfs/.bashrc && \\
-	touch envars && \\
-	touch \$@
 EOF
 ) >> $MKFILE
 
@@ -923,7 +805,9 @@
   echo -ne "done\n"
 }
 
+#----------------------------#
 run_make() {
+#----------------------------#
   # Test if make must be run.
   if [ "$RUNMAKE" = "1" ] ; then
     # Build the system
@@ -935,20 +819,158 @@
   fi
 }
 
-if [ ! -d $JHALFSDIR ] ; then
-  mkdir -pv $JHALFSDIR
+
+
+###################################
+###		MAIN		###
+###################################
+
+# Test to make sure we're running the build as root
+
+if [ "$UID" != "0" ] ; then
+  echo "You must be logged in as root to successfully build LFS."
+  exit 1
 fi
 
-if [ ! -d $LOGDIR ] ; then
-  mkdir -v $LOGDIR
+# Find the download client to use, if not already specified.
+
+if [ -z $DL ] ; then
+  if [ `type -p wget` ] ; then
+    DL=wget
+  elif [ `type -p curl` ] ; then
+    DL=curl
+  else
+    eval "$no_dl_client"
+  fi
 fi
 
+# Evaluate any command line switches
+
+while test $# -gt 0 ; do
+  case $1 in
+    --version | -V )
+      echo "$version"
+      exit 0
+      ;;
+
+    --help | -h )
+      echo "$usage"
+      exit 0
+      ;;
+
+    --LFS-version | -L )
+      test $# = 1 && eval "$exit_missing_arg"
+      shift
+      case $1 in
+        dev* | SVN | trunk )
+          LFSVRS=development
+          ;;
+        testing | 6.1.1 )
+          LFSVRS=6.1.1
+          ;;
+        * )
+          echo "$1 is an unsupported version at this time."
+          exit 1
+          ;;
+      esac
+      ;;
+
+    --directory | -d )
+      test $# = 1 && eval "$exit_missing_arg"
+      shift
+      BUILDDIR=$1
+      ;;
+
+    --download-client | -D )
+      test $# = 1 && eval "$exit_missing_arg"
+      shift
+      DL=$1
+      ;;
+
+    --working-copy | -W )
+      test $# = 1 && eval "$exit_missing_arg"
+      shift
+      if [ -f $1/patches.ent ] ; then
+      WC=1
+      BOOK=$1
+      else
+        echo -e "\nLook like $1 isn't a supported working copy."
+        echo -e "Verify your selection and the command line.\n"
+        exit 1
+      fi
+      ;;
+
+    --testsuites | -T )		TEST=1 ;;
+
+    --get-packages | -P )	HPKG=1 ;;
+
+    --run-make | -M )		RUNMAKE=1 ;;
+
+    --no-toolchain-test )	TOOLCHAINTEST=0 ;;
+    
+    --page_size )
+      test $# = 1 && eval "$exit_missing_arg"
+      shift
+      case $1 in
+        letter | A4 )
+          PAGE=$1
+          ;;
+        * )
+          echo "$1 isn't a supported page size."
+          exit 1
+          ;;
+      esac
+      ;;
+
+
+    --timezone )
+      test $# = 1 && eval "$exit_missing_arg"
+      shift
+      if [ -f /usr/share/zoneinfo/$1 ] ; then
+        TIMEZONE=$1
+      else
+        echo -e "\nLook like $1 isn't a valid timezone description."
+        echo -e "Verify your selection and the command line.\n"
+        exit 1
+      fi
+      ;;
+
+    --fstab )
+      test $# = 1 && eval "$exit_missing_arg"
+      shift
+      if [ -f $1 ] ; then
+        FSTAB=$1
+      else
+        echo -e "\nFile $1 not found. Verify your command line.\n"
+        exit 1
+      fi
+      ;;
+
+    --kernel-config | -C )
+      test $# = 1 && eval "$exit_missing_arg"
+      shift
+      if [ -f $1 ] ; then
+        CONFIG=$1
+      else
+        echo -e "\nFile $1 not found. Verify your command line.\n"
+        exit 1
+      fi
+      ;;
+
+    * )
+      echo "$usage"
+      exit 1
+      ;;
+  esac
+  shift
+done
+
+[[ ! -d $JHALFSDIR ]]        && mkdir -pv $JHALFSDIR
+[[ "$PWD" != "$JHALFSDIR" ]] && cp -v $0 $XSL $FILES $JHALFSDIR/
+[[ ! -d $LOGDIR ]]           && mkdir -v $LOGDIR
 >$LOGDIR/$LOG
 
-if [ "$PWD" != "$JHALFSDIR" ] ; then
-  cp -v $0 $XSL $FNC $JHALFSDIR/
-fi
-
 get_book
 build_Makefile
 run_make
+

Added: jhalfs/trunk/jhalfs.conf
===================================================================
--- jhalfs/trunk/jhalfs.conf	2005-10-16 19:41:03 UTC (rev 2127)
+++ jhalfs/trunk/jhalfs.conf	2005-10-24 17:53:50 UTC (rev 2128)
@@ -0,0 +1,41 @@
+#####
+#
+# Configuration file for the jhalfs build script
+#
+#####
+
+declare -r SVN="svn://svn.linuxfromscratch.org"
+declare -r HTTP=http://ftp.lfs-matrix.net/pub/lfs/lfs-packages/conglomeration
+declare -r XSL=dump-lfs-scripts.xsl
+declare -r FILES="functions jhalfs.conf"
+declare -r LOG=000-jhalfs.log
+
+#--- Mount point for the build
+BUILDDIR=/mnt/lfs
+
+#--- Working directories
+JHALFSDIR=$BUILDDIR/jhalfs
+   LOGDIR=$JHALFSDIR/logs
+   MKFILE=$JHALFSDIR/Makefile
+   
+#--- Download the source packages 0(no)/1(yes)
+HPKG=0
+
+#--- Run the makefile at the end  0(no)/1(yes)
+RUNMAKE=0
+
+#--- Run test suites  0(no)/1(yes)
+TEST=0
+
+#--- Run the toolchain tests  0(no)/1(yes)
+TOOLCHAINTEST=1
+
+#--- page definition for groff letter/A4
+PAGE=letter
+
+#--- set default timezone.
+TIMEZONE=Europe/London
+
+#--- Location of kernel config file (if the kernel is to be compiled)
+CONFIG=
+


Property changes on: jhalfs/trunk/jhalfs.conf
___________________________________________________________________
Name: svn:keywords
   + "Author Date Revision Id"




More information about the alfs-log mailing list