pthbs_genpkgpy

Template engine for producing packages for pthbs written using Python and Jinja
git clone https://ccx.te2000.cz/git/pthbs_genpkgpy
Log | Files | Refs | Submodules | README

commit eea43c3571f54a66695a78c6b1b154943084e3a6
parent b5c38f4154cfc6e36ab17300457eaab16f2fffb5
Author: ccx <ccx@te2000.cz>
Date:   Thu,  7 Mar 2024 19:01:52 +0000

add environment to init

Diffstat:
MREADME | 1+
Mpackages/core-system-conf | 6+++---
Mpackages/core-system-init | 17++++++++++++++---
Mpackages/core-system-rc | 4++--
Mpackages/default.environment | 6+++---
Mtemplates/pkg/core-system-init | 13++++++++++++-
6 files changed, 35 insertions(+), 12 deletions(-)

diff --git a/README b/README @@ -92,6 +92,7 @@ Planned features * build sandbox with segregated build users using only packaged software * fully reproducible builds +* bootstrap sanboxing binaries * rewrite Python package generator into something easier to bootstrap with on POSIX-ish system (AWK?) diff --git a/packages/core-system-conf b/packages/core-system-conf @@ -12,7 +12,7 @@ #+s6-rc.6cefe2791153127e0a783521ab97f3b124f023f21cdc2eddadbb865496ad0b45 #+s6.bb3974d7b49c2034b5064bac508beae2d4bfc1a7b6543aefcbc1af9e9e94f1a7 #+zsh.762204e14953017be79e356d4bf9f7681625a750ecc951f3510bf144ea7b51bb -#@git:c5749fff4c5653b40568de4753a309c7e9e8d80e:core-system-conf +#@git:eea35c1b742ef1e5637c84a2f2e4720172513f4b:core-system-conf def_prefix() { prefix=/versions/$pthbs_package @@ -40,8 +40,8 @@ linkdep() { cd 'core-system-conf' printf '%s\n' >config/etc/motd \ "Welcome to $(cat ./config/hostname)!" \ - 'Current running configuration was generated from core-system-conf:c5749fff4c5653b40568de4753a309c7e9e8d80e' \ - 'Last change on 2024-03-07 17:41:40 +0000 by ccx' + 'Current running configuration was generated from core-system-conf:eea35c1b742ef1e5637c84a2f2e4720172513f4b' \ + 'Last change on 2024-03-07 17:54:03 +0000 by ccx' env 'pthbs_path_core-system-conf'="$prefix" \ 'pthbs_path_containers=/versions/containers.environment.5c638a60055f057e241390ce3f606b4555427cd47c09becd05c48c29ca76d8bb' \ diff --git a/packages/core-system-init b/packages/core-system-init @@ -5,9 +5,9 @@ #+s6-portable-utils.39f4babb8cd30769f1a931708e5442244b0305c36ddafe32348c7dc30c000b00 #+s6-linux-init.396413eed542c149346f51a569f2d686c03b2104f4d062f52422e444ad9b502d #+execline.9d9d14aad09d9643f578727ab1ed3363b975772358c4ac8e756abdad4fca7a3d -#+core-system-rc.2a5717ff1a0ecdabeac3e5d7f5f51a2069cf1582e5707317252c38bb1b609323 +#+core-system-rc.522e47e850abfbd15de410d6a46db41ea65792560b27c05fd3528650393ed85a -s6rcdb=/versions/core-system-rc.2a5717ff1a0ecdabeac3e5d7f5f51a2069cf1582e5707317252c38bb1b609323/s6-rc-db +s6rcdb=/versions/core-system-rc.522e47e850abfbd15de410d6a46db41ea65792560b27c05fd3528650393ed85a/s6-rc-db prefix=/versions/$pthbs_package pkgdir="$pthbs_destdir/$prefix" @@ -30,8 +30,9 @@ qx() { mkdir -p "$pthbs_destdir//versions" s6-linux-init-maker \ -p "/run/current/command:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" \ - -G "$(q "prefix/deps/command/env") TERM=linux $(q "prefix/deps/command/getty") 38400 tty9" \ + -G "$(q "$prefix/deps/command/env") TERM=linux $(q "$prefix/deps/command/getty") 38400 tty9" \ -t 1 \ + -N \ -c "$prefix" \ "$pkgdir" @@ -44,6 +45,16 @@ qx getty qx execlineb el=$prefix/deps/command/$name +# Rewrite bin/init as it fails finding it's own s6-linux-init +s6-cat >"$pkgdir/bin/init.new" <<EOF || exit $? +#!$el -S0 +$(qx pthbs-enter) +$(qx s6-envdir) -I /run/current/env +EOF +s6-cat >>"$pkgdir/bin/init.new" <"$pkgdir/bin/init" +chmod +x "$pkgdir/bin/init.new" +mv -v "$pkgdir/bin/init.new" "$pkgdir/bin/init" + # Rewrite dynamically generated scripts s6-cat >"$pkgdir/scripts/rc.init" <<EOF || exit $? #!$el -S1 diff --git a/packages/core-system-rc b/packages/core-system-rc @@ -3,7 +3,7 @@ #+busybox-diffutils.4f5a07b29246414b77a7d71b103263af8f1249d75ddcbd9864e00def3d6feded #+s6-rc.6cefe2791153127e0a783521ab97f3b124f023f21cdc2eddadbb865496ad0b45 #+fileset.22d9abf3009dbbfe507bd7ff93fdd0bf7f86ee0bc317b37b423b89d70ab950a2 -#+core-system-conf.60994dadd57b391b13346d1c6fab4226f6e5a9f289353a0d342c3afaec68a91a +#+core-system-conf.54f31fbd0960366e896aba0dd69a155177a496d2bdf7fe197a7f02259a0157a2 def_prefix() { prefix=/versions/$pthbs_package @@ -13,7 +13,7 @@ def_dest() { } def_dest -src=/versions/core-system-conf.60994dadd57b391b13346d1c6fab4226f6e5a9f289353a0d342c3afaec68a91a/config/s6-rc-source +src=/versions/core-system-conf.54f31fbd0960366e896aba0dd69a155177a496d2bdf7fe197a7f02259a0157a2/config/s6-rc-source s6-rc-compile ./s6-rc-db "$src" mkdir -p "$dest/config" mv -v s6-rc-db "$dest/config/" diff --git a/packages/default.environment b/packages/default.environment @@ -1,7 +1,7 @@ -#+core-system-conf.60994dadd57b391b13346d1c6fab4226f6e5a9f289353a0d342c3afaec68a91a -#+core-system-rc.2a5717ff1a0ecdabeac3e5d7f5f51a2069cf1582e5707317252c38bb1b609323 +#+core-system-conf.54f31fbd0960366e896aba0dd69a155177a496d2bdf7fe197a7f02259a0157a2 +#+core-system-rc.522e47e850abfbd15de410d6a46db41ea65792560b27c05fd3528650393ed85a #+core-system-scripts.132a3b1c6b226dee79156049db1244ebeacdf5a4bfcffc74b6b97175dad000fd -#+core-system-init.15f0de38e7a20145c67f5c829feac2edc0406713936279885f4792a08bd81e6d +#+core-system-init.46d9ac7fde7f9d2d7307809f8f99e098463bd7c560275cbe36ff6ae63e516bc4 #+busybox.e60885fe93ee85c01831673bb29f0e62a64903f4ce3094e3dc35bc8ec8887ad9 #+gnu-make.782c9e6625fd7420e2cd38b847afed19db3b3844cae8a0426a0dbf73e10d78e5 #+musl-cross-make.65f98305f5666435bf0c6b9ccedffae2179ff1b3286752756886f760cf7771d2 diff --git a/templates/pkg/core-system-init b/templates/pkg/core-system-init @@ -31,8 +31,9 @@ qx() { mkdir -p "$pthbs_destdir/{{versions}}" s6-linux-init-maker \ -p "/run/current/command:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" \ - -G "$(q "prefix/deps/command/env") TERM=linux $(q "prefix/deps/command/getty") 38400 tty9" \ + -G "$(q "$prefix/deps/command/env") TERM=linux $(q "$prefix/deps/command/getty") 38400 tty9" \ -t 1 \ + -N \ -c "$prefix" \ "$pkgdir" @@ -45,6 +46,16 @@ qx getty qx execlineb el=$prefix/deps/command/$name +# Rewrite bin/init as it fails finding it's own s6-linux-init +s6-cat >"$pkgdir/bin/init.new" <<EOF || exit $? +#!$el -S0 +$(qx pthbs-enter) +$(qx s6-envdir) -I /run/current/env +EOF +s6-cat >>"$pkgdir/bin/init.new" <"$pkgdir/bin/init" +chmod +x "$pkgdir/bin/init.new" +mv -v "$pkgdir/bin/init.new" "$pkgdir/bin/init" + # Rewrite dynamically generated scripts s6-cat >"$pkgdir/scripts/rc.init" <<EOF || exit $? #!$el -S1