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