mrrl

Minimal Reliable Reproducible Linux
git clone https://ccx.te2000.cz/git/mrrl
Log | Files | Refs | Submodules | README

commit b4bbe8b95092e910ef4dee5b3e4ddb02adf6a795
parent 898352564b99a70b49ee1b319f6a9d2267d7e68d
Author: ccx <ccx@te2000.cz>
Date:   Wed, 28 Feb 2024 19:16:28 +0000

Environment setup

Diffstat:
Mcommand/pthbs-build | 11++++-------
Mcommand/pthbs-enter-gen | 17+++++++++++++++--
2 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/command/pthbs-build b/command/pthbs-build @@ -201,15 +201,12 @@ function at_filehash(hash_type, file_hash, dst, dstdir){ printf "%s\n", "chown -R \"$pthbs_uid:$pthbs_gid\" "q(ENVIRON["workdir"]) } if(length(ENVIRON["envdir"])){ + cmd="env pthbs_build_environment="q(ENVIRON["envdir"]) + cmd=cmd" "sandbox_cmd if(settings["set_path"]) { - cmd=sandbox_cmd" "q(ENVIRON["envdir"]"/command/env") - cmd=cmd" pthbs_build_environment="q(ENVIRON["envdir"]) - cmd=cmd" PATH="q(ENVIRON["envdir"]"/command") - cmd=cmd" "q(ENVIRON["envdir"]"/command/sh")" -xe "q(ENVIRON["script"]) - } else { - cmd="env "q(ENVIRON["envdir"]"/command/env") - cmd=" sh -xe "q(ENVIRON["script"]) + cmd=cmd" "q(ENVIRON["envdir"]"/command/pthbs-enter") } + cmd=cmd" sh -xe "q(ENVIRON["script"]) } else { cmd=sandbox_cmd" sh -xe "q(ENVIRON["script"]) } diff --git a/command/pthbs-enter-gen b/command/pthbs-enter-gen @@ -17,20 +17,33 @@ case $(basename "$envtop") in exit 1;; esac +mkdir -p "$envdir" + if ! test -d "$envcommand"; then printf >&2 "Error: '%s' doesn't exist!\n" "$envcommand" fi -mkdir -p "$envdir" printf '%s\n' "$envcommand" >"$envdir/PATH" + if test -d "$envtop/zsh"; then printf '%s\n' "$envtop/zsh/site-functions:$envtop/zsh/functions" >"$envdir/FPATH" fi +if test -d "$envtop/library/pkgconfig"; then + printf '%s\n' "$envtop/library/pkgconfig" >"$envdir/PKG_CONFIG_LIBDIR" +fi + if test -x "$envcommand/execlineb" && test -x "$envcommand/s6-envdir"; then cat >"$exe" <<EOF #!$envcommand/execlineb -S0 "$envcommand/s6-envdir" "$envdir" "$envcommand/exec" \$@ EOF chmod +x "$exe" - "$exe" true + "$exe" true # TODO: don't run executables without sandbox +elif test -x "$envcommand/sh" && test -x "$envcommand/envdir"; then + cat >"$exe" <<EOF +#!$envcommand/sh +exec "$envcommand/envdir" "$envdir" "$envcommand/env" -- "\$@" +EOF + chmod +x "$exe" + "$exe" true # TODO: don't run executables without sandbox fi