mirror of
https://github.com/fsquillace/junest.git
synced 2026-07-20 17:59:38 +00:00
Refactor _run_proot function
This commit is contained in:
parent
b4dfd79819
commit
91832ba2b8
2 changed files with 8 additions and 6 deletions
|
|
@ -168,19 +168,19 @@ function run_juju_as_root(){
|
|||
}
|
||||
|
||||
function _run_proot(){
|
||||
if ! JUJU_ENV=1 ${@}
|
||||
if ! JUJU_ENV=1 ${PROOT_COMPAT} ${@}
|
||||
then
|
||||
warn "Proot error: Trying to execute proot with PROOT_NO_SECCOMP=1..."
|
||||
JUJU_ENV=1 PROOT_NO_SECCOMP=1 ${@}
|
||||
JUJU_ENV=1 PROOT_NO_SECCOMP=1 ${PROOT_COMPAT} ${@}
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function _run_juju_with_proot(){
|
||||
[ "$(${ID} 2> /dev/null )" == "0" ] && \
|
||||
[ "$(_run_proot ${ID} 2> /dev/null )" == "0" ] && \
|
||||
die "You cannot access with root privileges. Use --root option instead."
|
||||
|
||||
if ! _run_proot ${PROOT_COMPAT} ${@}
|
||||
if ! _run_proot ${@}
|
||||
then
|
||||
die "Error: Check if the juju arguments are correct or use the option juju -p \"-k 3.10\""
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -174,13 +174,15 @@ function test_run_juju_with_proot_as_root(){
|
|||
}
|
||||
|
||||
function test_run_proot_seccomp(){
|
||||
local output=$(_run_proot "env" | grep "^PROOT_NO_SECCOMP")
|
||||
PROOT_COMPAT=env
|
||||
local output=$(_run_proot | grep "^PROOT_NO_SECCOMP")
|
||||
is_equal $output "" || return 1
|
||||
|
||||
envv(){
|
||||
env | grep "^PROOT_NO_SECCOMP"
|
||||
}
|
||||
local output=$(_run_proot "envv" 2> /dev/null | grep "^PROOT_NO_SECCOMP")
|
||||
PROOT_COMPAT=envv
|
||||
local output=$(_run_proot 2> /dev/null | grep "^PROOT_NO_SECCOMP")
|
||||
is_equal $output "PROOT_NO_SECCOMP=1" || return 1
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue