New Buildscripts (yet again ;-) ) (v2.2.4)

Juan York jyorkhsd at earthlink.net
Mon Mar 31 01:10:47 PST 2003


Not sure if anyone is interested but i made a patch to add the 
functionality of auto downloading source files and patches.

There are some issues ... namely that the mmap_test patch is hard coded 
... and the vnsprintf patch isn't hosted on either greg's site or the 
lfs site.

-J


On 2003.03.30 20:49 Ryan.Oliver at pha.com.au wrote:
> Greetings again all
> 
> Another update, plenty of contributed changes from Nicolas Roeser
> (Thanks Nico)
> 
> As always, check the changelogs at the start of the scripts...
> 
> Regards
> Ryan
> 
> 
> 
-------------- next part --------------
--- old/build-init-2.2.4.sh	2003-03-31 03:29:19.000000000 -0500
+++ new/build-init-2.2.4.sh	2003-03-31 03:02:56.000000000 -0500
@@ -178,6 +178,9 @@
 # Set to use coreutils
 export USE_COREUTILS=Y
 
+# set to download source
+export GETUTIL="/usr/bin/wget -nH -P"
+
 # Set your timezone and locale
 export TZ="Australia/Melbourne"
 export LC_ALL="en_AU"
@@ -369,6 +372,97 @@
    }
 }
 
+download_src()
+{
+	if [ -n "${GETUTIL}" ]
+	then
+		get_it ()
+		{
+			#try and get bz2 file
+			${GETUTIL} ${TARBALLS} ${@}.tar.bz2
+			if [ ! $? -eq 0 ]
+			then
+				${GETUTIL} ${TARBALLS} ${@}.tar.gz
+			else
+				return 1
+			fi
+			if [ ! $? -eq 0 ]
+			then
+				return 1
+			fi
+			return 0
+		}
+
+		case ${@} in
+			
+			bash*) local url="ftp://ftp.gnu.org/gnu/bash";;
+
+			bzip2*) 	local url="ftp://ftp.no.linuxfromscratch.org/pub/lfs/lfs-packages/cvs";;
+			findutils*) 	local url="http://distro.ibiblio.org/pub/Linux/distributions/slackware/slackware_source/a/findutils";;
+			flex*)		local url="ftp://ftp3.sourceforge.net/pub/sourceforge/lex";;
+			gzip*) 		local url="http://www.gzip.org";;
+			linux-2.2.[0-9]*) local url="http://www.kernel.org/pub/linux/kernel/v2.2";;
+			linux-2.4.[0-9]*) local url="http://www.kernel.org/pub/linux/kernel/v2.4";;
+			linux-2.5.[0-9]*) local url="http://www.kernel.org/pub/linux/kernel/v2.5";;
+			util-linux*) local url="http://www.kernel.org/pub/linux/utils/util-linux";;
+			*) dpkg=`echo ${@} | cut -d"-" -f1`; local url="ftp://ftp.gnu.org/gnu/$dpkg" ;;
+		esac
+
+		#Try the default sites
+		get_it ${url}/${@}
+		if [ ! $? -eq 0 ]
+		then 
+			#last ditch try lfs cvs
+			local url="ftp://ftp.no.linuxfromscratch.org/pub/lfs/lfs-packages/cvs"
+			get_it ${url}/${@}
+		fi
+	fi
+}
+
+download_patch()
+{
+	if [ -n "${GETUTIL}" ]
+	then
+		get_it ()
+		{
+			#try and get bz2 file
+			${GETUTIL} ${PATCHES} ${@}.patch.bz2
+			if [ ! $? -eq 0 ]
+			then
+				${GETUTIL} ${PATCHES} ${@}.patch.gz
+			else
+				return 1
+			fi
+			if [ ! $? -eq 0 ]
+			then
+					${GETUTIL} ${PATCHES} ${@}.patch
+			fi		
+			if [ ! $? -eq 0 ]
+			then
+				return 1
+			fi		
+			return 0
+		}
+
+		#Try lfs site
+		local url="ftp://ftp.no.linuxfromscratch.org/pub/lfs/lfs-packages/cvs"
+		get_it ${url}/${@}
+	
+		if [ ! $? -eq 0 ]
+		then 
+			#try gregs regular site
+			local url="http://www.zipworld.com.au/~gschafer/patches"
+			get_it ${url}/${@}
+		fi
+		if [ ! $? -eq 0 ]
+		then 
+			#try gregs regular site
+			local url="http://www.zipworld.com.au/~gschafer/patches/pure_lfs"
+			get_it ${url}/${@}
+		fi
+	fi
+}
+
 check_tarballs () {
    # greps through the either the calling script or the script(s)
    # passed as args for calls to unpack_tarball.
@@ -420,8 +514,19 @@
 
       test -z ${archive} &&
       {
+        echo -e "NOT OK\n   XXXXXX NOT FOUND: Attempting to download '${pkgname}' to ${TARBALLS} XXXXXX"
+	download_src ${pkgname}
+	echo -en " o Download of ${pkgname} "
+      }
+
+      # check for the existence of the tarball
+      local archive=`ls -t ${TARBALLS}/${pkgname}.@(tgz|tar.gz|tar.bz2) \
+         2> /dev/null | head -1`
+
+      test -z ${archive} &&
+      {
          echo -e "NOT OK\n   XXXXXX NOT FOUND: Unable to locate tarball for '${pkgname}' in ${TARBALLS} XXXXXX"
-         exit 1
+	  exit 1
       } || 
       echo -e "OK\n   Found: ${archive}"
 
@@ -479,6 +584,17 @@
 
       test -z ${patchfile} &&
       {
+        echo -e "NOT OK\n   XXXXXX NOT FOUND: Attempting to download '${patchfile}' to ${PATCHESS} XXXXXX"
+	echo -e $patchfile
+	download_patch ${patchname}
+	echo -en " o Download of ${patchfile} "
+      }
+
+      local patchfile=`ls -t ${PATCHES}/${patchname}.@(patch|patch.gz|patch.bz2) \
+         2> /dev/null | head -1`
+
+      test -z ${patchfile} &&
+      {
          echo -e "NOT OK\n   XXXXXX NOT FOUND: Unable to locate patch for '${patchname}' in ${PATCHES} XXXXXX"
          exit 1
       } || 


More information about the lfs-dev mailing list