mrrl

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

system-config (8496B)


      1 #!/usr/bin/env pthbs-build
      2 #+busybox.379b7b2d8316b3678245563c8e592d71e6c380bc22a735c30c1c0e6f8f60caf3
      3 #+busybox-bzip2.4788e6edf9eeb73c7c665238a23aeed4703f8e25ab101509aee01440865ccdb1
      4 #+busybox-gzip.4fc908cacf4533192819578a079617c0cbe879b8ebd3e2140d896b067d3a574c
      5 #+busybox-lzop.e6e42a1a8451a4b845355899c9cd49efea2e395a0ef0c6ae7099103213a7bf4f
      6 #+busybox-unzip.93b5e83122059c87a2ddf489cdc7381bb80288630c508c218c2cfbadff524784
      7 #+busybox-xz.34137cc6ac8d23bf1bf5979b7fd047d4f50b34be07cd6ab636368952a199368d
      8 #+busybox-cpio.de88944ccff44a1f3abe06c42f83492a7e080de89fba27aadf5fe1a40e830cae
      9 #+busybox-dpkg.17e445a8089bc61db749a44c665597ecac3f21c4088daaa024f574412eb4d704
     10 #+busybox-rpm.669ed61ee218bc72206e069c896f392a025c88772ceb92ecb37b01ab0765baf8
     11 #+busybox-tar.15f67670238651149114006ae79359f24e1fa3c62be2e229a48f1334747ba413
     12 #+busybox-ed.78c51627a372c5b2ad3d046d0e77f341ae7c79917c4a16ca8abba284e7472cb7
     13 #+busybox-sed.8782396ae5c7b6e7d6bc8a93a7cff9912e6427e3d919dd5e5b00d1813ae88caf
     14 #+busybox-vi.e661d8eb052fbeebdd3be36ff6bd27651a7e59c857dad05c8633589790caa38c
     15 #+busybox-xxd.d2dc96e92cfdafae2c91d6fe897f42fdccae2dbc8b2d79f31eccc49d4e3a2d68
     16 #+busybox-process-extra.993cfd65eae2892ecb3fdfbece44b11e7ff6caa78f73e9f22bc2c97e7cd8a267
     17 #+busybox-procps.51ea8cb23d5eb1498f9167cc80b97c1a873758a8c1a7293079f50a2365466a71
     18 #+busybox-psmisc.ff1f9cf00f4c448946acb65d52b3b598e0495822af70b1504720cadf559e2090
     19 #+busybox-ash.7d10753f118afb2568e9f950c9cffa559b053a9b3ea516d6b46c3c73ebb6f8d8
     20 #+busybox-bc.c595636f103108c81f0ae55d2bf10d7cbc06ef1455a8353fcf04e42e765780a8
     21 #+busybox-coreutils.6b8071260ab4297f0e71013e42ac2a1a83fa99d92378d181ba49003fd349134a
     22 #+busybox-coreutils-extra.fc1b0766c881ee461d36c386833909553fcb0c31a547bfb563a7c6a50206bdcd
     23 #+busybox-daemontools.97aad28bbe5f38cff29db16c0f0d21e2fdc931825f683137df9bb57ef3a9b628
     24 #+busybox-grep.261a809c35cb58acc896143c2a81406a097f5870e02ce9906953181ef6b4c72b
     25 #+busybox-misc.5c2c025f1b74b9243a0128cd3f10dd1577b5ae123f53244d8e6895d4bdbd161d
     26 #+busybox-sh.25a9438d8449ade9c98af61b14af5711990dd002462a046b13b61969634c4d94
     27 #+busybox-util-linux-unpriv.4ea1c8c8746d7e80d36dea8924c576bc9666905b461dd543ceb5595394406c97
     28 #+busybox-dosfstools.1d2b9edd5426588b64db50bbb58812ec321a745f3098e77b7885a1dea502157c
     29 #+busybox-e2fsprogs.d3f81870ed6114720a0f8fa957ce01ee3c4ca1dd9892c794bfa3882706efeb12
     30 #+busybox-iproute2.a5e6578168e3b608d3dfa07148a109f9cfa1a4701e74b44e6f92a59c4158af37
     31 #+busybox-iputils.8233bc9ace8965d538d33010d0324c90bccdcb71ee856a134395b47562a86859
     32 #+busybox-net-misc.bab4e5c7452fbf727d0b66eb25affc291e584ba58a1b023dc3ceb28a438492ac
     33 #+busybox-net-tools.b2c492d71f1f369d85138465b745bd9249efee3b2ca1d229b577b49fa03a7693
     34 #+busybox-traceroute.0c61c7a73c7b4004f1a88e134a534cc503cb53df511774a08193e674cca23e0c
     35 #+busybox-wget.3f3bb32e1a48616fe4ca8bdd7f69d4e281e42841e00175523c13b148c90b25cc
     36 #+busybox-chpst.30790f00d54403da6f0b9e2dc5e35d3a499db46a10928294eb3130ac9897d73d
     37 #+busybox-console.362bc79a1d38afa9666816d5b726eabc77f3a75bf145bb3b4f7562fcdc7019f6
     38 #+busybox-getty.a5db7cd285f5af5fe298afd3c0cf51fc2dbb4c116450ea9bb3403b77e57ef6e0
     39 #+busybox-i2c-tools.135c74be4f3cbcd45667f1749ff3124493f42707e204d178094828326df172eb
     40 #+busybox-linux-extra.1925e0cd6741f408301583323360f17a91f6c4e3143b6bb256fd6fbc82cd61c0
     41 #+busybox-mtd-utils.2f7c9f425030b22040d7fc75e86168d303857464448cd87e907d7ce824d541df
     42 #+busybox-shadow.1217e37cc209e4f8130c9290de26d0941c1690b1df6aa819e6bc6c4a08a1dcbb
     43 #+busybox-su.83da14ece711f6fdb33aebb0d0a2558827cc30ce9966f2696dbc95606951b175
     44 #+busybox-util-linux-priv.bcb37952ef97d61602b87ec1820f52fef4a5e6548c0f8b5b2f6ec768ddac2d02
     45 #+busybox-logging.a82bb2f2d07e0f30d1271482b142c052367a504a97b3803e7ad25148d53592c1
     46 #+busybox-cron.92a0481bcf3adea90752835bd7ee77641d7366ff84c1539f5562e01e9d14f01e
     47 #+busybox-findutils.052256c5bf9c3e7fef2e69d22f3d402d004f22113ce10b4d2c54ff417bf42622
     48 #+nawk.d6c1a6fd67ebccb4cb1b8062bed80778ee976f5a62370e60fcbc443257a78cd9
     49 #+diffutils.ab73a7cef21b2bb9fb17c0c9117d643f832adcebdd63fe4f63f7351856be90ee
     50 #+gnu-make.31d90a55d6506852f9784f6f6febf0d843f8051f63bc18795fd5275baa369f50
     51 #+aat.2ecceb51a1c8c60748defb9eb74577d7975dc749c08402a14e2fee4bfb4aa2bc
     52 #+fileset.0e14bac5fb53f8712c33088f26d59687fb3f05f5abdafd093e94f542d5a5e76b
     53 #+rsync.3d0a477167789eb4a71f9b027e9f02614fc0f4f4e4d1f13690ecb4811deb6907
     54 #+execline.5d88993134dc7d05e6124e7bd182279794ef9bac128f552aa1e98c17220e3c37
     55 #+kbd.4217ffc9d75a6041f026b8badac79b8b4e95576877771ed9ab22d5d3cd84b93c
     56 #+mdevd.39c975c424891ea67bec381dcc88d9a23d716b0254206d9023ebb05480586faa
     57 #+s6-linux-utils.0bc57dadd17510f135faf829ccc538b803bbd16ed5418c160ef430eaf14bb054
     58 #+s6-rc.f77621d319bb146c643a78051d81af24a0062c5c51ff074708e947714b39f689
     59 #+s6.af31d85ebbb2bd67def86f46f702a872de0704ad1b77e1e52e5b3069f540fd54
     60 #+zsh.08bac2dd5a59108ff97c33e090b80edb1f96413026c95358eb03d4ef039a75a9
     61 #+libcgroup.cdb8e2bb782c182a57999d1daa50f50ead3a918410df9974ca8ee2f68e972720
     62 #+system-config-scripts.a983668711783d5c36b32ca9859fe7c99b0cf3588bbeeb315b8ba5ca6b692831
     63 #+logincaps.7653bc082ef61f10defc361ae21a87b2bea04b7281a5574601d76f2d0706a9c4
     64 #+busybox.2ef5301e1fcabd1b3cd0b88f9dda6a41d4e7b432be5e555dffa5aae865334e41
     65 #@git:055d24bac572481d7dedba7d4ec9df37f620fbfd:system-config
     66 
     67 
     68 # - build script start -
     69 
     70 prefix=/home/ccx/versions/$pthbs_package
     71 dest=${pthbs_destdir%/}${prefix}
     72 cd 'system-config'
     73 
     74 
     75 err_notfound() {
     76 	printf >&2 'Executable not found for command "%s"\n' "$1"
     77 	exit 1
     78 }
     79 linkdep() {
     80 	exe=$(command which "$1") || err_notfound "$1"
     81 	exe=$(realpath "$exe")
     82 	name=$(basename "$1")
     83 	if ! test -x "$exe"; then
     84 		printf 'Error: executable not found: %s\n' "$1"
     85 	fi
     86 	mkdir -p "$dest/deps/command"
     87 	ln -sf $exe "$dest/deps/command/$name"
     88 }
     89 
     90 printf '%s\n' >config/etc/motd \
     91 	"Welcome to $(cat ./config/hostname)!" \
     92 	'Current running configuration was generated from system-config:055d24bac572481d7dedba7d4ec9df37f620fbfd' \
     93 	'Last change on 2025-11-27 20:24:27 +0000 by Jan Pobrislo'
     94 
     95 printf '%s\n' >config/etc/skel/loginexec \
     96 	"#!$(which execlineb) -S0" \
     97 	'user_loginexec $@'
     98 chmod +x config/etc/skel/loginexec
     99 
    100 env 'pthbs_path_system-config'="$prefix" \
    101 	'pthbs_path_containers=/home/ccx/versions/env.ee6973ae79c83c3d1d39f6eeb5945999d6eebeb0936ffa3daf5a8eec6157e7b7' \
    102 	'pthbs_path_mdevd=/home/ccx/versions/env.a5badaab0a0c24f27129b658d022b12ed2afe9743bcacc1bcc386778e6777dd5' \
    103 	make -j${JOBS:-1} -l$((1+${JOBS:-1})) all
    104 
    105 sort -u build/execfile | while IFS= read exename; do
    106 	linkdep "$exename"
    107 done
    108 
    109 mkdir "$dest/command"
    110 awk -v "zsh=$(which zsh)" <./postinstall >"$dest/command/install-as-current-environment.postinstall" '
    111 NR==1 { print "#!" zsh; next }
    112 /@@current@@/ { print "current=/run/current"; next }
    113 /@@versions@@/ { print "versions='/home/ccx/versions'"; next }
    114 1
    115 '
    116 chmod +x "$dest/command/install-as-current-environment.postinstall"
    117 
    118 mkdir -p "$dest/config/"
    119 rsync -ai ./config/ "$dest/config/"
    120 rsync -ai ./out/ "$dest/config/"
    121 mv -v keys "$dest/"
    122 
    123 
    124 
    125 
    126 cd "$pthbs_destdir/home/ccx/versions/$pthbs_package"
    127 find -type d -o -print | awk -F/ '
    128 BEGIN {
    129 	x["./command/install-as-current-environment.postinstall"]=1
    130 	x["./config/etc/fstab"]=1
    131 	x["./config/etc/motd"]=1
    132 	x["./config/etc/skel/loginexec"]=1
    133 	x["./config/hostname"]=1
    134 	x["./keys/ssh/authorized_keys/root"]=1
    135 }
    136 
    137 function r1(s) {
    138 	sub("^[.]/[^/]*", ".", s)
    139 	return s
    140 }
    141 function s1(repl, s) {
    142 	sub("^[.]/[^/]*", "./"repl, s)
    143 	return s
    144 }
    145 function link(src) {
    146 	x[$0]=0
    147 	printf "%s\t%s\n", $0, src
    148 	printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr"
    149 }
    150 $1!="."{exit 1}
    151 
    152 
    153 $2 == "config" { link($0); next }
    154 $2 == "keys" { link($0); next }
    155 $2 == "zsh" { link($0); next }
    156 $2 == "env" { link($0); next }
    157 $2 == "command" { link($0); next }
    158 $2 == "bin" { link(s1("command", $0)); next }
    159 
    160 $2 == "library.so" { link($0); next }
    161 $2 == "library" { link($0); next }
    162 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next }
    163 $2 == "lib" && $NF ~ /\.so(\..*)?$/ { link(s1("library.so", $0)); next }
    164 
    165 $2 == "share" && $3 ~ /^(info|man|doc|icons|terminfo)$/ { link(r1($0)); next }
    166 
    167 $2 == "man" { link($0); next }
    168 $2 == "info" { link($0); next }
    169 $2 == "doc" { link($0); next }
    170 $2 == "icons" { link($0); next }
    171 $2 == "terminfo" { link($0); next }
    172 $2 == "data" { link($0); next }
    173 $2 == "include" { link($0); next }
    174 
    175 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" }
    176 
    177 END {
    178 	for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" }
    179 	for(fname in x) {
    180 		if(x[fname]) {
    181 			printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr"
    182 			exit 3
    183 		}
    184 	}
    185 }' >.install-links.new
    186 mv .install-links.new .install-links
    187