This commit is contained in:
Filippo Squillace 2015-01-06 00:16:12 +01:00
parent 5ebc099249
commit 4cf8cadd20
2 changed files with 8 additions and 30 deletions

View file

@ -68,10 +68,7 @@ else
die "Unknown architecture ${ARCH}"
fi
PROOT_BIN="${JUJU_HOME}/usr/bin/proot"
PROOT_COMPAT_BIN="${JUJU_HOME}/opt/proot/proot-${ARCH}"
PROOT="$LD_LIB --library-path ${JUJU_HOME}/usr/lib:${JUJU_HOME}/lib ${PROOT_BIN}"
PROOT_COMPAT="${PROOT_COMPAT_BIN}"
PROOT_COMPAT="${JUJU_HOME}/opt/proot/proot-${ARCH}"
PROOT_LINK=http://static.proot.me/proot-${ARCH}
SH="/bin/sh --login"
@ -183,13 +180,9 @@ function _run_juju_with_proot(){
[ "$(${ID} 2> /dev/null )" == "0" ] && \
die "You cannot access with root privileges. Use --root option instead."
if ! _run_proot ${PROOT} ${@}
if ! _run_proot ${PROOT_COMPAT} ${@}
then
warn "Proot error: Trying to execute proot compatible binary..."
if ! _run_proot ${PROOT_COMPAT} ${@}
then
die "Error: Check if the juju arguments are correct or use the option juju -p \"-k 3.10\""
fi
die "Error: Check if the juju arguments are correct or use the option juju -p \"-k 3.10\""
fi
}
@ -272,12 +265,6 @@ function build_image_juju(){
makepkg -sfc --asroot
pacman --noconfirm --root ${maindir}/root -U yaourt*.pkg.tar.xz
info "Compiling and installing proot..."
builtin cd ${maindir}/packages/proot
download https://aur.archlinux.org/packages/pr/proot/PKGBUILD
makepkg -sfcA --asroot
pacman --noconfirm --root ${maindir}/root -U proot*.pkg.tar.xz
info "Installing compatibility binary proot"
mkdir -p ${maindir}/root/opt/proot
builtin cd ${maindir}/root/opt/proot

View file

@ -112,13 +112,13 @@ function test_run_juju_as_root(){
function test_run_juju_as_user(){
install_mini_juju
local output=$(run_juju_as_user "-k 3.10" "/usr/bin/mkdir -v /newdir2" 2> /dev/null | awk -F: '{print $1}')
local output=$(run_juju_as_user "-k 3.10" "/usr/bin/mkdir -v /newdir2" | awk -F: '{print $1}')
is_equal "$output" "/usr/bin/mkdir" || return 1
[ -e $JUJU_HOME/newdir2 ]
is_equal $? 0 || return 1
SH="/usr/bin/mkdir -v /newdir"
local output=$(run_juju_as_user "-k 3.10" 2> /dev/null | awk -F: '{print $1}')
local output=$(run_juju_as_user "-k 3.10" | awk -F: '{print $1}')
is_equal "$output" "/usr/bin/mkdir" || return 1
[ -e $JUJU_HOME/newdir ]
is_equal $? 0 || return 1
@ -138,7 +138,6 @@ function test_run_juju_as_user_proot_args(){
export -f _run_proot
export -f warn
export -f die
export PROOT
export PROOT_COMPAT
ID="/bin/echo 1" bash -ic "_run_juju_with_proot --helps" &> /dev/null
is_equal $? 1 || return 1
@ -146,18 +145,10 @@ function test_run_juju_as_user_proot_args(){
export -n _run_proot
export -n warn
export -n die
export -n PROOT
export -n PROOT_COMPAT
}
function test_run_juju_with_proot_with_compat(){
install_mini_juju
PROOT="/bin/true"
PROOT_COMPAT="/bin/false"
_run_juju_with_proot "" "" &> /dev/null
is_equal $? 0 || return 1
PROOT="/bin/false"
function test_run_juju_with_proot_compat(){
PROOT_COMPAT="/bin/true"
_run_juju_with_proot "" "" &> /dev/null
is_equal $? 0 || return 1
@ -166,7 +157,7 @@ function test_run_juju_with_proot_with_compat(){
export -f _run_proot
export -f warn
export -f die
PROOT="/bin/false" PROOT_COMPAT="/bin/false" ID="/bin/echo 1" bash -ic "_run_juju_with_proot --helps" &> /dev/null
PROOT_COMPAT="/bin/false" ID="/bin/echo 1" bash -ic "_run_juju_with_proot --helps" &> /dev/null
is_equal $? 1 || return 1
export -n _run_juju_with_proot
export -n _run_proot
@ -195,7 +186,7 @@ function test_run_proot_seccomp(){
function test_run_juju_as_fakeroot(){
install_mini_juju
local output=$(run_juju_as_fakeroot "-k 3.10" "id" 2> /dev/null | awk '{print $1}')
local output=$(run_juju_as_fakeroot "-k 3.10" "id" | awk '{print $1}')
is_equal "$output" "uid=0(root)" || return 1
}