Print this page
    
    
      
        | Split | 
	Close | 
      
      | Expand all | 
      | Collapse all | 
    
    
          --- old/usr/src/lib/brand/lx/zone/lx_boot.ksh
          +++ new/usr/src/lib/brand/lx/zone/lx_boot.ksh
   1    1  #!/bin/ksh -p
   2    2  #
   3    3  # CDDL HEADER START
   4    4  #
   5    5  # The contents of this file are subject to the terms of the
   6    6  # Common Development and Distribution License (the "License").
   7    7  # You may not use this file except in compliance with the License.
   8    8  #
   9    9  # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  10   10  # or http://www.opensolaris.org/os/licensing.
  11   11  # See the License for the specific language governing permissions
  12   12  # and limitations under the License.
  13   13  #    
  14   14  # When distributing Covered Code, include this CDDL HEADER in each
  15   15  # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16   16  # If applicable, add the following below this CDDL HEADER, with the
  17   17  # fields enclosed by brackets "[]" replaced with your own identifying
  18   18  # information: Portions Copyright [yyyy] [name of copyright owner]
  19   19  #    
  20   20  # CDDL HEADER END
  21   21  #
  22   22  #
  23   23  # Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
  24   24  # Copyright 2015, Joyent, Inc.
  25   25  #
  26   26  # lx boot script.
  27   27  #
  28   28  # The arguments to this script are the zone name and the zonepath.
  29   29  #
  30   30  
  31   31  . /usr/lib/brand/shared/common.ksh
  32   32  
  33   33  ZONENAME=$1
  34   34  ZONEPATH=$2
  35   35  ZONEROOT=$ZONEPATH/root
  36   36  
  37   37  w_missing=$(gettext "Warning: \"%s\" is not installed in the global zone")
  38   38  
  39   39  arch=`uname -p`
  40   40  if [ "$arch" = "i386" ]; then
  41   41          ARCH32=i86
  42   42          ARCH64=amd64
  43   43  else
  44   44          echo "Unsupported architecture: $arch"
  45   45          exit 2
  46   46  fi
  47   47  
  48   48  #
  49   49  # Run the lx_support boot hook.
  50   50  #
  51   51  /usr/lib/brand/lx/lx_support boot $ZONEPATH $ZONENAME
  52   52  if (( $? != 0 )) ; then
  53   53          exit 1
  54   54  fi
  55   55  
  56   56  BRANDDIR=/native/usr/lib/brand/lx;
  57   57  EXIT_CODE=1
  58   58  
  59   59  #
  60   60  # Before we boot we validate and fix, if necessary, the required files within
  61   61  # the zone.  These modifications can be lost if a patch or upgrade is applied
  62   62  # within the zone, so we validate and fix the zone every time it boots.
  63   63  #
  64   64  
  65   65  #
  66   66  # Determine the distro.
  67   67  #
  68   68  distro=""
  69   69  if [[ $(zonecfg -z $ZONENAME info attr name=docker) =~ "value: true" ]]; then
  70   70          distro="docker"
  71   71  elif [[ -f $ZONEROOT/etc/redhat-release ]]; then
  72   72          distro="redhat"
  73   73  elif [[ -f $ZONEROOT/etc/lsb-release ]]; then
  74   74          if egrep -s Ubuntu $ZONEROOT/etc/lsb-release; then
  75   75                  distro="ubuntu"
  76   76          elif [[ -f $ZONEROOT/etc/debian_version ]]; then
  77   77                  distro="debian"
  78   78          fi
  79   79  elif [[ -f $ZONEROOT/etc/debian_version ]]; then
  80   80          distro="debian"
  81   81  elif [[ -f $ZONEROOT/etc/alpine-release ]]; then
  82   82          distro="busybox"
  83   83  fi
  84   84  
  85   85  [[ -z $distro ]] && fatal "Unsupported distribution!"
  86   86  
  87   87  #
  88   88  # Perform distro-specific customization.
  89   89  #
  90   90  . $(dirname $0)/lx_boot_zone_${distro}
  91   91  
  92   92  exit 0
  
    | 
      ↓ open down ↓ | 
    92 lines elided | 
    
      ↑ open up ↑ | 
  
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX