mrrl

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

system-config (4269B)


      1 #!/usr/bin/env pthbs-build
      2 #+busybox.7818e9d6df97d97317c8fcdf404811731aa0c5c3ab7eb6aec00c9652b6da511c
      3 #+diffutils.23bff923b4bf51b9e847332026fe76c89752a1ee5998ac80c7565310bcfa39e1
      4 #+gnu-make.152d99fd58e3130b4bd4d23833643ca418555a0560e88962cd8a28ffcd9a9ab7
      5 #+aat.b982d9b2dc812fb7b4402550c950024f2d6a9715213483e20c0fc8d57e5c56ce
      6 #+fileset.49f19385f7dbd7e606422f304ecf6434ba61c23b67f54608e125c7cc591f0ea3
      7 #+rsync.a49c7aadcfbc5214221fc1d1d9292b452f98891205b15cea0b5af1bf6179d227
      8 #+execline.d4fee837def832332b7e642764c80bef670c35b5e473f1590c4b56f88e2ae571
      9 #+kbd.9fd7dc897926534f64c37001a58b65ead0993e136dbc5638da7f0eee3cbf307f
     10 #+mdevd.9df69ff91ff4c96dbf46b55fed457a3b227ab0660e0308834c90dd1d7ffa2f33
     11 #+s6-linux-utils.c293bd1d5ec27cbb02c001ce85aa79abf7c134f7ee79a00ce036de04f2379ee5
     12 #+s6-rc.fac398d7051e95c6de0f8cd3b5c7f4a186109a9f11ea9f4ed23b5b16803ce8fe
     13 #+s6.716acd4be9854d2eb4b213e4852567fbd963fb905a246d0a0e30251e2153720e
     14 #+zsh.39cfa85c387b3d316db3206c9eaba5a10751588267adb2884d33f5fb7253b57a
     15 #+system-config-scripts.8d575cbb5a291fd5a445f185deccd866ce9a99763e42d53818e7a0a452a52057
     16 #+logincaps.9552e9f7a55364f3dc866a9746b2c81df3ac8e064c9008287ba3cd8faa45d74c
     17 #@git:f41e8fb1dda464b6f5bf4c1f77c3fadd8593717a:system-config
     18 
     19 def_prefix() {
     20 	prefix=/versions/$pthbs_package
     21 }
     22 def_dest() {
     23 	dest=${pthbs_destdir%/}//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:f41e8fb1dda464b6f5bf4c1f77c3fadd8593717a' \
     47 	'Last change on 2025-02-14 14:41:23 +0000 by ccx'
     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=/versions/env.6df37b83fc635e5fc56882e37fc1237b6bb921cd5abcb1ff015aeff3988c1a18' \
     56 	'pthbs_path_mdevd=/versions/env.3412be17980527b0be12ccfa160c74bdcd3b1d4365e6d47f970b4b46afbd428f' \
     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='/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/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