system-config-zsh (1826B)
1 #!/usr/bin/env pthbs-build 2 #+busybox.e60885fe93ee85c01831673bb29f0e62a64903f4ce3094e3dc35bc8ec8887ad9 3 #+zsh.2ff36a2aed3e11c13386bad0938fa166a6824f8b03b238a97b2922bca3678b2c 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