[PC-BSD Commits] r20699 - pcbsd/current/build-files/src-patches

svn at pcbsd.org svn at pcbsd.org
Wed Dec 19 09:36:53 PST 2012


Author: kris
Date: 2012-12-19 17:36:53 +0000 (Wed, 19 Dec 2012)
New Revision: 20699

Modified:
   pcbsd/current/build-files/src-patches/patch-pc-sysinstall-pkgimprovements
Log:

Update the pc-sysinstall patch, fix some bugs installing packages,
switch to using a space-delimiter for installPackages, since a number
of packages use a "," in their version string



Modified: pcbsd/current/build-files/src-patches/patch-pc-sysinstall-pkgimprovements
===================================================================
--- pcbsd/current/build-files/src-patches/patch-pc-sysinstall-pkgimprovements	2012-12-19 17:13:59 UTC (rev 20698)
+++ pcbsd/current/build-files/src-patches/patch-pc-sysinstall-pkgimprovements	2012-12-19 17:36:53 UTC (rev 20699)
@@ -2,8 +2,13 @@
 ===================================================================
 --- usr.sbin/pc-sysinstall/backend/functions-installpackages.sh	(revision 244159)
 +++ usr.sbin/pc-sysinstall/backend/functions-installpackages.sh	(working copy)
-@@ -78,48 +78,96 @@
+@@ -76,50 +76,109 @@
+ # Check for any packages specified, and begin loading them
+ install_packages()
  {
++  echo "Checking for packages to install..."
++  sleep 2
++
    # First, lets check and see if we even have any packages to install
    get_value_from_cfg installPackages
 -  if [ -n "${VAL}" ]
@@ -20,6 +25,9 @@
 +  if [ -z "${VAL}" ]; then return; fi
  
 -    if [ ! -f "${CONFDIR}/INDEX.parsed" ]
++  echo "Installing packages..."
++  sleep 3
++
 +  local PKGPTH
 +
 +  HERE=`pwd`
@@ -51,15 +59,16 @@
 +
 +  # Lets start by cleaning up the string and getting it ready to parse
 +  get_value_from_cfg installPackages
-+  strip_white_space "${VAL}"
-+  PACKAGES=`echo ${VAL} | sed -e "s|,| |g"`
++  PACKAGES="${VAL}"
++  echo_log "Packages to install: `echo $PACKAGES | wc -w | awk '{print $1}'`"
 +  for i in $PACKAGES
 +  do
-+    if get_package_name "${i}"
++    if ! get_package_name "${i}"
      then
 -      parse_package_index
--    fi
-+      PKGNAME="${VAL}"
++      echo_log "Unable to locate package ${i}"
++      continue
+     fi
  
 -    # Lets start by cleaning up the string and getting it ready to parse
 -    strip_white_space ${VAL}
@@ -69,55 +78,63 @@
 -      if get_package_name "${i}"
 -      then
 -        PKGNAME="${VAL}"
-+      # Fetch package + deps, but skip if installing from local media
-+      if [ "${INSTALLMEDIUM}" = "ftp" ] ; then
-         DEPFILE="${FSMNT}/${PKGTMPDIR}/.${PKGNAME}.deps"
--
-         rc_nohalt "touch ${DEPFILE}"
-         determine_package_dependencies "${PKGNAME}" "${DEPFILE}"
-         fetch_package_dependencies "${DEPFILE}" "${FSMNT}/${PKGTMPDIR}"
-+      fi
+-        DEPFILE="${FSMNT}/${PKGTMPDIR}/.${PKGNAME}.deps"
++    PKGNAME="${VAL}"
  
+-        rc_nohalt "touch ${DEPFILE}"
+-        determine_package_dependencies "${PKGNAME}" "${DEPFILE}"
+-        fetch_package_dependencies "${DEPFILE}" "${FSMNT}/${PKGTMPDIR}"
++    # Fetch package + deps, but skip if installing from local media
++    if [ "${INSTALLMEDIUM}" = "ftp" ] ; then
++      DEPFILE="${FSMNT}/${PKGTMPDIR}/.${PKGNAME}.deps"
++      rc_nohalt "touch ${DEPFILE}"
++      determine_package_dependencies "${PKGNAME}" "${DEPFILE}"
++      fetch_package_dependencies "${DEPFILE}" "${FSMNT}/${PKGTMPDIR}"
++    fi
+ 
 -        # If the package is not already installed, install it!
 -        if ! run_chroot_cmd "pkg_info -e ${PKGNAME}"
 -        then
 -          rc_nohalt "pkg_add -C ${FSMNT} ${PKGTMPDIR}/${PKGNAME}.tbz"
-+      # Set package location
-+      case "${INSTALLMEDIUM}" in
-+        usb|dvd|local) PKGPTH="${PKGTMPDIR}/All/${PKGNAME}" ;;
-+                    *) PKGPTH="${PKGTMPDIR}/${PKGNAME}" ;;
-+      esac
-+
-+      # See if we need to determine the package format we are working with
-+      if [ -z "${PKGINFO}" ] ; then
-+ 	tar tqf "${FSMNT}${PKGPTH}" '+MANIFEST' >/dev/null 2>/dev/null	
-+	if [ $? -ne 0 ] ; then
-+          PKGADD="pkg_add -C ${FSMNT}" 
-+          PKGINFO="pkg_info" 
-+        else
-+          PKGADD="pkg -c ${FSMNT} add"
-+	  PKGINFO="pkg info"
-+          bootstrap_pkgng
-         fi
-+      fi
+-        fi
++    # Set package location
++    case "${INSTALLMEDIUM}" in
++      usb|dvd|local) PKGPTH="${PKGTMPDIR}/All/${PKGNAME}" ;;
++                  *) PKGPTH="${PKGTMPDIR}/${PKGNAME}" ;;
++    esac
  
