system-config (4794B)
1 #!/usr/bin/env pthbs-build 2 #+busybox.d2d7aa00eac6ec561a10d126b1866f22e226a1276307466251e80fd8a4a1ebc7 3 #+busybox-findutils.85b2328981df683d1ae7597eebdf3a332aa4241b936c0030fe3618cec1f4841a 4 #+nawk.20e61757d30ba2271f207e142d393eb446a3ce4af79060fea9822a996e9eee29 5 #+diffutils.156555a911f29226b4808f1cf6a96ba5b0f8f0bc6b0807c8dce0304797940ea5 6 #+gnu-make.75a726f6c19f7bc10b95a84da3ce72fb785ebdf587504430c6b74cfb6610b728 7 #+aat.b07d881efe36d857a7b3e6b369a618bfbaf0de0c78be1a7364f7a2d8760a7e14 8 #+fileset.b8c4349ee9a6c22e146227a2edd69b8d1193386cfd937c9a470ae89b8d3d4dd8 9 #+rsync.c5cc99cab95e21c4d120f3cec027a3544b92f42016d43fb064458794fd7971dc 10 #+execline.6b4951a98fd1ceab65adb101d074d9e5e3e910334cc738bc8030e3695a781e95 11 #+kbd.3f2f437509ac5e194ab55c66e0ce706899e6cd45820671aaa0758cc3627d2d47 12 #+mdevd.a1b7799db44de80cd0545c0bb67d51fdca15e597bd6d7719c107816e82052ecf 13 #+s6-linux-utils.b3929f9660e7cd0fbccbd507f9e716d94b8d02a1d25da1eaf9362fd8d1c447c2 14 #+s6-rc.737102a642020fff6ac351c057d432fe934c04cd38a05077d5e1c6d084f78dba 15 #+s6.b2888ce412a12e54f60be31ae842d7405491fff647b8ee55c00b521bfa1dd4cc 16 #+zsh.bed9ea9a52d1f132b02ecfc77bfb4144826360a73e4b68c2b16e943a5e22c77e 17 #+system-config-scripts.1a9ea91106c0a3f813a9cf909962f3e6b4be7ec9f9a140df9a04ce2c14745d7e 18 #+logincaps.8dc1cf8b1413449938741555894af08b94abf904eca77fb2d47e98033906c382 19 #+busybox.84627fc1ea96a76909a029ec67836d48f419f4bf683ba5af0048259a4aed1d7f 20 #@git:ddb20e067ab184cd18ee8b88d74044dfeeaaad4c:system-config 21 22 23 # - build script start - 24 25 prefix=/home/ccx/versions/$pthbs_package 26 dest=${pthbs_destdir%/}${prefix} 27 cd 'system-config' 28 29 30 err_notfound() { 31 printf >&2 'Executable not found for command "%s"\n' "$1" 32 exit 1 33 } 34 linkdep() { 35 exe=$(command which "$1") || err_notfound "$1" 36 exe=$(realpath "$exe") 37 name=$(basename "$1") 38 if ! test -x "$exe"; then 39 printf 'Error: executable not found: %s\n' "$1" 40 fi 41 mkdir -p "$dest/deps/command" 42 ln -sf $exe "$dest/deps/command/$name" 43 } 44 45 printf '%s\n' >config/etc/motd \ 46 "Welcome to $(cat ./config/hostname)!" \ 47 'Current running configuration was generated from system-config:ddb20e067ab184cd18ee8b88d74044dfeeaaad4c' \ 48 'Last change on 2025-10-12 12:39:15 +0000 by Jan Pobrislo' 49 50 printf '%s\n' >config/etc/skel/loginexec \ 51 "#!$(which execlineb) -S0" \ 52 'user_loginexec $@' 53 chmod +x config/etc/skel/loginexec 54 55 env 'pthbs_path_system-config'="$prefix" \ 56 'pthbs_path_containers=/home/ccx/versions/env.50c26f326000a8265b410bb816109b80d94df8ee6ada5492d064e8af36ea48ce' \ 57 'pthbs_path_mdevd=/home/ccx/versions/env.82195384fc52e1f402c265aa01fa3c112934e9afd30214f67ec37e8da2634ef4' \ 58 make -j${JOBS:-1} -l$((1+${JOBS:-1})) all 59 60 sort -u build/execfile | while IFS= read exename; do 61 linkdep "$exename" 62 done 63 64 mkdir "$dest/command" 65 awk -v "zsh=$(which zsh)" <./postinstall >"$dest/command/install-as-current-environment.postinstall" ' 66 NR==1 { print "#!" zsh; next } 67 /@@current@@/ { print "current=/run/current"; next } 68 /@@versions@@/ { print "versions='/home/ccx/versions'"; next } 69 1 70 ' 71 chmod +x "$dest/command/install-as-current-environment.postinstall" 72 73 mkdir -p "$dest/config/" 74 rsync -ai ./config/ "$dest/config/" 75 rsync -ai ./out/ "$dest/config/" 76 mv -v keys "$dest/" 77 78 79 80 81 cd "$pthbs_destdir/home/ccx/versions/$pthbs_package" 82 find -type d -o -print | awk -F/ ' 83 BEGIN { 84 x["./command/install-as-current-environment.postinstall"]=1 85 x["./config/etc/fstab"]=1 86 x["./config/etc/motd"]=1 87 x["./config/etc/skel/loginexec"]=1 88 x["./config/hostname"]=1 89 x["./keys/ssh/authorized_keys/root"]=1 90 } 91 92 function r1(s) { 93 sub("^[.]/[^/]*", ".", s) 94 return s 95 } 96 function s1(repl, s) { 97 sub("^[.]/[^/]*", "./"repl, s) 98 return s 99 } 100 function link(src) { 101 x[$0]=0 102 printf "%s\t%s\n", $0, src 103 printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr" 104 } 105 $1!="."{exit 1} 106 107 108 $2 == "config" { link($0); next } 109 $2 == "keys" { link($0); next } 110 $2 == "zsh" { link($0); next } 111 $2 == "env" { link($0); next } 112 $2 == "command" { link($0); next } 113 $2 == "bin" { link(s1("command", $0)); next } 114 115 $2 == "library.so" { link($0); next } 116 $2 == "library" { link($0); next } 117 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next } 118 $2 == "lib" && $NF ~ /\.so(\..*)?$/ { link(s1("library.so", $0)); next } 119 120 $2 == "share" && $3 ~ /^(info|man|doc|icons|terminfo)$/ { link(r1($0)); next } 121 122 $2 == "man" { link($0); next } 123 $2 == "info" { link($0); next } 124 $2 == "doc" { link($0); next } 125 $2 == "icons" { link($0); next } 126 $2 == "terminfo" { link($0); next } 127 $2 == "data" { link($0); next } 128 $2 == "include" { link($0); next } 129 130 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" } 131 132 END { 133 for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" } 134 for(fname in x) { 135 if(x[fname]) { 136 printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr" 137 exit 3 138 } 139 } 140 }' >.install-links.new 141 mv .install-links.new .install-links 142