mirror of
https://github.com/fsquillace/junest.git
synced 2026-01-23 02:34:30 +00:00
Remove yaourt package and allow not to copy common etc files
This commit is contained in:
parent
3341187cf6
commit
de0bec9bc5
11 changed files with 292 additions and 198 deletions
19
README.md
19
README.md
|
|
@ -32,7 +32,7 @@ an isolated GNU/Linux environment inside any generic host GNU/Linux OS
|
|||
and without the need to have root privileges for installing packages.
|
||||
|
||||
JuNest contains mainly the package managers (called [pacman](https://wiki.archlinux.org/index.php/Pacman)
|
||||
and a simple [yaourt](https://wiki.archlinux.org/index.php/Yaourt) wrapper called yogurt) that allows to access
|
||||
that allows to access
|
||||
to a wide range of packages from the Arch Linux repositories.
|
||||
|
||||
The main advantages on using JuNest are:
|
||||
|
|
@ -40,7 +40,7 @@ The main advantages on using JuNest are:
|
|||
- Install packages without root privileges.
|
||||
- Partial isolated environment which you can install packages without affecting a production system.
|
||||
- Access to a wide range of packages in particular on GNU/Linux distros that may contain limited repositories (such as CentOS and RedHat).
|
||||
- Available for x86\_64 and ARM architectures but you can build your own image from scratch too!
|
||||
- Available for `x86_64` and `arm` architectures but you can build your own image from scratch too!
|
||||
- Run on a different architecture from the host OS via QEMU
|
||||
- All Arch Linux lovers can have their favourite distro everywhere!
|
||||
|
||||
|
|
@ -104,6 +104,15 @@ Have fun!
|
|||
If you are new on Arch Linux and you are not familiar with `pacman` package manager
|
||||
visit the [pacman rosetta page](https://wiki.archlinux.org/index.php/Pacman_Rosetta).
|
||||
|
||||
JuNest provides a modified version of `makepkg` in `/opt/makepkg/bin` that
|
||||
allows you to build packages from [AUR](https://aur.archlinux.org/) repository.
|
||||
Remember that in order to build package `base-devel` package group is required
|
||||
first:
|
||||
|
||||
```sh
|
||||
pacman -Sy base-devel
|
||||
```
|
||||
|
||||
Installation
|
||||
============
|
||||
|
||||
|
|
@ -217,7 +226,7 @@ junest build [-n]
|
|||
```
|
||||
|
||||
The script will create a directory containing all the essentials
|
||||
files in order to make JuNest working properly (such as pacman, yogurt and proot).
|
||||
files in order to make JuNest working properly (such as `pacman` and `proot`).
|
||||
The option `-n` will skip the final validation tests if they are not needed.
|
||||
Remember that the script to build the image must run in an Arch Linux OS with
|
||||
arch-install-scripts and the base-devel packages installed.
|
||||
|
|
@ -323,12 +332,12 @@ For Arch Linux related FAQs take a look at the [General troubleshooting page](ht
|
|||
|
||||
## Cannot use AUR repository ##
|
||||
|
||||
> **Q**: Why do I get the following error when I try to install a package with yogurt?
|
||||
> **Q**: Why do I get the following error when I try to install a package?
|
||||
|
||||
Cannot find the gzip binary required for compressing man and info pages.
|
||||
|
||||
> **A**: JuNest comes with a very basic number of packages.
|
||||
> In order to install AUR packages via yogurt you need to install the package group `base-devel` first
|
||||
> In order to install AUR packages you need to install the package group `base-devel` first
|
||||
> that contains all the essential packages for compiling from source code (such as gcc, make, patch, etc):
|
||||
|
||||
#> pacman -S --ignore sudo base-devel
|
||||
|
|
|
|||
186
bin/junest
186
bin/junest
|
|
@ -19,8 +19,7 @@ source "${JUNEST_BASE}/lib/core/namespace.sh"
|
|||
source "${JUNEST_BASE}/lib/core/proot.sh"
|
||||
|
||||
|
||||
# TODO give more flexibility for userns to allow not to copy passwd/grops file, etc
|
||||
# TODO think about removing yaourt
|
||||
# TODO Add test that checks that no_copy files works
|
||||
|
||||
###################################
|
||||
### General functions ###
|
||||
|
|
@ -35,31 +34,36 @@ usage() {
|
|||
echo -e "-V, --version Show the $NAME version"
|
||||
echo
|
||||
echo -e "Actions and options:"
|
||||
echo -e " [s]etup "
|
||||
echo -e " -i, --from-file <image> Setup the $NAME image in ${JUNEST_HOME}"
|
||||
echo -e " s[etup] "
|
||||
echo -e " -i, --from-file <image> Setup the $NAME image in ${JUNEST_HOME}"
|
||||
echo -e " -a, --arch <arch> $NAME architecture to download (x86_64, arm)"
|
||||
echo -e " Defaults to the host architecture ($ARCH)"
|
||||
echo -e " -d, --delete Delete $NAME from ${JUNEST_HOME}"
|
||||
echo
|
||||
echo -e " [n]s Access via Linux Namespaces using GRoot (Default action)"
|
||||
echo -e " n[s] Access via Linux Namespaces using GRoot (Default action)"
|
||||
echo -e " -b, --backend-args <args> Arguments for GRoot backend program"
|
||||
echo -e " ($CMD groot -p \"--help\" to check out the GRoot options)"
|
||||
echo -e " -n, --no-copy-files Do not copy common etc files into $NAME environment"
|
||||
echo
|
||||
echo -e " [p]root Access via PRoot"
|
||||
echo -e " p[root] Access via PRoot"
|
||||
echo -e " -f, --fakeroot Run $NAME with fakeroot privileges"
|
||||
echo -e " -b, --backend-args <args> Arguments for PRoot backend program"
|
||||
echo -e " ($CMD proot -p \"--help\" to check out the PRoot options)"
|
||||
echo -e " -n, --no-copy-files Do not copy common etc files into $NAME environment"
|
||||
echo
|
||||
echo -e " [g]root Access with root privileges via GRoot"
|
||||
echo -e " g[root] Access with root privileges via GRoot"
|
||||
echo -e " -b, --backend-args <args> Arguments for GRoot backend program"
|
||||
echo -e " ($CMD groot -p \"--help\" to check out the GRoot options)"
|
||||
echo -e " -n, --no-copy-files Do not copy common etc files into $NAME environment"
|
||||
echo
|
||||
echo -e " [r]oot Access with root privileges via classic chroot"
|
||||
echo -e " r[oot] Access with root privileges via classic chroot"
|
||||
echo -e " -b, --backend-args <args> Arguments for chroot backend program"
|
||||
echo -e " ($CMD root -p \"--help\" to check out the chroot options)"
|
||||
echo -e " -n, --no-copy-files Do not copy common etc files into $NAME environment"
|
||||
echo
|
||||
echo -e " b[uild] Build a $NAME image (must run in ArchLinux)"
|
||||
echo -e " -n, --disable-check Disable the $NAME image check"
|
||||
echo
|
||||
echo -e " [b]uild Build a $NAME image (must run in ArchLinux)"
|
||||
echo -e " -n, --disable-validation Disable the $NAME image validation"
|
||||
}
|
||||
|
||||
version() {
|
||||
|
|
@ -67,9 +71,9 @@ version() {
|
|||
}
|
||||
|
||||
function parse_arguments(){
|
||||
# Actions
|
||||
ACT_SETUP=false
|
||||
ACT_BUILD=false
|
||||
# Actions
|
||||
ACT_SETUP=false
|
||||
ACT_BUILD=false
|
||||
ACT_NAMESPACE=false
|
||||
ACT_PROOT=false
|
||||
ACT_GROOT=false
|
||||
|
|
@ -77,48 +81,74 @@ function parse_arguments(){
|
|||
ACT_HELP=false
|
||||
ACT_VERSION=false
|
||||
|
||||
case "$1" in
|
||||
s|setup) ACT_SETUP=true ; shift ;;
|
||||
b|build) ACT_BUILD=true ; shift ;;
|
||||
n|ns) ACT_NAMESPACE=true ; shift ;;
|
||||
p|proot) ACT_PROOT=true ; shift ;;
|
||||
g|groot) ACT_GROOT=true ; shift ;;
|
||||
r|root) ACT_ROOT=true ; shift ;;
|
||||
-h|--help) ACT_HELP=true ; shift ;;
|
||||
-V|--version) ACT_VERSION=true ; shift ;;
|
||||
*) ACT_NAMESPACE=true ;;
|
||||
esac
|
||||
case "$1" in
|
||||
s|setup) ACT_SETUP=true ; shift ;;
|
||||
b|build) ACT_BUILD=true ; shift ;;
|
||||
n|ns) ACT_NAMESPACE=true ; shift ;;
|
||||
p|proot) ACT_PROOT=true ; shift ;;
|
||||
g|groot) ACT_GROOT=true ; shift ;;
|
||||
r|root) ACT_ROOT=true ; shift ;;
|
||||
-h|--help) ACT_HELP=true ; shift ;;
|
||||
-V|--version) ACT_VERSION=true ; shift ;;
|
||||
*) ACT_NAMESPACE=true ;;
|
||||
esac
|
||||
|
||||
if $ACT_SETUP
|
||||
then
|
||||
_parse_setup_opts "$@"
|
||||
elif $ACT_BUILD
|
||||
then
|
||||
_parse_build_opts "$@"
|
||||
elif $ACT_NAMESPACE
|
||||
then
|
||||
_parse_general_opts "$@"
|
||||
elif $ACT_PROOT
|
||||
then
|
||||
_parse_proot_opts "$@"
|
||||
elif $ACT_GROOT
|
||||
then
|
||||
_parse_general_opts "$@"
|
||||
elif $ACT_ROOT
|
||||
then
|
||||
_parse_general_opts "$@"
|
||||
fi
|
||||
if $ACT_SETUP
|
||||
then
|
||||
_parse_setup_opts "$@"
|
||||
elif $ACT_BUILD
|
||||
then
|
||||
_parse_build_opts "$@"
|
||||
elif $ACT_NAMESPACE
|
||||
then
|
||||
_parse_ns_opts "$@"
|
||||
elif $ACT_PROOT
|
||||
then
|
||||
_parse_proot_opts "$@"
|
||||
elif $ACT_GROOT
|
||||
then
|
||||
_parse_root_opts "$@"
|
||||
elif $ACT_ROOT
|
||||
then
|
||||
_parse_root_opts "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
function _parse_general_opts() {
|
||||
# Options:
|
||||
function _parse_root_opts() {
|
||||
# Options:
|
||||
OPT_BACKEND_ARGS=false
|
||||
BACKEND_ARGS=""
|
||||
OPT_NO_COPY_FILES=false
|
||||
|
||||
while [[ -n "$1" ]]
|
||||
while [[ -n "$1" ]]
|
||||
do
|
||||
case "$1" in
|
||||
-p|--backend-args) OPT_BACKEND_ARGS=true ; shift ; BACKEND_ARGS=$1; shift ;;
|
||||
-b|--backend-args) OPT_BACKEND_ARGS=true ; shift ; BACKEND_ARGS=$1; shift ;;
|
||||
-n|--no-copy-files) OPT_NO_COPY_FILES=true ; shift ;;
|
||||
--) shift ; break ;;
|
||||
-*) die "Invalid option $1" ;;
|
||||
*) break ;;
|
||||
esac
|
||||
done
|
||||
|
||||
ARGS=()
|
||||
for arg in "$@"
|
||||
do
|
||||
ARGS+=("$arg")
|
||||
done
|
||||
}
|
||||
|
||||
function _parse_ns_opts() {
|
||||
# Options:
|
||||
OPT_BACKEND_ARGS=false
|
||||
BACKEND_ARGS=""
|
||||
OPT_NO_COPY_FILES=false
|
||||
|
||||
while [[ -n "$1" ]]
|
||||
do
|
||||
case "$1" in
|
||||
-b|--backend-args) OPT_BACKEND_ARGS=true ; shift ; BACKEND_ARGS=$1; shift ;;
|
||||
-n|--no-copy-files) OPT_NO_COPY_FILES=true ; shift ;;
|
||||
--) shift ; break ;;
|
||||
-*) die "Invalid option $1" ;;
|
||||
*) break ;;
|
||||
|
|
@ -133,16 +163,18 @@ function _parse_general_opts() {
|
|||
}
|
||||
|
||||
function _parse_proot_opts() {
|
||||
# Options:
|
||||
# Options:
|
||||
OPT_FAKEROOT=false
|
||||
OPT_BACKEND_ARGS=false
|
||||
BACKEND_ARGS=""
|
||||
OPT_NO_COPY_FILES=false
|
||||
|
||||
while [[ -n "$1" ]]
|
||||
while [[ -n "$1" ]]
|
||||
do
|
||||
case "$1" in
|
||||
-f|--fakeroot) OPT_FAKEROOT=true ; shift ;;
|
||||
-p|--backend-args) OPT_BACKEND_ARGS=true ; shift ; BACKEND_ARGS=$1; shift ;;
|
||||
-b|--backend-args) OPT_BACKEND_ARGS=true ; shift ; BACKEND_ARGS=$1; shift ;;
|
||||
-n|--no-copy-files) OPT_NO_COPY_FILES=true ; shift ;;
|
||||
--) shift ; break ;;
|
||||
-*) die "Invalid option $1" ;;
|
||||
*) break ;;
|
||||
|
|
@ -157,26 +189,26 @@ function _parse_proot_opts() {
|
|||
}
|
||||
|
||||
function _parse_build_opts() {
|
||||
OPT_DISABLE_VALIDATION=false
|
||||
while [[ -n "$1" ]]
|
||||
OPT_DISABLE_CHECK=false
|
||||
while [[ -n "$1" ]]
|
||||
do
|
||||
case "$1" in
|
||||
-n|--disable-validation) OPT_DISABLE_VALIDATION=true ; shift ;;
|
||||
-n|--disable-check) OPT_DISABLE_CHECK=true ; shift ;;
|
||||
*) die "Invalid option $1" ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
function _parse_setup_opts() {
|
||||
OPT_SETUP_FROM_FILE=false
|
||||
OPT_FROM_FILE=false
|
||||
IMAGE_FILE=""
|
||||
OPT_ARCH=false
|
||||
ARCH_ARG=""
|
||||
OPT_DELETE=false
|
||||
while [[ -n "$1" ]]
|
||||
while [[ -n "$1" ]]
|
||||
do
|
||||
case "$1" in
|
||||
-i|--from-file) OPT_SETUP_FROM_FILE=true ; shift ; IMAGE_FILE=$1 ; shift ;;
|
||||
-i|--from-file) OPT_FROM_FILE=true ; shift ; IMAGE_FILE=$1 ; shift ;;
|
||||
-a|--arch) OPT_ARCH=true ; shift ; ARCH_ARG=$1; shift ;;
|
||||
-d|--delete) OPT_DELETE=true ; shift ;;
|
||||
*) die "Invalid option $1" ;;
|
||||
|
|
@ -189,33 +221,33 @@ function execute_operation() {
|
|||
$ACT_VERSION && version && return
|
||||
|
||||
if $ACT_BUILD; then
|
||||
build_image_env $OPT_DISABLE_VALIDATION
|
||||
build_image_env $OPT_DISABLE_CHECK
|
||||
return
|
||||
fi
|
||||
|
||||
if $ACT_SETUP; then
|
||||
if $OPT_DELETE; then
|
||||
fi
|
||||
|
||||
if $ACT_SETUP; then
|
||||
if $OPT_DELETE; then
|
||||
delete_env
|
||||
else
|
||||
if is_env_installed
|
||||
then
|
||||
die "Error: The image cannot be installed since $JUNEST_HOME is not empty."
|
||||
fi
|
||||
else
|
||||
if is_env_installed
|
||||
then
|
||||
die "Error: The image cannot be installed since $JUNEST_HOME is not empty."
|
||||
fi
|
||||
|
||||
if $OPT_SETUP_FROM_FILE; then
|
||||
setup_env_from_file $IMAGE_FILE
|
||||
else
|
||||
setup_env $ARCH_ARG
|
||||
fi
|
||||
fi
|
||||
if $OPT_FROM_FILE; then
|
||||
setup_env_from_file $IMAGE_FILE
|
||||
else
|
||||
setup_env $ARCH_ARG
|
||||
fi
|
||||
fi
|
||||
|
||||
return
|
||||
return
|
||||
fi
|
||||
|
||||
|
||||
if ! is_env_installed
|
||||
then
|
||||
die "Error: The image is still not installed in $JUNEST_HOME. Run this first: $CMD setup"
|
||||
die "Error: The image is still not installed in $JUNEST_HOME. Run this first: $CMD setup"
|
||||
fi
|
||||
|
||||
local run_env
|
||||
|
|
@ -224,16 +256,16 @@ function execute_operation() {
|
|||
elif $ACT_PROOT; then
|
||||
if $OPT_FAKEROOT; then
|
||||
run_env=run_env_as_fakeroot
|
||||
else
|
||||
else
|
||||
run_env=run_env_as_user
|
||||
fi
|
||||
fi
|
||||
elif $ACT_GROOT; then
|
||||
run_env=run_env_as_groot
|
||||
elif $ACT_ROOT; then
|
||||
run_env=run_env_as_chroot
|
||||
fi
|
||||
|
||||
$run_env "${BACKEND_ARGS}" "${ARGS[@]}"
|
||||
$run_env "${BACKEND_ARGS}" $OPT_NO_COPY_FILES "${ARGS[@]}"
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ pacman --noconfirm -S $(pacman -Sg base-devel | cut -d ' ' -f 2 | grep -v sudo)
|
|||
|
||||
info "Checking basic executables work..."
|
||||
pacman -Qi pacman 1> /dev/null
|
||||
yogurt -V 1> /dev/null
|
||||
/opt/makepkg/bin/makepkg --help 1> /dev/null
|
||||
/opt/proot/proot-$ARCH --help 1> /dev/null
|
||||
|
||||
repo_package1=tree
|
||||
|
|
@ -71,7 +71,13 @@ if ! $SKIP_AUR_TESTS
|
|||
then
|
||||
aur_package=aurutils
|
||||
info "Checking ${aur_package} package from AUR repo..."
|
||||
yogurt -A --noconfirm -S ${aur_package}
|
||||
maindir=$(mktemp -d -t ${CMD}.XXXXXXXXXX)
|
||||
builtin cd ${maindir}
|
||||
curl -L -J -O -k "https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=${aur_package}"
|
||||
curl -L -J -O -k "https://aur.archlinux.org/cgit/aur.git/plain/${aur_package}.install?h=${aur_package}"
|
||||
/opt/makepkg/bin/makepkg -sfcd
|
||||
|
||||
pacman --noconfirm -U ${aur_package}*.pkg.tar.xz
|
||||
aur search aur 1> /dev/null
|
||||
pacman --noconfirm -Rsn ${aur_package}
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -54,30 +54,26 @@ function build_image_env(){
|
|||
info "Installing pacman and its dependencies..."
|
||||
# The archlinux-keyring and libunistring are due to missing dependencies declaration in ARM archlinux
|
||||
# All the essential executables (ln, mkdir, chown, etc) are in coreutils
|
||||
# yaourt requires sed
|
||||
# localedef (called by locale-gen) requires gzip
|
||||
# unshare command belongs to util-linux
|
||||
sudo pacstrap -G -M -d ${maindir}/root pacman coreutils libunistring archlinux-keyring sed gzip util-linux
|
||||
sudo pacstrap -G -M -d ${maindir}/root pacman coreutils libunistring archlinux-keyring util-linux
|
||||
sudo bash -c "echo 'Server = $DEFAULT_MIRROR' >> ${maindir}/root/etc/pacman.d/mirrorlist"
|
||||
sudo mkdir -p ${maindir}/root/run/lock
|
||||
|
||||
# AUR packages requires non-root user to be compiled. proot fakes the user to 10
|
||||
info "Compiling and installing yaourt..."
|
||||
_install_pkg_from_aur ${maindir} "package-query"
|
||||
_install_pkg_from_aur ${maindir} "yaourt"
|
||||
_install_pkg ${maindir} "$JUNEST_BASE/pkgs/sudo-fake"
|
||||
|
||||
info "Install ${NAME} script..."
|
||||
sudo pacman --noconfirm --root ${maindir}/root -S git
|
||||
_install_pkg_from_aur ${maindir} "${CMD}-git" "${CMD}.install"
|
||||
sudo pacman --noconfirm --root ${maindir}/root -Rsn git
|
||||
|
||||
info "Generating the locales..."
|
||||
# sed command is required for locale-gen
|
||||
# localedef (called by locale-gen) requires gzip
|
||||
sudo pacman --noconfirm --root ${maindir}/root -S sed gzip
|
||||
sudo ln -sf /usr/share/zoneinfo/posix/UTC ${maindir}/root/etc/localtime
|
||||
sudo bash -c "echo 'en_US.UTF-8 UTF-8' >> ${maindir}/root/etc/locale.gen"
|
||||
sudo ${maindir}/root/opt/junest/bin/groot ${maindir}/root locale-gen
|
||||
sudo bash -c "echo LANG=\"en_US.UTF-8\" >> ${maindir}/root/etc/locale.conf"
|
||||
sudo pacman --noconfirm --root ${maindir}/root -Rsn sed gzip
|
||||
|
||||
info "Setting up the pacman keyring (this might take a while!)..."
|
||||
sudo ${maindir}/root/opt/junest/bin/groot -b /dev ${maindir}/root bash -c \
|
||||
|
|
@ -95,8 +91,9 @@ function build_image_env(){
|
|||
then
|
||||
mkdir -p ${maindir}/root_test
|
||||
$TAR -zxpf ${imagefile} -C "${maindir}/root_test"
|
||||
JUNEST_HOME="${maindir}/root_test" ${maindir}/root_test/opt/${CMD}/bin/${CMD} -f ${JUNEST_BASE}/lib/checks/check.sh
|
||||
JUNEST_HOME="${maindir}/root_test" sudo -E ${maindir}/root_test/opt/${CMD}/bin/${CMD} -g ${JUNEST_BASE}/lib/checks/check.sh --run-root-tests
|
||||
JUNEST_HOME="${maindir}/root_test" ${JUNEST_BASE}/bin/${CMD} proot -f ${JUNEST_BASE}/lib/checks/check.sh
|
||||
JUNEST_HOME="${maindir}/root_test" ${JUNEST_BASE}/bin/${CMD} ns ${JUNEST_BASE}/lib/checks/check.sh
|
||||
JUNEST_HOME="${maindir}/root_test" sudo -E ${JUNEST_BASE}/bin/${CMD} groot ${JUNEST_BASE}/lib/checks/check.sh --run-root-tests
|
||||
fi
|
||||
|
||||
sudo cp ${maindir}/output/${imagefile} ${ORIGIN_WD}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,8 @@
|
|||
function _run_env_as_xroot(){
|
||||
local cmd=$1
|
||||
local backend_args="$2"
|
||||
shift 2
|
||||
local no_copy_files="$3"
|
||||
shift 3
|
||||
|
||||
check_same_arch
|
||||
|
||||
|
|
@ -26,7 +27,10 @@ function _run_env_as_xroot(){
|
|||
trap - QUIT EXIT ABRT KILL TERM INT
|
||||
trap "[ -z $uid ] || chown_cmd -R ${uid} ${JUNEST_HOME};" EXIT QUIT ABRT KILL TERM INT
|
||||
|
||||
copy_common_files
|
||||
if ! $no_copy_files
|
||||
then
|
||||
copy_common_files
|
||||
fi
|
||||
|
||||
JUNEST_ENV=1 $cmd $backend_args "$JUNEST_HOME" "${SH[@]}" "-c" "${main_cmd}"
|
||||
}
|
||||
|
|
@ -41,8 +45,10 @@ function _run_env_as_xroot(){
|
|||
# SUDO_GID (RO) : The sudo group ID.
|
||||
# SH (RO) : Contains the default command to run in JuNest.
|
||||
# Arguments:
|
||||
# backend_args ($1) : The arguments to pass to proot
|
||||
# cmd ($2-?) : The command to run inside JuNest environment.
|
||||
# backend_args ($1) : The arguments to pass to backend program
|
||||
# no_copy_files ($2?) : If false it will copy some files in /etc
|
||||
# from host to JuNest environment.
|
||||
# cmd ($3-?) : The command to run inside JuNest environment.
|
||||
# Default command is defined by SH variable.
|
||||
# Returns:
|
||||
# $ARCHITECTURE_MISMATCH : If host and JuNest architecture are different.
|
||||
|
|
@ -53,13 +59,14 @@ function run_env_as_groot(){
|
|||
check_nested_env
|
||||
|
||||
local backend_args="$1"
|
||||
shift
|
||||
local no_copy_files="$2"
|
||||
shift 2
|
||||
|
||||
provide_common_bindings
|
||||
local bindings=${RESULT}
|
||||
unset RESULT
|
||||
|
||||
_run_env_as_xroot "$GROOT $bindings" "$backend_args" "$@"
|
||||
_run_env_as_xroot "$GROOT $bindings" "$backend_args" "$no_copy_files" "$@"
|
||||
}
|
||||
|
||||
#######################################
|
||||
|
|
@ -72,8 +79,10 @@ function run_env_as_groot(){
|
|||
# SUDO_GID (RO) : The sudo group ID.
|
||||
# SH (RO) : Contains the default command to run in JuNest.
|
||||
# Arguments:
|
||||
# backend_args ($1) : The arguments to pass to proot
|
||||
# cmd ($2-?) : The command to run inside JuNest environment.
|
||||
# backend_args ($1) : The arguments to pass to backend program
|
||||
# no_copy_files ($2?) : If false it will copy some files in /etc
|
||||
# from host to JuNest environment.
|
||||
# cmd ($3-?) : The command to run inside JuNest environment.
|
||||
# Default command is defined by SH variable.
|
||||
# Returns:
|
||||
# $ARCHITECTURE_MISMATCH : If host and JuNest architecture are different.
|
||||
|
|
@ -84,7 +93,8 @@ function run_env_as_chroot(){
|
|||
check_nested_env
|
||||
|
||||
local backend_args="$1"
|
||||
shift
|
||||
local no_copy_files="$2"
|
||||
shift 2
|
||||
|
||||
_run_env_as_xroot chroot_cmd "$backend_args" "$@"
|
||||
_run_env_as_xroot chroot_cmd "$backend_args" "$no_copy_files" "$@"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,8 +84,10 @@ function _run_env_with_namespace(){
|
|||
# GROOT (RO) : The groot program.
|
||||
# SH (RO) : Contains the default command to run in JuNest.
|
||||
# Arguments:
|
||||
# backend_args ($1) : The arguments to pass to proot
|
||||
# cmd ($2-?) : The command to run inside JuNest environment.
|
||||
# backend_args ($1) : The arguments to pass to groot
|
||||
# no_copy_files ($2?) : If false it will copy some files in /etc
|
||||
# from host to JuNest environment.
|
||||
# cmd ($3-?) : The command to run inside JuNest environment.
|
||||
# Default command is defined by SH variable.
|
||||
# Returns:
|
||||
# $ARCHITECTURE_MISMATCH : If host and JuNest architecture are different.
|
||||
|
|
@ -97,18 +99,23 @@ function run_env_with_namespace() {
|
|||
check_nested_env
|
||||
|
||||
local backend_args="$1"
|
||||
shift
|
||||
local no_copy_files="$2"
|
||||
shift 2
|
||||
|
||||
_check_user_namespace
|
||||
|
||||
check_same_arch
|
||||
|
||||
copy_common_files
|
||||
copy_file /etc/hosts.equiv
|
||||
copy_file /etc/netgroup
|
||||
copy_file /etc/networks
|
||||
# No need for localtime as it is setup during the image build
|
||||
#copy_file /etc/localtime
|
||||
copy_passwd_and_group
|
||||
if ! $no_copy_files
|
||||
then
|
||||
copy_common_files
|
||||
copy_file /etc/hosts.equiv
|
||||
copy_file /etc/netgroup
|
||||
copy_file /etc/networks
|
||||
# No need for localtime as it is setup during the image build
|
||||
#copy_file /etc/localtime
|
||||
copy_passwd_and_group
|
||||
fi
|
||||
|
||||
_run_env_with_namespace "$backend_args" "$@"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,9 @@ function _run_env_with_qemu(){
|
|||
# SH (RO) : Contains the default command to run in JuNest.
|
||||
# Arguments:
|
||||
# backend_args ($1) : The arguments to pass to proot
|
||||
# cmd ($2-?) : The command to run inside JuNest environment.
|
||||
# no_copy_files ($2?) : If false it will copy some files in /etc
|
||||
# from host to JuNest environment.
|
||||
# cmd ($3-?) : The command to run inside JuNest environment.
|
||||
# Default command is defined by SH variable.
|
||||
# Returns:
|
||||
# $ROOT_ACCESS_ERROR : If the user is the real root.
|
||||
|
|
@ -62,9 +64,13 @@ function run_env_as_fakeroot(){
|
|||
check_nested_env
|
||||
|
||||
local backend_args="$1"
|
||||
shift
|
||||
local no_copy_files="$2"
|
||||
shift 2
|
||||
|
||||
copy_common_files
|
||||
if ! $no_copy_files
|
||||
then
|
||||
copy_common_files
|
||||
fi
|
||||
|
||||
provide_common_bindings
|
||||
local bindings=${RESULT}
|
||||
|
|
@ -84,7 +90,9 @@ function run_env_as_fakeroot(){
|
|||
# SH (RO) : Contains the default command to run in JuNest.
|
||||
# Arguments:
|
||||
# backend_args ($1) : The arguments to pass to proot
|
||||
# cmd ($2-?) : The command to run inside JuNest environment.
|
||||
# no_copy_files ($2?) : If false it will copy some files in /etc
|
||||
# from host to JuNest environment.
|
||||
# cmd ($3-?) : The command to run inside JuNest environment.
|
||||
# Default command is defined by SH variable.
|
||||
# Returns:
|
||||
# $ROOT_ACCESS_ERROR : If the user is the real root.
|
||||
|
|
@ -97,19 +105,23 @@ function run_env_as_user(){
|
|||
check_nested_env
|
||||
|
||||
local backend_args="$1"
|
||||
shift
|
||||
local no_copy_files="$2"
|
||||
shift 2
|
||||
|
||||
# Files to bind are visible in `proot --help`.
|
||||
# This function excludes /etc/mtab file so that
|
||||
# it will not give conflicts with the related
|
||||
# symlink in the Arch Linux image.
|
||||
copy_common_files
|
||||
copy_file /etc/hosts.equiv
|
||||
copy_file /etc/netgroup
|
||||
copy_file /etc/networks
|
||||
# No need for localtime as it is setup during the image build
|
||||
#copy_file /etc/localtime
|
||||
copy_passwd_and_group
|
||||
if ! $no_copy_files
|
||||
then
|
||||
# Files to bind are visible in `proot --help`.
|
||||
# This function excludes /etc/mtab file so that
|
||||
# it will not give conflicts with the related
|
||||
# symlink in the Arch Linux image.
|
||||
copy_common_files
|
||||
copy_file /etc/hosts.equiv
|
||||
copy_file /etc/netgroup
|
||||
copy_file /etc/networks
|
||||
# No need for localtime as it is setup during the image build
|
||||
#copy_file /etc/localtime
|
||||
copy_passwd_and_group
|
||||
fi
|
||||
|
||||
provide_common_bindings
|
||||
local bindings=${RESULT}
|
||||
|
|
|
|||
|
|
@ -35,44 +35,44 @@ function init_mocks() {
|
|||
}
|
||||
|
||||
function test_run_env_as_groot_cmd(){
|
||||
assertCommandSuccess run_env_as_groot "" pwd
|
||||
assertCommandSuccess run_env_as_groot "" "false" pwd
|
||||
assertEquals "chroot_cmd -b $HOME -b /tmp -b /proc -b /sys -b /dev $JUNEST_HOME /bin/sh --login -c pwd" "$(cat $STDOUTF)"
|
||||
}
|
||||
|
||||
function test_run_env_as_groot_no_cmd(){
|
||||
assertCommandSuccess run_env_as_groot ""
|
||||
assertCommandSuccess run_env_as_groot "" "false" ""
|
||||
assertEquals "chroot_cmd -b $HOME -b /tmp -b /proc -b /sys -b /dev $JUNEST_HOME /bin/sh --login -c /bin/sh --login" "$(cat $STDOUTF)"
|
||||
}
|
||||
|
||||
function test_run_env_as_groot_nested_env(){
|
||||
JUNEST_ENV=1
|
||||
assertCommandFailOnStatus 106 run_env_as_groot ""
|
||||
assertCommandFailOnStatus 106 run_env_as_groot "" "false" ""
|
||||
unset JUNEST_ENV
|
||||
}
|
||||
|
||||
function test_run_env_as_groot_cmd_with_backend_args(){
|
||||
assertCommandSuccess run_env_as_groot "-n -b /home/blah" pwd
|
||||
assertCommandSuccess run_env_as_groot "-n -b /home/blah" "false" pwd
|
||||
assertEquals "chroot_cmd -b $HOME -b /tmp -b /proc -b /sys -b /dev -n -b /home/blah $JUNEST_HOME /bin/sh --login -c pwd" "$(cat $STDOUTF)"
|
||||
}
|
||||
|
||||
function test_run_env_as_chroot_cmd(){
|
||||
assertCommandSuccess run_env_as_chroot "" pwd
|
||||
assertCommandSuccess run_env_as_chroot "" "false" pwd
|
||||
assertEquals "chroot_cmd $JUNEST_HOME /bin/sh --login -c pwd" "$(cat $STDOUTF)"
|
||||
}
|
||||
|
||||
function test_run_env_as_chroot_no_cmd(){
|
||||
assertCommandSuccess run_env_as_chroot ""
|
||||
assertCommandSuccess run_env_as_chroot "" "false" ""
|
||||
assertEquals "chroot_cmd $JUNEST_HOME /bin/sh --login -c /bin/sh --login" "$(cat $STDOUTF)"
|
||||
}
|
||||
|
||||
function test_run_env_as_choot_nested_env(){
|
||||
JUNEST_ENV=1
|
||||
assertCommandFailOnStatus 106 run_env_as_chroot ""
|
||||
assertCommandFailOnStatus 106 run_env_as_chroot "" "false" ""
|
||||
unset JUNEST_ENV
|
||||
}
|
||||
|
||||
function test_run_env_as_chroot_cmd_with_backend_args(){
|
||||
assertCommandSuccess run_env_as_chroot "-n -b /home/blah" pwd
|
||||
assertCommandSuccess run_env_as_chroot "-n -b /home/blah" "false" pwd
|
||||
assertEquals "chroot_cmd -n -b /home/blah $JUNEST_HOME /bin/sh --login -c pwd" "$(cat $STDOUTF)"
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,8 +25,8 @@ function version(){
|
|||
echo "version"
|
||||
}
|
||||
function build_image_env(){
|
||||
local disable_validation=$1
|
||||
echo "build_image_env($disable_validation)"
|
||||
local disable_check=$1
|
||||
echo "build_image_env($disable_check)"
|
||||
}
|
||||
function delete_env(){
|
||||
echo "delete_env"
|
||||
|
|
@ -39,24 +39,33 @@ function setup_env(){
|
|||
}
|
||||
function run_env_as_fakeroot(){
|
||||
local backend_args="$1"
|
||||
shift
|
||||
echo "run_env_as_fakeroot($backend_args,$@)"
|
||||
local no_copy_files="$2"
|
||||
shift 2
|
||||
echo "run_env_as_fakeroot($backend_args,$no_copy_files,$@)"
|
||||
}
|
||||
function run_env_as_groot(){
|
||||
echo "run_env_as_groot $@"
|
||||
local backend_args="$1"
|
||||
local no_copy_files="$2"
|
||||
shift 2
|
||||
echo "run_env_as_groot($backend_args,$no_copy_files,$@)"
|
||||
}
|
||||
function run_env_as_chroot(){
|
||||
echo "run_env_as_chroot $@"
|
||||
local backend_args="$1"
|
||||
local no_copy_files="$2"
|
||||
shift 2
|
||||
echo "run_env_as_chroot($backend_args,$no_copy_files,$@)"
|
||||
}
|
||||
function run_env_as_user(){
|
||||
local backend_args="$1"
|
||||
shift
|
||||
echo "run_env_as_user($backend_args,$@)"
|
||||
local no_copy_files="$2"
|
||||
shift 2
|
||||
echo "run_env_as_user($backend_args,$no_copy_files,$@)"
|
||||
}
|
||||
function run_env_with_namespace(){
|
||||
local backend_args="$1"
|
||||
shift
|
||||
echo "run_env_with_namespace($backend_args,$@)"
|
||||
local no_copy_files="$2"
|
||||
shift 2
|
||||
echo "run_env_with_namespace($backend_args,$no_copy_files,$@)"
|
||||
}
|
||||
|
||||
function test_help(){
|
||||
|
|
@ -78,7 +87,7 @@ function test_build_image_env(){
|
|||
assertEquals "build_image_env(false)" "$(cat $STDOUTF)"
|
||||
assertCommandSuccess main b -n
|
||||
assertEquals "build_image_env(true)" "$(cat $STDOUTF)"
|
||||
assertCommandSuccess main build --disable-validation
|
||||
assertCommandSuccess main build --disable-check
|
||||
assertEquals "build_image_env(true)" "$(cat $STDOUTF)"
|
||||
}
|
||||
|
||||
|
|
@ -124,18 +133,20 @@ function test_setup_env(){
|
|||
|
||||
function test_run_env_as_fakeroot(){
|
||||
assertCommandSuccess main p -f
|
||||
assertEquals "run_env_as_fakeroot(,)" "$(cat $STDOUTF)"
|
||||
assertEquals "run_env_as_fakeroot(,false,)" "$(cat $STDOUTF)"
|
||||
assertCommandSuccess main proot --fakeroot
|
||||
assertEquals "run_env_as_fakeroot(,)" "$(cat $STDOUTF)"
|
||||
assertEquals "run_env_as_fakeroot(,false,)" "$(cat $STDOUTF)"
|
||||
assertCommandSuccess main p -f -n
|
||||
assertEquals "run_env_as_fakeroot(,true,)" "$(cat $STDOUTF)"
|
||||
|
||||
assertCommandSuccess main proot -f -p "-b arg"
|
||||
assertEquals "run_env_as_fakeroot(-b arg,)" "$(cat $STDOUTF)"
|
||||
assertCommandSuccess main proot -f -p "-b arg" -- command -kv
|
||||
assertEquals "run_env_as_fakeroot(-b arg,command -kv)" "$(cat $STDOUTF)"
|
||||
assertCommandSuccess main proot -f -b "-b arg"
|
||||
assertEquals "run_env_as_fakeroot(-b arg,false,)" "$(cat $STDOUTF)"
|
||||
assertCommandSuccess main proot -f -b "-b arg" -- command -kv
|
||||
assertEquals "run_env_as_fakeroot(-b arg,false,command -kv)" "$(cat $STDOUTF)"
|
||||
assertCommandSuccess main proot -f command --as
|
||||
assertEquals "run_env_as_fakeroot(,command --as)" "$(cat $STDOUTF)"
|
||||
assertEquals "run_env_as_fakeroot(,false,command --as)" "$(cat $STDOUTF)"
|
||||
assertCommandSuccess main proot -f -- command --as
|
||||
assertEquals "run_env_as_fakeroot(,command --as)" "$(cat $STDOUTF)"
|
||||
assertEquals "run_env_as_fakeroot(,false,command --as)" "$(cat $STDOUTF)"
|
||||
|
||||
is_env_installed(){
|
||||
return 1
|
||||
|
|
@ -145,16 +156,18 @@ function test_run_env_as_fakeroot(){
|
|||
|
||||
function test_run_env_as_user(){
|
||||
assertCommandSuccess main proot
|
||||
assertEquals "run_env_as_user(,)" "$(cat $STDOUTF)"
|
||||
assertEquals "run_env_as_user(,false,)" "$(cat $STDOUTF)"
|
||||
assertCommandSuccess main p -n
|
||||
assertEquals "run_env_as_user(,true,)" "$(cat $STDOUTF)"
|
||||
|
||||
assertCommandSuccess main proot -p "-b arg"
|
||||
assertEquals "run_env_as_user(-b arg,)" "$(cat $STDOUTF)"
|
||||
assertCommandSuccess main proot -p "-b arg" -- command -ll
|
||||
assertEquals "run_env_as_user(-b arg,command -ll)" "$(cat $STDOUTF)"
|
||||
assertCommandSuccess main proot -b "-b arg"
|
||||
assertEquals "run_env_as_user(-b arg,false,)" "$(cat $STDOUTF)"
|
||||
assertCommandSuccess main proot -b "-b arg" -- command -ll
|
||||
assertEquals "run_env_as_user(-b arg,false,command -ll)" "$(cat $STDOUTF)"
|
||||
assertCommandSuccess main proot command -ls
|
||||
assertEquals "run_env_as_user(,command -ls)" "$(cat $STDOUTF)"
|
||||
assertEquals "run_env_as_user(,false,command -ls)" "$(cat $STDOUTF)"
|
||||
assertCommandSuccess main proot -- command -ls
|
||||
assertEquals "run_env_as_user(,command -ls)" "$(cat $STDOUTF)"
|
||||
assertEquals "run_env_as_user(,false,command -ls)" "$(cat $STDOUTF)"
|
||||
|
||||
is_env_installed(){
|
||||
return 1
|
||||
|
|
@ -164,11 +177,15 @@ function test_run_env_as_user(){
|
|||
|
||||
function test_run_env_as_groot(){
|
||||
assertCommandSuccess main g
|
||||
assertEquals "run_env_as_groot " "$(cat $STDOUTF)"
|
||||
assertEquals "run_env_as_groot(,false,)" "$(cat $STDOUTF)"
|
||||
assertCommandSuccess main g -n
|
||||
assertEquals "run_env_as_groot(,true,)" "$(cat $STDOUTF)"
|
||||
assertCommandSuccess main g -b "-b arg"
|
||||
assertEquals "run_env_as_groot(-b arg,false,)" "$(cat $STDOUTF)"
|
||||
assertCommandSuccess main groot command
|
||||
assertEquals "run_env_as_groot command" "$(cat $STDOUTF)"
|
||||
assertEquals "run_env_as_groot(,false,command)" "$(cat $STDOUTF)"
|
||||
assertCommandSuccess main groot -- command
|
||||
assertEquals "run_env_as_groot command" "$(cat $STDOUTF)"
|
||||
assertEquals "run_env_as_groot(,false,command)" "$(cat $STDOUTF)"
|
||||
|
||||
is_env_installed(){
|
||||
return 1
|
||||
|
|
@ -178,11 +195,13 @@ function test_run_env_as_groot(){
|
|||
|
||||
function test_run_env_as_chroot(){
|
||||
assertCommandSuccess main r
|
||||
assertEquals "run_env_as_chroot " "$(cat $STDOUTF)"
|
||||
assertEquals "run_env_as_chroot(,false,)" "$(cat $STDOUTF)"
|
||||
assertCommandSuccess main r -b "-b arg"
|
||||
assertEquals "run_env_as_chroot(-b arg,false,)" "$(cat $STDOUTF)"
|
||||
assertCommandSuccess main root command
|
||||
assertEquals "run_env_as_chroot command" "$(cat $STDOUTF)"
|
||||
assertEquals "run_env_as_chroot(,false,command)" "$(cat $STDOUTF)"
|
||||
assertCommandSuccess main root -- command
|
||||
assertEquals "run_env_as_chroot command" "$(cat $STDOUTF)"
|
||||
assertEquals "run_env_as_chroot(,false,command)" "$(cat $STDOUTF)"
|
||||
|
||||
is_env_installed(){
|
||||
return 1
|
||||
|
|
@ -192,32 +211,34 @@ function test_run_env_as_chroot(){
|
|||
|
||||
function test_run_env_with_namespace(){
|
||||
assertCommandSuccess main n
|
||||
assertEquals "run_env_with_namespace(,)" "$(cat $STDOUTF)"
|
||||
assertEquals "run_env_with_namespace(,false,)" "$(cat $STDOUTF)"
|
||||
assertCommandSuccess main ns
|
||||
assertEquals "run_env_with_namespace(,)" "$(cat $STDOUTF)"
|
||||
assertEquals "run_env_with_namespace(,false,)" "$(cat $STDOUTF)"
|
||||
assertCommandSuccess main ns -n
|
||||
assertEquals "run_env_with_namespace(,true,)" "$(cat $STDOUTF)"
|
||||
|
||||
assertCommandSuccess main ns -p "-b arg"
|
||||
assertEquals "run_env_with_namespace(-b arg,)" "$(cat $STDOUTF)"
|
||||
assertCommandSuccess main ns -p "-b arg" -- command -kv
|
||||
assertEquals "run_env_with_namespace(-b arg,command -kv)" "$(cat $STDOUTF)"
|
||||
assertCommandSuccess main ns -b "-b arg"
|
||||
assertEquals "run_env_with_namespace(-b arg,false,)" "$(cat $STDOUTF)"
|
||||
assertCommandSuccess main ns -b "-b arg" -- command -kv
|
||||
assertEquals "run_env_with_namespace(-b arg,false,command -kv)" "$(cat $STDOUTF)"
|
||||
assertCommandSuccess main ns command --as
|
||||
assertEquals "run_env_with_namespace(,command --as)" "$(cat $STDOUTF)"
|
||||
assertEquals "run_env_with_namespace(,false,command --as)" "$(cat $STDOUTF)"
|
||||
assertCommandSuccess main ns -- command --as
|
||||
assertEquals "run_env_with_namespace(,command --as)" "$(cat $STDOUTF)"
|
||||
assertEquals "run_env_with_namespace(,false,command --as)" "$(cat $STDOUTF)"
|
||||
|
||||
assertCommandSuccess main
|
||||
assertEquals "run_env_with_namespace(,)" "$(cat $STDOUTF)"
|
||||
assertEquals "run_env_with_namespace(,false,)" "$(cat $STDOUTF)"
|
||||
assertCommandSuccess main
|
||||
assertEquals "run_env_with_namespace(,)" "$(cat $STDOUTF)"
|
||||
assertEquals "run_env_with_namespace(,false,)" "$(cat $STDOUTF)"
|
||||
|
||||
assertCommandSuccess main -p "-b arg"
|
||||
assertEquals "run_env_with_namespace(-b arg,)" "$(cat $STDOUTF)"
|
||||
assertCommandSuccess main -p "-b arg" -- command -kv
|
||||
assertEquals "run_env_with_namespace(-b arg,command -kv)" "$(cat $STDOUTF)"
|
||||
assertCommandSuccess main -b "-b arg"
|
||||
assertEquals "run_env_with_namespace(-b arg,false,)" "$(cat $STDOUTF)"
|
||||
assertCommandSuccess main -b "-b arg" -- command -kv
|
||||
assertEquals "run_env_with_namespace(-b arg,false,command -kv)" "$(cat $STDOUTF)"
|
||||
assertCommandSuccess main command --as
|
||||
assertEquals "run_env_with_namespace(,command --as)" "$(cat $STDOUTF)"
|
||||
assertEquals "run_env_with_namespace(,false,command --as)" "$(cat $STDOUTF)"
|
||||
assertCommandSuccess main -- command --as
|
||||
assertEquals "run_env_with_namespace(,command --as)" "$(cat $STDOUTF)"
|
||||
assertEquals "run_env_with_namespace(,false,command --as)" "$(cat $STDOUTF)"
|
||||
|
||||
is_env_installed(){
|
||||
return 1
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ function test_is_user_namespace_enabled_with_userns_clone_file_enabled(){
|
|||
}
|
||||
|
||||
function test_run_env_with_namespace() {
|
||||
assertCommandSuccess run_env_with_namespace "" ""
|
||||
assertCommandSuccess run_env_with_namespace "" "false" ""
|
||||
assertEquals "unshare --mount --user --map-root-user $GROOT --no-umount --recursive -b $HOME -b /tmp -b /proc -b /sys -b /dev $JUNEST_HOME /bin/sh --login" "$(cat $STDOUTF)"
|
||||
|
||||
_test_copy_common_files
|
||||
|
|
@ -108,7 +108,7 @@ function test_run_env_with_namespace() {
|
|||
}
|
||||
|
||||
function test_run_env_with_namespace_with_bindings() {
|
||||
assertCommandSuccess run_env_with_namespace "-b /usr -b /lib:/tmp/lib" ""
|
||||
assertCommandSuccess run_env_with_namespace "-b /usr -b /lib:/tmp/lib" "false" ""
|
||||
assertEquals "unshare --mount --user --map-root-user $GROOT --no-umount --recursive -b $HOME -b /tmp -b /proc -b /sys -b /dev -b /usr -b /lib:/tmp/lib $JUNEST_HOME /bin/sh --login" "$(cat $STDOUTF)"
|
||||
|
||||
_test_copy_common_files
|
||||
|
|
@ -116,7 +116,7 @@ function test_run_env_with_namespace_with_bindings() {
|
|||
}
|
||||
|
||||
function test_run_env_with_namespace_with_command() {
|
||||
assertCommandSuccess run_env_with_namespace "" "ls -la"
|
||||
assertCommandSuccess run_env_with_namespace "" "false" "ls -la"
|
||||
assertEquals "unshare --mount --user --map-root-user $GROOT --no-umount --recursive -b $HOME -b /tmp -b /proc -b /sys -b /dev $JUNEST_HOME /bin/sh --login -c \"ls -la\"" "$(cat $STDOUTF)"
|
||||
|
||||
_test_copy_common_files
|
||||
|
|
@ -124,7 +124,7 @@ function test_run_env_with_namespace_with_command() {
|
|||
}
|
||||
|
||||
function test_run_env_with_namespace_with_bindings_and_command() {
|
||||
assertCommandSuccess run_env_with_namespace "-b /usr -b /lib:/tmp/lib" "ls -la"
|
||||
assertCommandSuccess run_env_with_namespace "-b /usr -b /lib:/tmp/lib" "false" "ls -la"
|
||||
assertEquals "unshare --mount --user --map-root-user $GROOT --no-umount --recursive -b $HOME -b /tmp -b /proc -b /sys -b /dev -b /usr -b /lib:/tmp/lib $JUNEST_HOME /bin/sh --login -c \"ls -la\"" "$(cat $STDOUTF)"
|
||||
|
||||
_test_copy_common_files
|
||||
|
|
@ -133,7 +133,7 @@ function test_run_env_with_namespace_with_bindings_and_command() {
|
|||
|
||||
function test_run_env_with_namespace_nested_env(){
|
||||
JUNEST_ENV=1
|
||||
assertCommandFailOnStatus 106 run_env_with_namespace ""
|
||||
assertCommandFailOnStatus 106 run_env_with_namespace "" "false" ""
|
||||
unset JUNEST_ENV
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,11 +51,11 @@ function test_run_env_as_user(){
|
|||
_run_env_with_qemu() {
|
||||
echo $@
|
||||
}
|
||||
assertCommandSuccess run_env_as_user "-k 3.10" "/usr/bin/mkdir" "-v" "/newdir2"
|
||||
assertCommandSuccess run_env_as_user "-k 3.10" "false" "/usr/bin/mkdir" "-v" "/newdir2"
|
||||
assertEquals "-b $HOME -b /tmp -b /proc -b /sys -b /dev -r ${JUNEST_HOME} -k 3.10 /usr/bin/mkdir -v /newdir2" "$(cat $STDOUTF)"
|
||||
|
||||
SH=("/usr/bin/echo")
|
||||
assertCommandSuccess run_env_as_user "-k 3.10"
|
||||
assertCommandSuccess run_env_as_user "-k 3.10" "false"
|
||||
assertEquals "-b $HOME -b /tmp -b /proc -b /sys -b /dev -r ${JUNEST_HOME} -k 3.10" "$(cat $STDOUTF)"
|
||||
|
||||
_test_copy_common_files
|
||||
|
|
@ -64,7 +64,7 @@ function test_run_env_as_user(){
|
|||
|
||||
function test_run_env_as_user_nested_env(){
|
||||
JUNEST_ENV=1
|
||||
assertCommandFailOnStatus 106 run_env_as_user ""
|
||||
assertCommandFailOnStatus 106 run_env_as_user "" "false"
|
||||
unset JUNEST_ENV
|
||||
}
|
||||
|
||||
|
|
@ -72,11 +72,11 @@ function test_run_env_as_fakeroot(){
|
|||
_run_env_with_qemu() {
|
||||
echo $@
|
||||
}
|
||||
assertCommandSuccess run_env_as_fakeroot "-k 3.10" "/usr/bin/mkdir" "-v" "/newdir2"
|
||||
assertCommandSuccess run_env_as_fakeroot "-k 3.10" "false" "/usr/bin/mkdir" "-v" "/newdir2"
|
||||
assertEquals "-0 -b ${HOME} -b /tmp -b /proc -b /sys -b /dev -r ${JUNEST_HOME} -k 3.10 /usr/bin/mkdir -v /newdir2" "$(cat $STDOUTF)"
|
||||
|
||||
SH=("/usr/bin/echo")
|
||||
assertCommandSuccess run_env_as_fakeroot "-k 3.10"
|
||||
assertCommandSuccess run_env_as_fakeroot "-k 3.10" "false"
|
||||
assertEquals "-0 -b ${HOME} -b /tmp -b /proc -b /sys -b /dev -r ${JUNEST_HOME} -k 3.10" "$(cat $STDOUTF)"
|
||||
|
||||
_test_copy_common_files
|
||||
|
|
@ -84,7 +84,7 @@ function test_run_env_as_fakeroot(){
|
|||
|
||||
function test_run_env_as_fakeroot_nested_env(){
|
||||
JUNEST_ENV=1
|
||||
assertCommandFailOnStatus 106 run_env_as_fakeroot ""
|
||||
assertCommandFailOnStatus 106 run_env_as_fakeroot "" "false" ""
|
||||
unset JUNEST_ENV
|
||||
}
|
||||
|
||||
|
|
@ -92,7 +92,7 @@ function test_run_env_with_quotes(){
|
|||
_run_env_with_qemu() {
|
||||
echo $@
|
||||
}
|
||||
assertCommandSuccess run_env_as_user "-k 3.10" "bash" "-c" "/usr/bin/mkdir -v /newdir2"
|
||||
assertCommandSuccess run_env_as_user "-k 3.10" "false" "bash" "-c" "/usr/bin/mkdir -v /newdir2"
|
||||
assertEquals "-b ${HOME} -b /tmp -b /proc -b /sys -b /dev -r ${JUNEST_HOME} -k 3.10 bash -c /usr/bin/mkdir -v /newdir2" "$(cat $STDOUTF)"
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue