pthbs

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

mdev-scripts (1951B)


      1 #!/usr/bin/env pthbs-build
      2 #+busybox.e60885fe93ee85c01831673bb29f0e62a64903f4ce3094e3dc35bc8ec8887ad9
      3 #+zsh.2ff36a2aed3e11c13386bad0938fa166a6824f8b03b238a97b2922bca3678b2c
      4 #+pthbs-banginstall.0190099d7db974b8ac922bc571bb572989f6a7e1018400f466173a158a98224c
      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