mrrl

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

system-config (9320B)


      1 #!/usr/bin/env pthbs-build
      2 #+busybox.504428034e649f598212c8994966e36667178683ec90987355f495ad3ca4abac
      3 #+busybox-bzip2.4ea548a271f41e7147568dc02e5071fb200eab38a9a22e733d3106b71e354812
      4 #+busybox-gzip.0999e8c6a8b7df82fc1cf10ade2468fb2bc4352f76d4b1d2af5099a65ccada9b
      5 #+busybox-lzop.f0d93621bfd8ca106a8590562d93158b05087e5ef48068c7a84d9967b67d2d25
      6 #+busybox-unzip.737f61aac20ef6c0554fca59bb599bf98e4fb77fbd97fba65a3692ac9d4afb84
      7 #+busybox-xz.639cf99dd37a7d6f719b937d13af92202e01adf11c130f8647574c1d9ef5b0d2
      8 #+busybox-cpio.d22266c2b6c056c0ea96873402d06591aa23368ea24d91f1fbf8a8327cb210f8
      9 #+busybox-dpkg.2b0dd2fa41e946e98f2f8948ae3d3a152a069c77460768d9c76d41f56974e514
     10 #+busybox-rpm.62bb242b4fbb3fd51b233ed9ce6c257ab997b1ee3a68ef3048656addc98f3d97
     11 #+busybox-tar.dd3d9b0075fc038df431ce2a16fc1b140de521e1aa6d154dc7b607f9403d5ac0
     12 #+busybox-ed.6ff6cd59168705c6b256d800cde7e8c69dd05c556520317dae6a0b492029fe6b
     13 #+busybox-sed.8793bcd2536ab32fa528bbb0c22f0c014663ac5e045193aa7bd113a07f58c5b9
     14 #+busybox-vi.db3d29c62845a55b7c5491d057cb9ea6c6deba93c567f4ef9eb15f06be8ad171
     15 #+busybox-xxd.9dff38f0c9dbf57856a0824bc23cc99cb31a67ce5138de7a6de2e255880a5696
     16 #+busybox-process-extra.448a35fa5362e576a23ef306ec6e0da2f625adae08cc5c3b12a01d5d28f76ce6
     17 #+busybox-procps.835712dc539d5583773d175255a5c4e27b5823d97e855948d27cc2c194247b0f
     18 #+busybox-psmisc.f2434b74cd3e07ddea335da52c222567bc111b621f0f060afef8bcc26a8d96fd
     19 #+busybox-ash.039eb4051853cdde4d03b8dbd5d6128957bf933be5ac398471666e5db0d33dab
     20 #+busybox-bc.e731e83c11906525d676777835256a3f478779eafe7152701adfc46558d73009
     21 #+busybox-coreutils.a57a12f85d58388c284d4f93f6c485d4bc2a7eac0d0f4be57b20d2ddbd4c8b8f
     22 #+busybox-coreutils-extra.09de38ce2d65026888577e8314766e4b17205b2a99a4fecfdd5cd89c1cd82aed
     23 #+busybox-daemontools.d12e277e7154028f0beaae44ad1e2c7e1cd12d28549b6861604fc634c3e09aaf
     24 #+busybox-grep.474abd8ddad6afb320c55141078cb4507d02c4610181a4d72a4d98ba93434a60
     25 #+busybox-misc.ea211db457ee098923eeff82a4388d5864254a6c2718f38471b5b2867c73d158
     26 #+busybox-sh.49a7505969c9882c8a9a7ad3f5dba6d1382add3559f4da21ceafb2708d3fd4c8
     27 #+busybox-util-linux-unpriv.95b792cd49d1f00d5488b15d93809166916ef3b8a63a69ea11f3bf6e92a74f24
     28 #+busybox-dosfstools.179546bcd6ecb66c6539894d62d901e727b7ad1a7a314c6a6f3765eab9405090
     29 #+busybox-e2fsprogs.a245d4da1f6a891c026409abc8b13aa012ce68db7dc02930dcd3e4d5384842a8
     30 #+busybox-iproute2.2822ef07216c1b433ab6bd19871080d568c92fea2a26e8426c28e6adad2aeb29
     31 #+busybox-iputils.9b88d3ac1988b296f3fcee8cec5f52d4a48a7663db0f98b359ef651e5a0760f2
     32 #+busybox-net-misc.184d15a75f96f84c2d5ea201cbe58f8aec454ea601244764b374ceabc4fc6f9f
     33 #+busybox-net-tools.3c6cac9d84e0b4f46317732bcbdc12d817879778d29f8b5b74fcac0e8fb97404
     34 #+busybox-traceroute.1c04a547b3624077f5f494f0a0dd5c337d3aceae789725c0845cb7737a828b37
     35 #+busybox-wget.6b7bb97a67eaa6dfe9f7d6b3e5be0962949e2b7e6ae80209a22144357742a14f
     36 #+busybox-chpst.e73c721864c0b7b040fdb39e0d35fa32989e05ee813aad6dc901013c2aca37e3
     37 #+busybox-console.70304cc8fe0cefc87bb7af67cb28509c71dd3c3bdf135172151b5d965ac5202e
     38 #+busybox-getty.d5e78232db781cba4ac4c02a96262e18c8b52c4878d8c80879372327c40ab0ca
     39 #+busybox-linux-extra.f198e630cc9428c7aba67c0d384144b71043f0d30dfa2d198a5f32d028728bc5
     40 #+busybox-mtd-utils.2a0057a22776d92c89cfe12c28ad895f1c1a8a5f015a0fafe70661c3bc13620f
     41 #+busybox-shadow.5ffa856469711a1550867610fdf3f0e161f27a79efebc6f232a085372f7586bb
     42 #+busybox-su.b90c285664f5f1761b6f76bacbc155f89deb55ae38bd1668396a275bea461bff
     43 #+busybox-util-linux-priv.9a041dc43dbcf3c67bac149789e819b0bb3934768de2d5f2785feda2d66a2d8e
     44 #+busybox-logging.d216f2ce8e94dbbd8f29849959e3b3dfeda95ff53cfc5df1ee5533255b0b5b38
     45 #+busybox-cron.d75134f370a00d415670bd831a43ffbc88d8abb59afa0920457f14458d3ed35c
     46 #+busybox-findutils.db22f512240124b15d61cf8d0ceafebc98649f6f137608a2d1bd66f18e81ad8c
     47 #+nawk.ec8a7f9ea4618a151470a1c1a0026f688a5032eb06b8e459510fe82316c17a60
     48 #+diffutils.c44d0701c69295321eaa64bf7cf82233b2eec05a6c640cb8175af9a4e3ee7122
     49 #+gnu-make.fb4cff1c46827d02016d0f94d5256a263e7710025f7480fffb7580dc922a6069
     50 #+aat.9166428aa8236b03999fcbe9e2f6da9adefa8c4675ddd36f4b7995d6c7bb87f4
     51 #+fileset.a3b5845ff158d4a14da356583bcbbc7de921ea437f40d47d1f91d28549b384c0
     52 #+rsync.3060eb88668700798b531a6f6d3647352e1a572ad8f5b55a75fd22a3326de06a
     53 #+execline.9a3f85aad80338dca7556496d1010fc08c4868fa8192f723965ebbfd00722d6a
     54 #+terminus-consolefont.2bcd283c7333cf50e6b94e91323f68afdc45b4232b9772cacde6c959464e53e0
     55 #+kbd.16464f49621bdefb0c896c157cbba70f6702c2b8834da0c3701159aacb87c00a
     56 #+mdevd.cc774d300e9aec30ab881a8738e9a026ac29639bed6064ac25c376dbe8268a21
     57 #+s6-linux-utils.7fdc2d1667b36bba6114bb739fc0a6034a998f7e20788a767909c71c74834b22
     58 #+s6-rc.d8d4c40c6f4dae9aeff4d8e34080c4639be0a0d7162f70e1de83efbc2668542a
     59 #+s6.dfb355b1f9eb35cd625fb58c988fc853cbe14673fdaf12ea34e75fe5c36d860a
     60 #+zsh.bcee316426fa08a87a1cdbd36d4192206516d31160995f7cb40171cedd8cfa2f
     61 #+libcgroup.b965840ad051883db316a3df064f53b4562cddf8738dea3aa31a3464b23070c8
     62 #+system-config-scripts.35c642cad58c3945c2c3caa525fce3946ba87d0710adaf13efec1db79da75729
     63 #+logincaps.2b0ab362af6ad1bb0e7988a4aaa7971eb5095d892a0d280c515200255f4940ad
     64 #+busybox.aea69a6a1ec89241b2fd65771f228ede99e7184ee9a34e97af68423d27117348
     65 #@git:60676483382c2f248901acfb2669c3ea16d49bf1: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() {
     76 	printf >&2 'Error: %s\n' "$1"
     77 	exit 1
     78 }
     79 err_notfound() {
     80 	err "File not provided by environment: '$1'"
     81 }
     82 linkdep() {
     83 	test -e "$pthbs_build_environment/$1" || err_notfound "$1"
     84 	rp=$(realpath "$pthbs_build_environment/$1") || err_notfound "$1"
     85 	case $1 in
     86 		(/*)
     87 			err "malformed linkdep path: '$1'"
     88 			;;
     89 		(*/)
     90 			err "malformed linkdep path: '$1'"
     91 			;;
     92 		(command/*)
     93 			if ! test -x "$rp"; then
     94 				err "not an executable: '$rp' (linked from '$1')"
     95 			fi
     96 			;;
     97 		(*)
     98 			if ! test -f "$rp"; then
     99 				err "not a file: '$rp' (linked from '$1')"
    100 			fi
    101 			;;
    102 	esac
    103 	if test -e "$dest/deps/$1"; then
    104 		err "Already linked deps/$1 to $(realpath "$dest/deps/$1"), want $rp"
    105 	fi
    106 	mkdir -p "$dest/deps/$(dirname "$1")"
    107 	ln -sf "$rp" "$dest/deps/$1"
    108 }
    109 
    110 printf '%s\n' >config/etc/motd \
    111 	"Welcome to $(cat ./config/hostname)!" \
    112 	'Current running configuration was generated from system-config:60676483382c2f248901acfb2669c3ea16d49bf1' \
    113 	'Last change on 2026-10-08 15:02:06 +0000 by Jan Pobrislo'
    114 
    115 printf '%s\n' >config/etc/skel/loginexec \
    116 	"#!$(which execlineb) -S0" \
    117 	'user_loginexec $@'
    118 chmod +x config/etc/skel/loginexec
    119 
    120 env 'pthbs_path_system-config'="$prefix" \
    121 	'pthbs_path_containers=/home/ccx/versions/env.1b5da60e1a74db8c2e69a34b41d9f8c398de3a3a17db8ba0d527bc98867677af' \
    122 	'pthbs_path_mdevd=/home/ccx/versions/env.4303ddbb9c72e04498d5a15b0ae0078750afd60205f383d2e89aaa8f125630f8' \
    123 	make -j${JOBS:-1} -l$((1+${JOBS:-1})) all
    124 
    125 sort -u build/linkdep_list | while IFS= read fname; do
    126 	linkdep "$fname"
    127 done
    128 
    129 mkdir "$dest/command"
    130 awk -v "zsh=$(which zsh)" <./postinstall >"$dest/command/install-as-current-environment.postinstall" '
    131 NR==1 { print "#!" zsh; next }
    132 /@@current@@/ { print "current=/run/current"; next }
    133 /@@versions@@/ { print "versions='/home/ccx/versions'"; next }
    134 1
    135 '
    136 chmod +x "$dest/command/install-as-current-environment.postinstall"
    137 
    138 mkdir -p "$dest/config/"
    139 rsync -ai ./config/ "$dest/config/"
    140 rsync -ai ./out/ "$dest/config/"
    141 mv -v keys "$dest/"
    142 
    143 
    144 
    145 
    146 cd "$pthbs_destdir/home/ccx/versions/$pthbs_package"
    147 find -type d -o -print | awk -F/ '
    148 BEGIN {
    149 	x["./command/install-as-current-environment.postinstall"]=1
    150 	x["./config/etc/fstab"]=1
    151 	x["./config/etc/motd"]=1
    152 	x["./config/etc/skel/loginexec"]=1
    153 	x["./config/hostname"]=1
    154 	x["./keys/ssh/authorized_keys/root"]=1
    155 }
    156 
    157 function r1(s) {
    158 	sub("^[.]/[^/]*", ".", s)
    159 	return s
    160 }
    161 function s1(repl, s) {
    162 	sub("^[.]/[^/]*", "./"repl, s)
    163 	return s
    164 }
    165 function link(src) {
    166 	x[$0]=0
    167 	printf "%s\t%s\n", $0, src
    168 	printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr"
    169 }
    170 $1!="."{exit 1}
    171 $2 == "env" { link($0); next }
    172 $2 == ".env-template" { link($0); next }
    173 
    174 $2 == "command" { link($0); next }
    175 $2 == "command" { link($0); next }
    176 $2 == "bin" { link(s1("command", $0)); next }
    177 $2 == "sbin" { link(s1("command", $0)); next }
    178 
    179 $2 == "library.so" { link($0); next }
    180 $2 == "library" { link($0); next }
    181 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next }
    182 $2 == "lib" && $NF ~ /\.so(\..*)?$/ { link(s1("library.so", $0)); next }
    183 
    184 $2 == "share" && $3 == "info" { link(s1("info", r1($0))); next }
    185 $2 == "share" && $3 == "man" { link(s1("man", r1($0))); next }
    186 $2 == "share" && $3 == "doc" { link(s1("doc", r1($0))); next }
    187 
    188 $2 == "config" { link($0); next }
    189 $2 == "man" { link($0); next }
    190 $2 == "info" { link($0); next }
    191 $2 == "doc" { link($0); next }
    192 $2 == "data" { link($0); next }
    193 $2 == "include" { link($0); next }
    194 
    195 $2 == "share" && $3 ~ /^(icons|terminfo)$/ { link(r1($0)); next }
    196 
    197 $2 == "library.ocaml" { link($0); next }
    198 
    199 $2 == "keys" { link($0); next }
    200 $2 == "zsh" { link($0); next }
    201 $2 == "vimfiles" { link($0); next }
    202 $2 == "icons" { link($0); next }
    203 $2 == "terminfo" { link($0); next }
    204 
    205 
    206 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" }
    207 
    208 END {
    209 	for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" }
    210 	retcode = 0
    211 	for(fname in x) {
    212 		if(x[fname]) {
    213 			printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr"
    214 			retcode = 3
    215 		}
    216 	}
    217 	exit retcode
    218 }' >.install-links.new
    219 mv .install-links.new .install-links
    220