mrrl

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

system-config (4332B)


      1 #!/usr/bin/env pthbs-build
      2 #+busybox.ee3440974794767b833fd3299226771f170d3f8601cf225cb884f0a513db8ab3
      3 #+diffutils.6969e96fd52d27b6d8c65d20fefbe74600ba820eaad1ba0054751b61752d8a86
      4 #+gnu-make.ba8d7c64a23885182fc1c9dc0331d52adcdbc45df6000fb81e8e1dd3ee05694b
      5 #+aat.0698d0082830b7f8bcf3840f3f8c25382ef2d9f174dd6d5407c5e2132d1f16e4
      6 #+fileset.4e84d6846c9db82c5ad691b8a6b63b6364b367e84f9d1490b0942b3fa28f3737
      7 #+rsync.32b87b85bdc766953843afdf5f56abafcce8c9738dfdbe184a7f7be86a86b833
      8 #+execline.1505a32c24aa5dbf362550f39283c9ff1936e717e5a82d220f8212cd9e604d8f
      9 #+kbd.4b136e1e449b21180ac16ee7980c30135e6c24a4deb5a4ba600a3e8c431e0b9e
     10 #+mdevd.2c8e38fba9104da05177a2c4cc498139c506b1b3dae60c51cf54b831c1762daa
     11 #+s6-linux-utils.1990b55837ff2c28a81500d80292c6d530c8516347eb896007eb5aed2af6c425
     12 #+s6-rc.fecfa43aebb0615904e0e120b9ce8c0596c9b6c577611cbadc8fbaca75196ed9
     13 #+s6.087ce2658d9f8b1c38f8f6999d2cfef0bf3b53afaf07f01495091883c154899e
     14 #+zsh.f79a20125b2f520d3719411e6f0895cf4f2e0657565c3fef07b3069436b8960f
     15 #+system-config-scripts.bdedb957b96fc1efd8259d16dac786d1d9c220dcde66996a16688989f104925d
     16 #+logincaps.96263bd64a359697fe7dc6343af26a7e3d535be97cb52f6010b575e05165dbf5
     17 #@git:0a1466e946de353d1947a4cdb2210b5699c141dd:system-config
     18 
     19 def_prefix() {
     20 	prefix=/home/ccx/versions/$pthbs_package
     21 }
     22 def_dest() {
     23 	dest=${pthbs_destdir%/}//home/ccx/versions/$pthbs_package
     24 }
     25 def_prefix
     26 def_dest
     27 err_notfound() {
     28 	printf >&2 'Executable not found for command "%s"\n' "$1"
     29 	exit 1
     30 }
     31 linkdep() {
     32 	exe=$(command which "$1") || err_notfound "$1"
     33 	exe=$(realpath "$exe")
     34 	name=$(basename "$1")
     35 	if ! test -x "$exe"; then
     36 		printf 'Error: executable not found: %s\n' "$1"
     37 	fi
     38 	mkdir -p "$dest/deps/command"
     39 	ln -sf $exe "$dest/deps/command/$name"
     40 }
     41 
     42 cd 'system-config'
     43 
     44 printf '%s\n' >config/etc/motd \
     45 	"Welcome to $(cat ./config/hostname)!" \
     46 	'Current running configuration was generated from system-config:0a1466e946de353d1947a4cdb2210b5699c141dd' \
     47 	'Last change on 2025-04-15 00:39:09 +0000 by Jan Pobrislo'
     48 
     49 printf '%s\n' >config/etc/skel/loginexec \
     50 	"#!$(which execlineb) -S0" \
     51 	'user_loginexec $@'
     52 chmod +x config/etc/skel/loginexec
     53 
     54 env 'pthbs_path_system-config'="$prefix" \
     55 	'pthbs_path_containers=/home/ccx/versions/env.9bfb82c90569109567428debc01c7aae2475007c34c29dca0bff57d8a01ab6d4' \
     56 	'pthbs_path_mdevd=/home/ccx/versions/env.5049027ea8b6b4d373e16aadd3cdc63a940582ff297656e395f2131eef181671' \
     57 	make -j${JOBS:-1} -l$((1+${JOBS:-1})) all
     58 
     59 sort -u build/execfile | while IFS= read exename; do
     60 	linkdep "$exename"
     61 done
     62 
     63 mkdir "$dest/command"
     64 awk -v "zsh=$(which zsh)" <./postinstall >"$dest/command/install-as-current-environment.postinstall" '
     65 NR==1 { print "#!" zsh; next }
     66 /@@current@@/ { print "current=/run/current"; next }
     67 /@@versions@@/ { print "versions='/home/ccx/versions'"; next }
     68 1
     69 '
     70 chmod +x "$dest/command/install-as-current-environment.postinstall"
     71 
     72 mkdir -p "$dest/config/"
     73 rsync -ai ./config/ "$dest/config/"
     74 rsync -ai ./out/ "$dest/config/"
     75 mv -v keys "$dest/"
     76 
     77 
     78 cd "$pthbs_destdir/home/ccx/versions/$pthbs_package"
     79 find -type d -o -print | awk -F/ '
     80 BEGIN {
     81 }
     82 
     83 function r1(s) {
     84 	sub("^[.]/[^/]*", ".", s)
     85 	return s
     86 }
     87 function s1(repl, s) {
     88 	sub("^[.]/[^/]*", "./"repl, s)
     89 	return s
     90 }
     91 function link(src) {
     92 	x[$0]=0
     93 	printf "%s\t%s\n", $0, src
     94 	printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr"
     95 }
     96 $1!="."{exit 1}
     97 
     98 
     99 $2 == "config" { link($0); next }
    100 $2 == "keys" { link($0); next }
    101 $2 == "command" { link($0); next }
    102 $2 == "bin" { link(s1("command", $0)); next }
    103 
    104 $2 == "library.so" { link($0); next }
    105 $2 == "library" { link($0); next }
    106 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next }
    107 $2 == "lib" && $NF ~ /\.so(|\..*)$/ { link(s1("library.so", $0)); next }
    108 
    109 $2 == "share" && $3 ~ /^(info|man|doc|icons|terminfo)$/ { link(r1($0)); next }
    110 
    111 $2 == "man" { link($0); next }
    112 $2 == "info" { link($0); next }
    113 $2 == "doc" { link($0); next }
    114 $2 == "icons" { link($0); next }
    115 $2 == "terminfo" { link($0); next }
    116 $2 == "data" { link($0); next }
    117 $2 == "include" { link($0); next }
    118 
    119 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" }
    120 
    121 END {
    122 	for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" }
    123 	for(fname in x) {
    124 		if(x[fname]) {
    125 			printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr"
    126 			exit 3
    127 		}
    128 	}
    129 }' >.install-links.new
    130 mv .install-links.new .install-links