mrrl

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

genlinks (1787B)


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