-+      # If the package is not already installed, install it!
-+      if ! run_chroot_cmd "${PKGINFO} -e ${PKGNAME}" >/dev/null 2>/dev/null
-+      then
-+	echo_log "Installing package: ${PKGNAME}"
-+        rc_nohalt "${PKGADD} ${PKGPTH}"
-+      fi
-+
-+      if [ "${INSTALLMEDIUM}" = "ftp" ] ; then
-         rc_nohalt "rm ${DEPFILE}"
+-        rc_nohalt "rm ${DEPFILE}"
++    # See if we need to determine the package format we are working with
++    if [ -z "${PKGINFO}" ] ; then
++      tar tqf "${FSMNT}${PKGPTH}" '+MANIFEST' >/dev/null 2>/dev/null	
++      if [ $? -ne 0 ] ; then
++        PKGADD="pkg_add -C ${FSMNT}" 
++        PKGINFO="pkg_info" 
++      else
++        PKGADD="pkg -c ${FSMNT} add"
++        PKGINFO="pkg info"
++        bootstrap_pkgng
        fi
 +    fi
  
 -      rc_nohalt "cd ${HERE}"
 -    done
-+  done
++    # If the package is not already installed, install it!
++    if ! run_chroot_cmd "${PKGINFO} -e ${PKGNAME}" >/dev/null 2>/dev/null
++    then
++      echo_log "Installing package: ${PKGNAME}"
++      rc_nohalt "${PKGADD} ${PKGPTH}"
++    fi
  
 -  rm -rf "${FSMNT}/${PKGTMPDIR}"
++    if [ "${INSTALLMEDIUM}" = "ftp" ] ; then
++      rc_nohalt "rm ${DEPFILE}"
++    fi
++
++  done
++
++  echo_log "Package installation complete!"
++
 +  # Cleanup after ourselves
 +  rc_halt "cd ${HERE}"
 +  if [ "${INSTALLMEDIUM}" = "ftp" ] ; then
@@ -227,7 +244,7 @@
  
    while read -r line
    do
-@@ -257,20 +257,33 @@
+@@ -257,20 +257,38 @@
  {
    PACKAGE="${1}"
    RES=0
@@ -238,11 +255,16 @@
 +  # If we are on a local medium, we can parse the Latest/ directory
 +  if [ "${INSTALLMEDIUM}" != "ftp" ] ; then
 +    case "${INSTALLMEDIUM}" in
-+      usb|dvd) PKGPTH="${CDMNT}/packages/Latest/${PACKAGE}.${PKGEXT}" ;;
-+        *) PKGPTH="${LOCALPATH}/packages/Latest/${PACKAGE}.${PKGEXT}" ;;
++      usb|dvd) PKGPTH="${CDMNT}/packages" ;; 
++        *) PKGPTH="${LOCALPATH}/packages" ;;
 +    esac
-+    NAME=`ls -al ${PKGPTH} 2>/dev/null | cut -d '>' -f 2 | rev | cut -f1 -d'/' | rev | tr -s ' '`
-+
++    
++    # Check the /Latest dir for generic names, then look for specific version in All/
++    if [ -e "${PKGPTH}/Latest/${PACKAGE}.${PKGEXT}" ] ; then
++       NAME=`ls -al ${PKGPTH}/Latest/${PACKAGE}.${PKGEXT} 2>/dev/null | cut -d '>' -f 2 | rev | cut -f1 -d'/' | rev | tr -s ' '`
++    else
++       NAME=`ls -al ${PKGPTH}/All/${PACKAGE}.${PKGEXT} 2>/dev/null | cut -d '>' -f 2 | rev | cut -f1 -d'/' | rev | tr -s ' '`
++    fi
 +    export VAL="${NAME}"
 +  else
 +    # Doing remote fetch, we we will look up, but some generic names like
@@ -267,7 +289,7 @@
    return ${RES}
  };
  
-@@ -334,7 +347,7 @@
+@@ -334,7 +352,7 @@
    fi
    FTPDIR="${VAL}"
  
@@ -276,7 +298,7 @@
    FTP_SERVER="ftp://${FTPHOST}${FTPDIR}"
  
    if [ ! -f "${SAVEDIR}/${PACKAGE}" ]
-@@ -345,28 +358,49 @@
+@@ -345,28 +363,49 @@
    fi
  };
  



More information about the Commits mailing list