pthbs

Packaging Through Hashed Build Scripts
git clone https://ccx.te2000.cz/git/pthbs
Log | Files | Refs | Submodules | README

core-system-rc (2174B)


      1 #!/usr/bin/env pthbs-build
      2 #+busybox.62e4b1201b20ef0faf051b0e9b3ad1d3fbf4d498b8a0910ce4845a9017323f62
      3 #+busybox-diffutils.a6afab49e576f623b9ad163b5c4b3cb20aa8afd67900035e10a311120d2c6934
      4 #+s6-rc.89bacaaa86979b436e879c3e8fecb8a0a65998401423b8df358344e9da462c76
      5 #+fileset.37af839aac99d29b668754b76018e789e3e734158468c6972e3d401845d816f6
      6 #+core-system-conf.88418cb3216fa8ff4c0891e83d1ebf907ea33da3d066e8e9b6f785546dd1428b
      7 
      8 conf=/home/ccx/versions/core-system-conf.88418cb3216fa8ff4c0891e83d1ebf907ea33da3d066e8e9b6f785546dd1428b/core-system-conf
      9 prefix=/home/ccx/versions/$pthbs_package
     10 pkgdir="$pthbs_destdir/$prefix"
     11 mkdir -p "$pkgdir/s6-rc-source"
     12 cd "$pkgdir/"
     13 fsapply ./s6-rc-source "$conf/s6-rc.fileset"
     14 if !  [[ -f ./s6-rc-source/ok-all/type ]]; then
     15 	printf '%s\n' "Failed to generate s6-rc source directory"
     16 	exit 111
     17 fi
     18 s6-rc-compile ./s6-rc-db ./s6-rc-source
     19 
     20 
     21 cd "$pthbs_destdir/home/ccx/versions/$pthbs_package"
     22 find -type d -o -print | awk -F/ '
     23 BEGIN {
     24 }
     25 
     26 function r1(s) {
     27 	sub("^[.]/[^/]*", ".", s)
     28 	return s
     29 }
     30 function s1(repl, s) {
     31 	sub("^[.]/[^/]*", "./"repl, s)
     32 	return s
     33 }
     34 function link(src) {
     35 	x[$0]=0
     36 	printf "%s\t%s\n", $0, src
     37 	printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr"
     38 }
     39 $1!="."{exit 1}
     40 
     41 
     42 $2 == "s6-rc-db" { link($0); next }
     43 $2 == "command" { link($0); next }
     44 $2 == "bin" { link(s1("command", $0)); next }
     45 
     46 $2 == "library.so" { link($0); next }
     47 $2 == "library" { link($0); next }
     48 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next }
     49 $2 == "lib" && $NF ~ /\.so(|\..*)$/ { link(s1("library.so", $0)); next }
     50 
     51 $2 == "share" && $3 ~ /^(info|man|doc|icons|terminfo)$/ { link(r1($0)); next }
     52 
     53 $2 == "man" { link($0); next }
     54 $2 == "info" { link($0); next }
     55 $2 == "doc" { link($0); next }
     56 $2 == "icons" { link($0); next }
     57 $2 == "terminfo" { link($0); next }
     58 
     59 $2 == "include" { link($0); next }
     60 
     61 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" }
     62 
     63 END {
     64 	for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" }
     65 	for(fname in x) {
     66 		if(x[fname]) {
     67 			printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr"
     68 			exit 3
     69 		}
     70 	}
     71 }' >.install-links.new
     72 mv .install-links.new .install-links