pthbs

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

core-system-scripts (2153B)


      1 #!/usr/bin/env pthbs-build
      2 #+busybox.62e4b1201b20ef0faf051b0e9b3ad1d3fbf4d498b8a0910ce4845a9017323f62
      3 #+zsh.841d7010e0fe14991eb6173c03fd35eecda23c9693da65d121af20615e0dc5a0
      4 #+pthbs-banginstall.849e1bc924bc7d9eff0c2ce1c3a44bf38afbf6b2a5f1dfbea7c077f886646e7b
      5 #@git:98fabf6dffa7a3a7850f1797f557e181b7e8460f:core-system-scripts
      6 
      7 : ${JOBS:=1}
      8 prefix=/home/ccx/versions/$pthbs_package
      9 pkgdir="$pthbs_destdir/$prefix"
     10 mkdir -p "$pkgdir/"
     11 cd 'core-system-scripts'
     12 
     13 for d in bin sbin command; do
     14 	if test -d "$d"; then
     15 		pthbs-banginstall "$d"/* "$pkgdir"
     16 	fi
     17 done
     18 
     19 if test -d vim; then
     20 	mkdir -p "$pkgdir/vimfiles/pack/plugins/start"
     21 	mv -v vim "$pkgdir/vimfiles/pack/plugins/start/$pthbs_package"
     22 fi
     23 
     24 if test -d zsh-functions; then
     25 	mv -v zsh-functions "$pkgdir/"
     26 fi
     27 
     28 cd "$pthbs_destdir/home/ccx/versions/$pthbs_package"
     29 find -type d -o -print | awk -F/ '
     30 BEGIN {
     31 	x["./command/s"]=1
     32 	x["./command/issue-gen"]=1}
     33 
     34 function r1(s) {
     35 	sub("^[.]/[^/]*", ".", s)
     36 	return s
     37 }
     38 function s1(repl, s) {
     39 	sub("^[.]/[^/]*", "./"repl, s)
     40 	return s
     41 }
     42 function link(src) {
     43 	x[$0]=0
     44 	printf "%s\t%s\n", $0, src
     45 	printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr"
     46 }
     47 $1!="."{exit 1}
     48 
     49 
     50 $2 == "zsh-scripts" { link($0); next }
     51 $2 == "vimfiles" { link($0); next }
     52 $2 == "command" { link($0); next }
     53 $2 == "bin" { link(s1("command", $0)); next }
     54 
     55 $2 == "library.so" { link($0); next }
     56 $2 == "library" { link($0); next }
     57 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next }
     58 $2 == "lib" && $NF ~ /\.so(|\..*)$/ { link(s1("library.so", $0)); next }
     59 
     60 $2 == "share" && $3 ~ /^(info|man|doc|icons|terminfo)$/ { link(r1($0)); next }
     61 
     62 $2 == "man" { link($0); next }
     63 $2 == "info" { link($0); next }
     64 $2 == "doc" { link($0); next }
     65 $2 == "icons" { link($0); next }
     66 $2 == "terminfo" { link($0); next }
     67 
     68 $2 == "include" { link($0); next }
     69 
     70 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" }
     71 
     72 END {
     73 	for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" }
     74 	for(fname in x) {
     75 		if(x[fname]) {
     76 			printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr"
     77 			exit 3
     78 		}
     79 	}
     80 }' >.install-links.new
     81 mv .install-links.new .install-links