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