Permalink
Browse files

Fix adding source / ports when creating new jails

  • Loading branch information...
1 parent 1aede14 commit aba318785f1011934e8f75561d0dd8def06793b8 @kmoore134 kmoore134 committed Feb 14, 2014
Showing with 12 additions and 7 deletions.
  1. +3 −1 src-sh/warden/bin/warden
  2. +9 −6 src-sh/warden/scripts/backend/createjail.sh
@@ -1150,6 +1150,7 @@ defaultrouter-ipv6) DEFAULTROUTER="${4}"
IP4="OFF"
IP6="OFF"
SRC="NO"
+ SOURCE="NO"
PORTS="NO"
AUTOSTART="NO"
VANILLA="NO"
@@ -1167,7 +1168,7 @@ defaultrouter-ipv6) DEFAULTROUTER="${4}"
IP6="${1}"
;;
- --src) SRC="YES" ;;
+ --src) SRC="YES" ; SOURCE="YES" ;;
--ports) PORTS="YES" ;;
--startauto) AUTOSTART="YES" ;;
--vanilla) VANILLA="YES" ;;
@@ -1234,6 +1235,7 @@ defaultrouter-ipv6) DEFAULTROUTER="${4}"
export IP4
export IP6
export SRC
+ export SOURCE
export PORTS
export AUTOSTART
export JAILTYPE
@@ -90,8 +90,6 @@ esac
# See if we need to create a default template
# If using a ARCHIVEFILE we can skip this step
if [ -z "$TEMPLATE" -a -z "$ARCHIVEFILE" ] ; then
- which uname
- uname -r
DEFTEMPLATE="`uname -r | cut -d '-' -f 1-2`-${ARCH}"
echo "DEF: $DEFTEMPLATE"
@@ -269,11 +267,16 @@ if [ "$PORTS" = "YES" ]
then
echo "Fetching ports..."
mkdir -p "${JAILDIR}/usr/ports"
- cat /usr/sbin/portsnap | sed 's|! -t 0|-z '1'|g' | /bin/sh -s "fetch" "extract" "update" "-p" "${JAILDIR}/usr/ports" >/dev/null 2>/dev/null
- if [ $? -eq 0 ] ; then
- echo "Done"
+ cd ${JAILDIR}
+ SYSVER="$(uname -r | cut -d '-' -f 1-2)"
+ get_file_from_mirrors "/${SYSVER}/${ARCH}/dist/ports.txz" "ports.txz" "iso"
+ if [ $? -ne 0 ] ; then
+ echo "Error while downloading the ports tree."
else
- echo "Failed! Please run \"portsnap fetch extract update\" within the jail."
+ echo "Extracting ports.. May take a while.."
+ tar xvf ports.txz -C "${JAILDIR}" 2>/dev/null
+ rm ports.txz
+ echo "Done"
fi
fi

0 comments on commit aba3187

Please sign in to comment.