[PC-BSD Commits] r21385 - pcbsd/current/src-sh/warden/scripts/backend

svn at pcbsd.org svn at pcbsd.org
Thu Feb 7 09:50:34 PST 2013


Author: kris
Date: 2013-02-07 17:50:33 +0000 (Thu, 07 Feb 2013)
New Revision: 21385

Modified:
   pcbsd/current/src-sh/warden/scripts/backend/createjail.sh
   pcbsd/current/src-sh/warden/scripts/backend/functions.sh
Log:

Switch warden to use new dist files locations from net, also change
how we save freebsd environment, since dist files are split apart



Modified: pcbsd/current/src-sh/warden/scripts/backend/createjail.sh
===================================================================
--- pcbsd/current/src-sh/warden/scripts/backend/createjail.sh	2013-02-07 15:50:44 UTC (rev 21384)
+++ pcbsd/current/src-sh/warden/scripts/backend/createjail.sh	2013-02-07 17:50:33 UTC (rev 21385)
@@ -9,14 +9,8 @@
 . ${PROGDIR}/scripts/backend/functions.sh
 
 # Location of the chroot environment
-isDirZFS "${JDIR}"
-if [ $? -eq 0 ] ; then
-  WORLDCHROOT="${JDIR}/.warden-chroot-${ARCH}"
-  export WORLDCHROOT
-else
-  WORLDCHROOT="${JDIR}/.warden-chroot-${ARCH}.txz"
-  export WORLDCHROOT
-fi
+WORLDCHROOT="${JDIR}/.warden-chroot-${ARCH}"
+export WORLDCHROOT
 
 setup_linux_jail()
 {
@@ -89,6 +83,7 @@
 # See if we are overriding the default archive file
 if [ ! -z "$ARCHIVEFILE" ] ; then
    WORLDCHROOT="$ARCHIVEFILE"
+   export WORLDCHROOT
 fi
 
 if [ -z "$IP" -o -z "${HOST}" -o -z "$SOURCE" -o -z "${PORTS}" -o -z "${STARTUP}" ] 
@@ -164,7 +159,11 @@
    # Running on UFS
    mkdir -p "${JAILDIR}"
    echo "Installing world..."
-   tar xvf ${WORLDCHROOT} -C "${JAILDIR}" 2>/dev/null
+   if [ -d "${WORLDCHROOT}" ] ; then
+     tar cvf - -C ${WORLDCHROOT} . 2>/dev/null | tar xpvf - -C "${JAILDIR}" 2>/dev/null
+   else
+     tar xvf ${WORLDCHROOT} -C "${JAILDIR}" 2>/dev/null
+   fi
    echo "Done"
 fi
 

Modified: pcbsd/current/src-sh/warden/scripts/backend/functions.sh
===================================================================
--- pcbsd/current/src-sh/warden/scripts/backend/functions.sh	2013-02-07 15:50:44 UTC (rev 21384)
+++ pcbsd/current/src-sh/warden/scripts/backend/functions.sh	2013-02-07 17:50:33 UTC (rev 21385)
@@ -49,10 +49,13 @@
 ### Download the chroot
 downloadchroot() {
 
-  SYSVER="$(pbreg get /PC-BSD/Version)"
-  FBSD_TARBALL="fbsd-release.txz"
-  FBSD_TARBALL_CKSUM="${FBSD_TARBALL}.md5"
+  SYSVER="$(uname -r)"
 
+  local dFiles="base.txz doc.txz games.txz"
+  if [ "$ARCH" = "amd64" ] ; then
+     dFiles="$dFiles lib32.txz"
+  fi
+
   # Set the mirror URL, may be overridden by setting MIRRORURL environment variable
   if [ -z "${MIRRORURL}" ]; then
     get_mirror
@@ -63,17 +66,15 @@
   cd ${JDIR}
 
   echo "Fetching jail environment. This may take a while..."
-  echo "Downloading ${MIRRORURL}/${SYSVER}/${ARCH}/netinstall/${FBSD_TARBALL} ..."
+  for i in $dFiles
+  do
+    echo "Downloading ${MIRRORURL}/${SYSVER}/${ARCH}/dist/${i} ..."
 
-  get_file "${MIRRORURL}/${SYSVER}/${ARCH}/netinstall/${FBSD_TARBALL}" "$FBSD_TARBALL" 3
-  [ $? -ne 0 ] && printerror "Error while downloading the portsjail."
+    get_file "${MIRRORURL}/${SYSVER}/${ARCH}/dist/${i}" "$i" 3
+    [ $? -ne 0 ] && printerror "Error while downloading the freebsd world."
+  done
 
-  get_file "${MIRRORURL}/${SYSVER}/${ARCH}/netinstall/${FBSD_TARBALL_CKSUM}" "$FBSD_TARBALL_CKSUM" 3
-  [ $? -ne 0 ] && printerror "Error while downloading the portsjail."
 
-  [ "$(md5 -q ${FBSD_TARBALL})" != "$(cat ${FBSD_TARBALL_CKSUM})" ] &&
-    printerror "Error in download data, checksum mismatch. Please try again later."
-
   # Creating ZFS dataset?
   isDirZFS "${JDIR}"
   if [ $? -eq 0 ] ; then
@@ -94,18 +95,24 @@
          if [ $? -ne 0 ] ; then exit_err "Failed creating ZFS base dataset"; fi
        fi
     fi
+  else
+    mkdir ${WORLDCHROOT}
+  fi
 
-    tar xvpf ${FBSD_TARBALL} -C ${WORLDCHROOT} 2>/dev/null
-    if [ $? -ne 0 ] ; then exit_err "Failed extracting ZFS chroot environment"; fi
+  # Extract dist files
+  for i in $dFiles
+  do
+    tar xvpf ${i} -C ${WORLDCHROOT} 2>/dev/null
+    if [ $? -ne 0 ] ; then exit_err "Failed extracting freebsd environment"; fi
+    rm ${i}
+  done
 
+  # Create ZFS clean snapshot
+  isDirZFS "${JDIR}"
+  if [ $? -eq 0 ] ; then
     zfs snapshot ${tank}${tMnt}@clean
     if [ $? -ne 0 ] ; then exit_err "Failed creating clean ZFS base snapshot"; fi
-    rm ${FBSD_TARBALL}
-  else
-    # Save the chroot tarball
-    mv ${FBSD_TARBALL} ${WORLDCHROOT}
   fi
-  rm ${FBSD_TARBALL_CKSUM}
 };
 
 



More information about the Commits mailing list