pthbs

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

pthbs-banginstall (1762B)


      1 #!/usr/bin/env pthbs-build
      2 #+busybox.e60885fe93ee85c01831673bb29f0e62a64903f4ce3094e3dc35bc8ec8887ad9
      3 #+zsh.2ff36a2aed3e11c13386bad0938fa166a6824f8b03b238a97b2922bca3678b2c
      4 #@sha256:1e021bddaf5c020ede9107656494715236a894557b99035365fc999605541b2d:pthbs-banginstall
      5 
      6 installdir="$pthbs_destdir//versions/$pthbs_package"
      7 mkdir -p "$installdir/command"
      8 chmod +x pthbs-banginstall
      9 zsh -x pthbs-banginstall pthbs-banginstall "$installdir"
     10 
     11 cd "$pthbs_destdir/versions/$pthbs_package"
     12 find -type d -o -print | awk -F/ '
     13 BEGIN {
     14 	x["./command/pthbs-banginstall"]=1
     15 }
     16 
     17 function r1(s) {
     18 	sub("^[.]/[^/]*", ".", s)
     19 	return s
     20 }
     21 function s1(repl, s) {
     22 	sub("^[.]/[^/]*", "./"repl, s)
     23 	return s
     24 }
     25 function link(src) {
     26 	x[$0]=0
     27 	printf "%s\t%s\n", $0, src
     28 	printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr"
     29 }
     30 $1!="."{exit 1}
     31 
     32 
     33 $2 == "command" { link($0); next }
     34 $2 == "bin" { link(s1("command", $0)); next }
     35 
     36 $2 == "library.so" { link($0); next }
     37 $2 == "library" { link($0); next }
     38 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next }
     39 $2 == "lib" && $NF ~ /\.so(|\..*)$/ { link(s1("library.so", $0)); next }
     40 
     41 $2 == "share" && $3 ~ /^(info|man|doc|icons|terminfo)$/ { link(r1($0)); next }
     42 
     43 $2 == "man" { link($0); next }
     44 $2 == "info" { link($0); next }
     45 $2 == "doc" { link($0); next }
     46 $2 == "icons" { link($0); next }
     47 $2 == "terminfo" { link($0); next }
     48 $2 == "data" { link($0); next }
     49 $2 == "include" { link($0); next }
     50 
     51 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" }
     52 
     53 END {
     54 	for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" }
     55 	for(fname in x) {
     56 		if(x[fname]) {
     57 			printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr"
     58 			exit 3
     59 		}
     60 	}
     61 }' >.install-links.new
     62 mv .install-links.new .install-links