mrrl

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

system-config (8460B)


      1 #!/usr/bin/env pthbs-build
      2 #+busybox.68f74170e6a13d2e0e3d99d29d2f02cd614667a68afec5007308ea1ece55ad64
      3 #+busybox-bzip2.9d87ac159c5af2abf932204167d7dd79a5e2854ec5603817b258b68b5584c07c
      4 #+busybox-gzip.1c4e6759f305d884692ed4260879ddf1ca5b722a4b2b8995fd7ac2ff244c1318
      5 #+busybox-lzop.f4feb74da70e7c871444211871d0fc78da65a9e8ebb6b2d09716cda043d9559f
      6 #+busybox-unzip.3525f1554aa628809b2af9b084dd93fe2a37c8f14dbd514faf0e888c25426073
      7 #+busybox-xz.ead5b695755cbb0c379db6ee22b83de1da44c6d75a5295889ae4536de2a22e58
      8 #+busybox-cpio.aae9207efa7aa6f41519f502d53ce4eabb45a70d339a22bf65d89f1aaf7a39de
      9 #+busybox-dpkg.4f8487d22d56efdc91cb2d6263149840ae08d3ff07047357b04d4437f0321f2d
     10 #+busybox-rpm.173468d54d79d9e5630360360e4479f04190c411b81fd1b1ad0139f618dd6b49
     11 #+busybox-tar.794822cecad4eba7d3977210cc3b83b2dc8011cc18c77d9e0ce5205098cffae8
     12 #+busybox-ed.afab42d8bf2060655b013c6225efcb43715780ef058e718d6a697e25de0dfa16
     13 #+busybox-sed.13120e3643a859180c04f69bc441a554327a643b8a8301ec412d412d3ae9e263
     14 #+busybox-vi.76239b7b2102b4489b0e8a0e86f19030f01d6149fa7310d00504580711d0b0f1
     15 #+busybox-xxd.f3350b2e6c2d9463bc4d0ac5761b2a3ca4d5b811e651c2c705d6143667656c76
     16 #+busybox-process-extra.4718339ba96e00c8091bf1348aef03c41cb830463fb26a943788db2c07d43509
     17 #+busybox-procps.d618aac5f7c813d68a26afdddd97c7989c1ccb671cfa2628642e15573944b541
     18 #+busybox-psmisc.8e915b0be8aa34811699584be98d8d1532c6fe91b44de921e0cbf527402859ad
     19 #+busybox-ash.ec7c45db8ddc5ce15e4890ac76b9058759c93db13f5a7d7af554888e3c5c593f
     20 #+busybox-bc.3e9cce6408b94240c76671a4d11bcade40182fcb5bcc1cfd1828208bef65a085
     21 #+busybox-coreutils.9bf9b030f85f1e2273dcd70b660827388694be93e5dbd86e8c812031195508cb
     22 #+busybox-coreutils-extra.8eb2d3d7aee3f89bc564e0da7e1dcf67071e7e49c1ea9b9dcbdba00069d4e247
     23 #+busybox-daemontools.ff774454c0914cb16b18b038863c4a5a8b7c267eb2a308a9c13b740089ea5727
     24 #+busybox-grep.acdcecd4d05a4d1c250b30ae8925ee38ed1f787276a99b9e3514b9850159d301
     25 #+busybox-misc.125f4e5526de9635e0e04ddc5b6ba8c98a9a0e9e817c423b55241a0f0571e0d4
     26 #+busybox-sh.991f989805551e1b6bb35424114e9339163a4e7c90bb03a946ae71b980936e97
     27 #+busybox-util-linux-unpriv.1f8b2c8640b56685a72666365d8aece78e21f1ebc8a83b4355bb4111536b7caa
     28 #+busybox-dosfstools.e820979cc12a5d67189e1a2ddd56b7acf74c997b1fc61e847d362bc71550a0f3
     29 #+busybox-e2fsprogs.c7d4c079efc3d8e52f8074964ab16ffc0c5fae76c17ddbd32004e3dd488b2e3f
     30 #+busybox-iproute2.c5784e69ccfc0c0cfc9059842944b5df497dd8a380acc33047edf5ab87125de4
     31 #+busybox-iputils.2530233389aa34303b99a903597b2f84d537eb44975ff118c9811e23292bb1f0
     32 #+busybox-net-misc.651c3d6430ef597007aa9027635b255e0ecc6b14aa287ace0177294f2685268f
     33 #+busybox-net-tools.498063f80693c71284f5bb10129bccae16776d1749b6c61f0c1f490e90147514
     34 #+busybox-traceroute.59d2a36762db242bf02b4f0cdb453563a1f3233ea386f0d1f67b90abb5846e83
     35 #+busybox-wget.d8f52ca95e4d8f87d77d646b143d200500fed53393c2ae224e80a096a2ac3fc2
     36 #+busybox-chpst.2e97cd93d9d28fead566486cb9995d9606212ba734639d5a51e43928cf341401
     37 #+busybox-console.c1afe1bab8a922fcf8a0cc81e144297f4e81100ec8efaaca731cd96aa4343184
     38 #+busybox-getty.a10a861f84d45540add21aca09c6826177905b14f62f29f1195a244da2d8ace5
     39 #+busybox-i2c-tools.20dff9a2c0595e41111edff6bfebd92884a3188c21a39f2d99552e3a4b3f5eab
     40 #+busybox-linux-extra.df176250cf3170516261609cac06ff0b6152e03addbf6c7fcca314a17dedc3b1
     41 #+busybox-mtd-utils.b8f4aa9c368a00439a5d32c12a9e2987d2c3334955fa91b1e359f9eb70ffde1a
     42 #+busybox-shadow.a6f6bf1873172315da5969e13f556129aeebf3899359559920b9604b356c42c7
     43 #+busybox-su.fc1e17b9e76bbe90a2bfe043d0a604262f872cb9a792eb2e53cf2c1a3b0ba635
     44 #+busybox-util-linux-priv.2257d5f3a2a91721d8eec0e37331d4f4f04ed5120c1f74bd6e32cf2b4c29d34b
     45 #+busybox-logging.a34aa1c5f1e4f4aee3b579751eab46cc24ff8a63a95523a4800731d6b7b95656
     46 #+busybox-cron.0e7308870754a61664a69417c8eed88ec8bd15db0ba1947a351518e3b8a18aca
     47 #+busybox-findutils.337e3980f5b5d2a07c3850d24ce41c9cbf70e54a3b8d3b4ed7b258756df0014e
     48 #+nawk.89894c53f13b6d37465565571d13dd5f7ee380df8ecabaf81420ccc89b60253f
     49 #+diffutils.b0f6dc127fff42f218cf31dd3ecae47acf3fec88211ad4cd72b70015f1f70aed
     50 #+gnu-make.f9c645bf2cec787c1273cfa3ca4f2ad9a50bf2749bc7b290c97880642c6775af
     51 #+aat.a741bae239a2b4995754a69b398f5561de7130154ca671d96f5dfd86a385334f
     52 #+fileset.3e5161307c504f434368b2c1318de73b3ba88b52a461f82c65f7219bc46cf239
     53 #+rsync.28d5a700581498f8532f2c94df41d35452fb2d2aa1af9e43f0fb2ebf973d9a1f
     54 #+execline.c9b2a98b336011eab78b31558f55135fab7791d42f91af6af9bff9026401cf95
     55 #+kbd.123624cdae074d71e6f3177be35cda9189d4943f7652804534d7bfab78b18996
     56 #+mdevd.d5788ac9972c4fb334d3b3c243ad7a92b8052813fc3c60b1de5426b3a47dbc6f
     57 #+s6-linux-utils.882270568d44626c585b5a581ca81e9d4282aa652e8112372aa0415cadcebc37
     58 #+s6-rc.124b4ee4dd0213ae1c8fb7f96767606661e32a3ea112c9b2d15a2a3cffeec6ca
     59 #+s6.ec4c7ce025c347bbf7c809a40b8138265d382862371e9bcabea457edd0426611
     60 #+zsh.b0949d51b3d7ccb490ccfe5dcc09633254eb6744e865719d6a380931e2dce8aa
     61 #+libcgroup.4b7010b73a04cf68890b347368931bec52b9226d24c927a556384334b5896c7c
     62 #+system-config-scripts.7d77b0deaa9d944986b14e83dd01b0eb7d9f61a87286e7c516e8f5fc4bf931be
     63 #+logincaps.ecc09698e14c2f8804ebd7f8df9c5c851fc48f18bcce206f9b67b4c60da58c9c
     64 #+busybox-modutils.f424154ecd9e763d06daf39d5b6bbcd5055b977c1cfaced5b87bb7731f4a243a
     65 #@git:055d24bac572481d7dedba7d4ec9df37f620fbfd:system-config
     66 
     67 
     68 # - build script start -
     69 
     70 prefix=/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=/versions/env.0e01f2c2da732c78768aa87c678ef022d6313cb5a3f4155a08dcdf940e8f6fce' \
    102 	'pthbs_path_mdevd=/versions/env.f10819a0c342cc226b52913c0830240ddbba5843fe32df22437e4499b5aa036b' \
    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='/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/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