Skip to content
Permalink
Browse files

OS-3491 lx_boot should bypass distro detection when 'docker' flag set

Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
  • Loading branch information...
joshwilsdon committed Oct 29, 2014
1 parent bc8b749 commit e7225aa358c52af4e3ba284399ea8b34fb8348df
Showing with 26 additions and 8 deletions.
  1. +5 −3 usr/src/lib/brand/lx/zone/lx_boot.ksh
  2. +21 −5 usr/src/lib/brand/shared/zone/common.ksh
@@ -120,7 +120,9 @@ setup_native_cmd() {
# Determine the distro.
#
distro=""
if [[ -f $ZONEROOT/etc/redhat-release ]]; then
if [[ $(zonecfg -z $ZONENAME info attr name=docker) =~ "value: true" ]]; then
distro="docker"
elif [[ -f $ZONEROOT/etc/redhat-release ]]; then
distro="redhat"
elif [[ -f $ZONEROOT/etc/lsb-release ]]; then
if egrep -s Ubuntu $ZONEROOT/etc/lsb-release; then
@@ -170,8 +172,8 @@ safe_dir /lib
safe_dir /bin
safe_dir /sbin
safe_dir /etc
safe_dir /etc/init
safe_dir /etc/update-motd.d
safe_opt_dir /etc/init
safe_opt_dir /etc/update-motd.d

#
# STEP TWO
@@ -97,9 +97,27 @@ vlog()
safe_dir()
{
typeset dir="$1"
typeset pwd_dir=""

if [[ -h $ZONEROOT/$dir || ! -d $ZONEROOT/$dir ]]; then
fatal "$e_baddir" "$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
}

@@ -110,9 +128,7 @@ safe_opt_dir()

[[ ! -e $ZONEROOT/$dir ]] && return

if [[ -h $ZONEROOT/$dir || ! -d $ZONEROOT/$dir ]]; then
fatal "$e_baddir" "$dir"
fi
safe_dir $dir
}

# Only make a copy if we haven't already done so.

0 comments on commit e7225aa

Please sign in to comment.
You can’t perform that action at this time.