Print this page
OS-3489 lxbrand 64bit LTP recvmsg01 hangs - cmsghdr size mismatch
OS-3491 lx_boot should bypass distro detection when 'docker' flag set
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
OS-3023 lx brand installer cleanup
        
*** 17,26 ****
--- 17,27 ----
  # information: Portions Copyright [yyyy] [name of copyright owner]
  #
  # CDDL HEADER END
  #
  # Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+ # Copyright 2014, Joyent, Inc. All rights reserved.
  #
  
  #
  # Send the error message to the screen and to the logfile.
  #
*** 94,119 ****
  #       safe_dir /foo/bar/baz
  #
  safe_dir()
  {
          typeset dir="$1"
  
!         if [[ -h $ZONEROOT/$dir || ! -d $ZONEROOT/$dir ]]; then
!                 fatal "$e_baddir" "$dir"
          fi
  }
  
  # Like safe_dir except the dir doesn't have to exist.
  safe_opt_dir()
  {
          typeset dir="$1"
  
          [[ ! -e $ZONEROOT/$dir ]] && return
  
!         if [[ -h $ZONEROOT/$dir || ! -d $ZONEROOT/$dir ]]; then
!                 fatal "$e_baddir" "$dir"
!         fi
  }
  
  # Only make a copy if we haven't already done so.
  safe_backup()
  {
--- 95,136 ----
  #       safe_dir /foo/bar/baz
  #
  safe_dir()
  {
          typeset dir="$1"
+         typeset pwd_dir=""
  
!         if [[ -d $ZONEROOT/$dir ]]; then
!                 if [[ -h $ZONEROOT/$dir ]]; then
!                         #
!                         # When dir is a symlink to a directory, we 'cd' to that
!                         # directory to ensure that's under $ZONEROOT. We use pwd
!                         # from /usr/bin instead of built-in because they give
!                         # different results.
!                         #
!                         pwd_dir=$(cd $ZONEROOT/$dir && /usr/bin/pwd)
!                         if [[ $pwd_dir =~ "^$ZONEROOT" ]]; then
!                                 return;
!                         else
!                                 fatal \
!                                     "$e_baddir: symlink out of zoneroot" "$dir"
                          fi
+                 else
+                         # it's a dir and not a symlink, so that's ok.
+                         return
+                 fi
+         fi
  }
  
  # Like safe_dir except the dir doesn't have to exist.
  safe_opt_dir()
  {
          typeset dir="$1"
  
          [[ ! -e $ZONEROOT/$dir ]] && return
  
!         safe_dir $dir
  }
  
  # Only make a copy if we haven't already done so.
  safe_backup()
  {
*** 185,195 ****
          if [ $rem = "remove" ]; then
                  rm -f $filename
          fi
  
          cat <<-END >$filename || exit 1
!         #!/bin/sh -p
          #
          # Solaris Brand Replacement
          #
          # Attention.  This file has been replaced with a new version for
          # use in a virtualized environment.  Modification of this script is not
--- 202,212 ----
          if [ $rem = "remove" ]; then
                  rm -f $filename
          fi
  
          cat <<-END >$filename || exit 1
!         #!/bin/sh
          #
          # Solaris Brand Replacement
          #
          # Attention.  This file has been replaced with a new version for
          # use in a virtualized environment.  Modification of this script is not