mrrl

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

system-config (8788B)


      1 #!/usr/bin/env pthbs-build
      2 #+busybox.7f0e4d86f69de7624b0468018b9933c3e3c1757c8ff73938746c292196f916dd
      3 #+busybox-bzip2.52d2053dff44277d3c6f700eec6807d2c64c226e0f1bf589372ff5ff625be40e
      4 #+busybox-gzip.085fc42ce36be284c89a9dec6889cca59dedd07b9ba93a21d3198c4adcac5840
      5 #+busybox-lzop.bccd8f86de85a74d466d34f802ab1ea355f0a9d9886bdfa4d7bb4a785d695be6
      6 #+busybox-unzip.237a4ec36283b7fbdb85df583c7c77c0aaf70d335b1cbae09a40a9bb4b6c82bb
      7 #+busybox-xz.db25ed2ffbfc91e7b5cff54faf2e80de59ab5b15167c2c5bb338fa1ee62de122
      8 #+busybox-cpio.307e9495bcd9b79fd9559882115d55d22c5b687e08886e696f1e53d8db7eebcd
      9 #+busybox-dpkg.3aec8347093bb5b774a0c25795cdf9e624268a3b04cc48e867d74e4e06461db7
     10 #+busybox-rpm.8435251ea7058aea0cbcd41478b144b1a15c5aa121509af887847c0ef45bf5aa
     11 #+busybox-tar.c77139157bce13db8820740b756572c22e29cfbd8bb8c2a3b22b465b70e2eae9
     12 #+busybox-ed.4ac872215d7b9c8096c4cfd508434fbd2e825aebd9a9ea8589a0033b8e50aac2
     13 #+busybox-sed.14269a860b3706f7122b827818365fecaa0e62ce5bc3273e89948685c0953f2d
     14 #+busybox-vi.7e41b306c9c47aaaa281aa8347b9fa6dca260788fd73f53a7ba9260b315627ee
     15 #+busybox-xxd.9df3407fd75b89cb640d65870298eaba77327d6e387d25d8ce1ebab01cb47857
     16 #+busybox-process-extra.65afeaded3cb8fdeea327262f28f08e50f18d51a2b456ea97b293d200c7f558e
     17 #+busybox-procps.e5dc609521d29d8aec8253147269314439131c088a6beeacc172fc07594c4a37
     18 #+busybox-psmisc.7d760b69f45bb1b8d458f2f408b9cb3a42e919e8022f0508c440a5fd20ebb66f
     19 #+busybox-ash.fd5d266905d40248735e0e2e1ae22165b6f0d42c0bacb652660f69f39c1ee71e
     20 #+busybox-bc.6f2fe17efab2237c3036eba1c37d432d696d1b5dba130e21365016ceae0a3184
     21 #+busybox-coreutils.7e581faa6901f832a2a022d72b2858c3091f47afc80a4a463adb2f2a68f1843d
     22 #+busybox-coreutils-extra.5ab183b839676b0780a9a83d75cc345a06221fa34627c44aa3732c4a5a47f9b9
     23 #+busybox-daemontools.bcea69c867a61fe1d49d2f6a27e406959c484ed20d54fd7c0341828d3cdbd428
     24 #+busybox-grep.ac20e6a4295eb7fb0a09d700e10e5fe55e2009d2858e0a1525e461d4914e820b
     25 #+busybox-misc.7f0588b97809fac8061c489b686424de1a7dd17d8eb3431aae56513c7288f1e7
     26 #+busybox-sh.288f0583edc783a176bbbc59a3e854b186258ba2605291377a545cc3191c3d52
     27 #+busybox-util-linux-unpriv.5a286246aa7204f7fa8c9a247f1c93c751979690a65200030f29e255645c1eae
     28 #+busybox-dosfstools.b37683efd8b4a72e54d6c44a0c50119969fc5331bf8c221e95278599981783cd
     29 #+busybox-e2fsprogs.97b040545ab4209283aac65aa362041e4d4e74cd11e5c5e3ad1a35baed1aee04
     30 #+busybox-iproute2.2d9ca6b8a14c23200905e2a52dd50cc5e9c1fc1fef9324bfacbaaa6b6d6ff4c5
     31 #+busybox-iputils.09996cd8ce0c7b00f4351a5f37745ffdea5d6a871bb3b5a028b8c391f5cd4c1a
     32 #+busybox-net-misc.b189cea6d06bb88205a90bb359683d92c0f0e5e9d46d3ae0f9c0f3396eb7bbf7
     33 #+busybox-net-tools.0fd5dabc9430492bc29368e7e49ed47832659b9d4050657d10696fcb09f77de2
     34 #+busybox-traceroute.eca457a6db7d2b6c4cdb73d5646a179d43dff829a639697830fb5f853bde7dfe
     35 #+busybox-wget.358809effbe6ae614f474a7017e69853b7d6e9a1580d39a38dd69b6d05bb0975
     36 #+busybox-chpst.a9512afcfaa21f42980402ce2b6680bb99ad81b1f7c61094989fcb1536519c0d
     37 #+busybox-console.fbd958c51fc7d0f4cd54d3fabc201a25a1de39c997462044140bc20ebb99486d
     38 #+busybox-getty.700f4cb7326d9bf82d7d7997199407b882bd621a81afb0c87faf93d2920dc753
     39 #+busybox-linux-extra.46da1347e8a30f6c1594965c38db5f696941c3b91c3f330d4f55dd2c1b3ab358
     40 #+busybox-mtd-utils.7429f56c67b00231a66d877d908f422caf19093fc4d9b24650f7ca2a095d8a7d
     41 #+busybox-shadow.39e6b8449d43b09bde9cfd431b08b1a7cb726699194db6921b4c17a3234b3f6b
     42 #+busybox-su.499b81dc79366bb990e8019aca341b8e71d0bc6b5a38062234008313401ec502
     43 #+busybox-util-linux-priv.83cec28c6e04ad9a7ec5c32a38ec38885c3e8abdb399122820a44c956d52edda
     44 #+busybox-logging.3b0dc10d3df1d292038f7a739f91b96749ede1ac11b26e8e256eb033845ab027
     45 #+busybox-cron.1623c4a03b1450cadf4f0e5df5d71f0a0120af068e6bfbb5fe7efb122108a9af
     46 #+busybox-findutils.207f73a9f41a8f9e279072e920cbf0c38ba6516734fa3cf2c1faf55565613487
     47 #+nawk.84c186be0a6d09a951a8c6a5377d16b0ba0a9e476e6b554c0c832d6407ebb5b2
     48 #+diffutils.fc3b1b10f669e9e7b906baeaccda743718beb2525f062132853123f854aa4cbf
     49 #+gnu-make.17b0037e8a3f24180cb7bb9ddb488039d540ba905aecca0315de313adfbae81c
     50 #+aat.b2df2bfbff48087d5ef34ef39f712038b0d35c0112f04003b12510555fc3a1f2
     51 #+fileset.2156fb8cabd628b062bc9fcc2f673d772a25574dfe5c2c2b779ada64fe9d9d08
     52 #+rsync.0862e31de38b4a570ee619a737c7cd3f382d195dcfeee77fab3c00386fd8609b
     53 #+execline.4e773f1ba308227aa5402fd63038f6dcbaf3866ca3fa70555a8bec9b81c8e2d2
     54 #+kbd.8335c364d0912b8b2b25dbf85fa2bd61713505eaf91487dfc178b5eff18fcc6d
     55 #+mdevd.3ba58bb7f820dbc30d791987f1034862f021d75dd171e9a8e93e8abc81575bf5
     56 #+s6-linux-utils.34bdcec91aae280416c16a52959e513382aeb67ffd9f68bcdec6f5967434b445
     57 #+s6-rc.e09e2d9c42a1bbc18b406ff114d945db0d3187fd09b703ddd7c28a4d64357ad3
     58 #+s6.64db7103e34ea2b2dd5d657ebf1a62bea89d31b2a5df8cd6ef0c140ef574828f
     59 #+zsh.355a949de332be38ccdfad4e0d3e4a3d60d4b2f3ee257698a87f25ce811c2008
     60 #+libcgroup.e54a3756ee4d96e48126c3acf4f0d948dece9286359872813bd6f23104c67886
     61 #+system-config-scripts.bfe6189587fc33d037051c22a904d60dab3f025f4d33de17745f1ea1ecc919bc
     62 #+logincaps.446017af580c0455b8c3419d5354d1feeb7f75c1b5557faa0434f2f59f154311
     63 #+busybox-modutils.4aef0ae5907514beeff60f30370a78d0e294055c92d2409920150a5ebeedca2a
     64 #@git:055d24bac572481d7dedba7d4ec9df37f620fbfd:system-config
     65 
     66 
     67 # - build script start -
     68 
     69 prefix=/versions/$pthbs_package
     70 dest=${pthbs_destdir%/}${prefix}
     71 cd 'system-config'
     72 
     73 
     74 err_notfound() {
     75 	printf >&2 'Executable not found for command "%s"\n' "$1"
     76 	exit 1
     77 }
     78 linkdep() {
     79 	exe=$(command which "$1") || err_notfound "$1"
     80 	exe=$(realpath "$exe")
     81 	name=$(basename "$1")
     82 	if ! test -x "$exe"; then
     83 		printf 'Error: executable not found: %s\n' "$1"
     84 	fi
     85 	mkdir -p "$dest/deps/command"
     86 	ln -sf $exe "$dest/deps/command/$name"
     87 }
     88 
     89 printf '%s\n' >config/etc/motd \
     90 	"Welcome to $(cat ./config/hostname)!" \
     91 	'Current running configuration was generated from system-config:055d24bac572481d7dedba7d4ec9df37f620fbfd' \
     92 	'Last change on 2025-11-27 20:24:27 +0000 by Jan Pobrislo'
     93 
     94 printf '%s\n' >config/etc/skel/loginexec \
     95 	"#!$(which execlineb) -S0" \
     96 	'user_loginexec $@'
     97 chmod +x config/etc/skel/loginexec
     98 
     99 env 'pthbs_path_system-config'="$prefix" \
    100 	'pthbs_path_containers=/versions/env.c9c9acfeabfb70c93a36fc29c209be9af32e618fdb8c6f5611e18b5aa2e401fc' \
    101 	'pthbs_path_mdevd=/versions/env.b72996087d5776ae6cc04527da2721badc870ebacff57bafde63913d7bcfad2a' \
    102 	make -j${JOBS:-1} -l$((1+${JOBS:-1})) all
    103 
    104 sort -u build/execfile | while IFS= read exename; do
    105 	linkdep "$exename"
    106 done
    107 
    108 mkdir "$dest/command"
    109 awk -v "zsh=$(which zsh)" <./postinstall >"$dest/command/install-as-current-environment.postinstall" '
    110 NR==1 { print "#!" zsh; next }
    111 /@@current@@/ { print "current=/run/current"; next }
    112 /@@versions@@/ { print "versions='/versions'"; next }
    113 1
    114 '
    115 chmod +x "$dest/command/install-as-current-environment.postinstall"
    116 
    117 mkdir -p "$dest/config/"
    118 rsync -ai ./config/ "$dest/config/"
    119 rsync -ai ./out/ "$dest/config/"
    120 mv -v keys "$dest/"
    121 
    122 
    123 
    124 
    125 cd "$pthbs_destdir/versions/$pthbs_package"
    126 find -type d -o -print | awk -F/ '
    127 BEGIN {
    128 	x["./command/install-as-current-environment.postinstall"]=1
    129 	x["./config/etc/fstab"]=1
    130 	x["./config/etc/motd"]=1
    131 	x["./config/etc/skel/loginexec"]=1
    132 	x["./config/hostname"]=1
    133 	x["./keys/ssh/authorized_keys/root"]=1
    134 }
    135 
    136 function r1(s) {
    137 	sub("^[.]/[^/]*", ".", s)
    138 	return s
    139 }
    140 function s1(repl, s) {
    141 	sub("^[.]/[^/]*", "./"repl, s)
    142 	return s
    143 }
    144 function link(src) {
    145 	x[$0]=0
    146 	printf "%s\t%s\n", $0, src
    147 	printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr"
    148 }
    149 $1!="."{exit 1}
    150 $2 == "env" { link($0); next }
    151 $2 == ".env-template" { link($0); next }
    152 
    153 $2 == "command" { link($0); next }
    154 $2 == "command" { link($0); next }
    155 $2 == "bin" { link(s1("command", $0)); next }
    156 $2 == "sbin" { link(s1("command", $0)); next }
    157 
    158 $2 == "library.so" { link($0); next }
    159 $2 == "library" { link($0); next }
    160 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next }
    161 $2 == "lib" && $NF ~ /\.so(\..*)?$/ { link(s1("library.so", $0)); next }
    162 
    163 $2 == "share" && $3 == "info" { link(s1("info", r1($0))); next }
    164 $2 == "share" && $3 == "man" { link(s1("man", r1($0))); next }
    165 $2 == "share" && $3 == "doc" { link(s1("doc", r1($0))); next }
    166 
    167 $2 == "config" { link($0); next }
    168 $2 == "man" { link($0); next }
    169 $2 == "info" { link($0); next }
    170 $2 == "doc" { link($0); next }
    171 $2 == "data" { link($0); next }
    172 $2 == "include" { link($0); next }
    173 
    174 $2 == "share" && $3 ~ /^(icons|terminfo)$/ { link(r1($0)); next }
    175 
    176 $2 == "library.ocaml" { link($0); next }
    177 
    178 $2 == "keys" { link($0); next }
    179 $2 == "zsh" { link($0); next }
    180 $2 == "vimfiles" { link($0); next }
    181 $2 == "icons" { link($0); next }
    182 $2 == "terminfo" { link($0); next }
    183 
    184 
    185 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" }
    186 
    187 END {
    188 	for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" }
    189 	retcode = 0
    190 	for(fname in x) {
    191 		if(x[fname]) {
    192 			printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr"
    193 			retcode = 3
    194 		}
    195 	}
    196 	exit retcode
    197 }' >.install-links.new
    198 mv .install-links.new .install-links
    199