mrrl

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

commit 7d8bbd2b8dc64e3da0bfc18c9d1c11b00414440c
parent eee056fab5fbb8511de9785f6f2fa75aad2a3374
Author: Jan Pobříslo <ccx@te2000.cz>
Date:   Fri, 23 Feb 2024 18:36:49 +0100

pthbs-enter package for setting up enviroments

Diffstat:
Mpackages/default.environment | 1+
Apackages/pthbs-enter | 79+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mpackages/userspace.environment | 1+
Atemplates/pkg/pthbs-enter | 31+++++++++++++++++++++++++++++++
Mtemplates/pkg/userspace.environment | 1+
5 files changed, 113 insertions(+), 0 deletions(-)

diff --git a/packages/default.environment b/packages/default.environment @@ -18,6 +18,7 @@ #+s6-networking.d30d0310f70a9af097cc2d98e7a97e329a626b005cb0b49247ce6cdaec251956 #+zsh.841d7010e0fe14991eb6173c03fd35eecda23c9693da65d121af20615e0dc5a0 #+pthbs-banginstall.849e1bc924bc7d9eff0c2ce1c3a44bf38afbf6b2a5f1dfbea7c077f886646e7b +#+pthbs-enter.b6e9f4cb7524c9f93f66a71a63373fb63bd0d97d4a79d70ad4266d429badfe49 #+aat.9da7c8dd0936f2dcfd534a0473da1b730e29946cdd4db133659a1a35f0b53144 #+confz.4d0086594f647e7ab869714ca88253442d1b40f5f66312579521708a9e7cf24e #+containers.b5344393dbacc75ea943cf9119959cad0fc7c7272f7760b99ca67f3d48f7cf09 diff --git a/packages/pthbs-enter b/packages/pthbs-enter @@ -0,0 +1,79 @@ +#!/usr/bin/env pthbs-build +#+busybox.62e4b1201b20ef0faf051b0e9b3ad1d3fbf4d498b8a0910ce4845a9017323f62 +#+s6.be82395a9f4e8e0e08dc9900d7b4959e46db9d13d68355a6c5afebaf9237beb4 +#+execline.09706e0446392c1dc9f3d83c47704aadb8ec15c063317d139d0143cf59349b0f + +envpath=${PATH%%:*} +case "$envpath" in + (*.env/command) ;; + (*) + printf "Error: '%s' doesn't look like environment path!\n" "$envpath" + printf "PATH='%s'\n" "$PATH" + exit 2;; +esac +test -x "$envpath/execlineb" || exit $? +test -x "$envpath/s6-envdir" || exit $? +envdir=$(dirname "$envpath")/env +test -f "$envdir/env/PATH" + +installdir="$pthbs_destdir//home/ccx/versions/$pthbs_package" +mkdir -p "$installdir/command" +cat >"$installdir/command/pthbs-enter" <<EOF +#!$envpath/execlineb -S0 +"$envpath/s6-envdir" "$envdir" "$envpath/exec" "$0" +EOF +chmod +x "$installdir/command/pthbs-enter" +"$installdir/command/pthbs-enter" true + +cd "$pthbs_destdir/home/ccx/versions/$pthbs_package" +find -type d -o -print | awk -F/ ' +BEGIN { + x["./command/pthbs-banginstall"]=1 +} + +function r1(s) { + sub("^[.]/[^/]*", ".", s) + return s +} +function s1(repl, s) { + sub("^[.]/[^/]*", "./"repl, s) + return s +} +function link(src) { + x[$0]=0 + printf "%s\t%s\n", $0, src + printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr" +} +$1!="."{exit 1} + + +$2 == "command" { link($0); next } +$2 == "bin" { link(s1("command", $0)); next } + +$2 == "library.so" { link($0); next } +$2 == "library" { link($0); next } +$2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next } +$2 == "lib" && $NF ~ /\.so(|\..*)$/ { link(s1("library.so", $0)); next } + +$2 == "share" && $3 ~ /^(info|man|doc|icons|terminfo)$/ { link(r1($0)); next } + +$2 == "man" { link($0); next } +$2 == "info" { link($0); next } +$2 == "doc" { link($0); next } +$2 == "icons" { link($0); next } +$2 == "terminfo" { link($0); next } + +$2 == "include" { link($0); next } + +{ printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" } + +END { + for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" } + for(fname in x) { + if(x[fname]) { + printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr" + exit 3 + } + } +}' >.install-links.new +mv .install-links.new .install-links diff --git a/packages/userspace.environment b/packages/userspace.environment @@ -18,6 +18,7 @@ #+s6-networking.d30d0310f70a9af097cc2d98e7a97e329a626b005cb0b49247ce6cdaec251956 #+zsh.841d7010e0fe14991eb6173c03fd35eecda23c9693da65d121af20615e0dc5a0 #+pthbs-banginstall.849e1bc924bc7d9eff0c2ce1c3a44bf38afbf6b2a5f1dfbea7c077f886646e7b +#+pthbs-enter.b6e9f4cb7524c9f93f66a71a63373fb63bd0d97d4a79d70ad4266d429badfe49 #+aat.9da7c8dd0936f2dcfd534a0473da1b730e29946cdd4db133659a1a35f0b53144 #+confz.4d0086594f647e7ab869714ca88253442d1b40f5f66312579521708a9e7cf24e #+containers.b5344393dbacc75ea943cf9119959cad0fc7c7272f7760b99ca67f3d48f7cf09 diff --git a/templates/pkg/pthbs-enter b/templates/pkg/pthbs-enter @@ -0,0 +1,31 @@ +{% extends "genlinks" %} +{%- block script %} +#+{{pkg_install_name("busybox")}} +#+{{pkg_install_name("s6")}} +#+{{pkg_install_name("execline")}} + +envpath=${PATH%%:*} +case "$envpath" in + (*.env/command) ;; + (*) + printf "Error: '%s' doesn't look like environment path!\n" "$envpath" + printf "PATH='%s'\n" "$PATH" + exit 2;; +esac +test -x "$envpath/execlineb" || exit $? +test -x "$envpath/s6-envdir" || exit $? +envdir=$(dirname "$envpath")/env +test -f "$envdir/env/PATH" + +installdir="$pthbs_destdir/{{versions}}/$pthbs_package" +mkdir -p "$installdir/command" +cat >"$installdir/command/pthbs-enter" <<EOF +#!$envpath/execlineb -S0 +"$envpath/s6-envdir" "$envdir" "$envpath/exec" "$0" +EOF +chmod +x "$installdir/command/pthbs-enter" +"$installdir/command/pthbs-enter" true +{% endblock %} +{% block genlinks_begin %} + x["./command/pthbs-banginstall"]=1 +{% endblock %} diff --git a/templates/pkg/userspace.environment b/templates/pkg/userspace.environment @@ -18,6 +18,7 @@ #+{{pkg_install_name("s6-networking")}} #+{{pkg_install_name("zsh")}} #+{{pkg_install_name("pthbs-banginstall")}} +#+{{pkg_install_name("pthbs-enter")}} #+{{pkg_install_name("aat")}} #+{{pkg_install_name("confz")}} #+{{pkg_install_name("containers")}}