snaprep (2184B)
1 #!/usr/bin/env pthbs-build 2 #+busybox.e60885fe93ee85c01831673bb29f0e62a64903f4ce3094e3dc35bc8ec8887ad9 3 #+zsh.2ff36a2aed3e11c13386bad0938fa166a6824f8b03b238a97b2922bca3678b2c 4 #+pthbs-banginstall.0190099d7db974b8ac922bc571bb572989f6a7e1018400f466173a158a98224c 5 #@git:e9d8af262eb5e25536ea9778e3ed57aebb55488c:snaprep 6 7 : ${JOBS:=1} 8 prefix=/versions/$pthbs_package 9 pkgdir="$pthbs_destdir/$prefix" 10 mkdir -p "$pkgdir/" 11 cd 'snaprep' 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 mkdir -p "$pkgdir/zsh" 26 mv -v zsh-functions "$pkgdir/zsh/site-functions" 27 fi 28 29 cd "$pthbs_destdir/versions/$pthbs_package" 30 find -type d -o -print | awk -F/ ' 31 BEGIN { 32 x["./command/snap.push"]=1 33 x["./command/snap.lvm2"]=1} 34 35 function r1(s) { 36 sub("^[.]/[^/]*", ".", s) 37 return s 38 } 39 function s1(repl, s) { 40 sub("^[.]/[^/]*", "./"repl, s) 41 return s 42 } 43 function link(src) { 44 x[$0]=0 45 printf "%s\t%s\n", $0, src 46 printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr" 47 } 48 $1!="."{exit 1} 49 50 51 $2 == "zsh" { link($0); next } 52 $2 == "vimfiles" { link($0); next } 53 $2 == "command" { link($0); next } 54 $2 == "bin" { link(s1("command", $0)); next } 55 56 $2 == "library.so" { link($0); next } 57 $2 == "library" { link($0); next } 58 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next } 59 $2 == "lib" && $NF ~ /\.so(|\..*)$/ { link(s1("library.so", $0)); next } 60 61 $2 == "share" && $3 ~ /^(info|man|doc|icons|terminfo)$/ { link(r1($0)); next } 62 63 $2 == "man" { link($0); next } 64 $2 == "info" { link($0); next } 65 $2 == "doc" { link($0); next } 66 $2 == "icons" { link($0); next } 67 $2 == "terminfo" { link($0); next } 68 $2 == "data" { link($0); next } 69 $2 == "include" { link($0); next } 70 71 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" } 72 73 END { 74 for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" } 75 for(fname in x) { 76 if(x[fname]) { 77 printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr" 78 exit 3 79 } 80 } 81 }' >.install-links.new 82 mv .install-links.new .install-links