mrrl

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

mdev-scripts (1951B)


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