containers (3805B)
1 #!/usr/bin/env pthbs-build 2 #+busybox.7818e9d6df97d97317c8fcdf404811731aa0c5c3ab7eb6aec00c9652b6da511c 3 #+zsh.39cfa85c387b3d316db3206c9eaba5a10751588267adb2884d33f5fb7253b57a 4 #+pthbs-banginstall.cd97cc1e4d09e23947e00c4c2ed4568c9f1745a7e6ecae9587b7b6bc674b5514 5 #+execline.d4fee837def832332b7e642764c80bef670c35b5e473f1590c4b56f88e2ae571 6 #@git:eb29ead3d752060a8d81442cfe3d8ae07053250d:containers 7 8 : ${JOBS:=1} 9 prefix=/versions/$pthbs_package 10 pkgdir="$pthbs_destdir/$prefix" 11 mkdir -p "$pkgdir/" 12 cd 'containers' 13 14 for d in bin sbin command; do 15 if test -d "$d"; then 16 pthbs-banginstall "$d"/* "$pkgdir" 17 fi 18 done 19 20 if test -d vim; then 21 mkdir -p "$pkgdir/vimfiles/pack/plugins/start" 22 mv -v vim "$pkgdir/vimfiles/pack/plugins/start/$pthbs_package" 23 fi 24 25 if test -d zsh-functions; then 26 mkdir -p "$pkgdir/zsh" 27 mv -v zsh-functions "$pkgdir/zsh/site-functions" 28 fi 29 mkdir "$pkgdir/data" 30 mv -v service_scripts container_template "$pkgdir/data/" 31 printf '%s\n' >"$pkgdir/zsh/site-functions/confz_containers_pthbs_init" \ 32 "typeset -g container_template_dir='$prefix/data/container_template'" \ 33 "typeset -g container_service_script_dir='$prefix/data/service_scripts'" \ 34 "typeset -g container_alpine_keys_dir='$prefix/deps/keys/alpine/x86_64'" \ 35 "typeset -g container_apk_executable='$prefix/deps/command/apk.static'" \ 36 "typeset -g container_void_keys_dir='$prefix/deps/keys/void'" \ 37 "typeset -g container_xbps_install_executable='$prefix/deps/command/xbps-install.static'" 38 39 mkdir -p "$pkgdir/deps/command" 40 ln -sf '/versions/apk-tools.3c5e644685924124c8d1ebdd43aa2ae96d40aa318bdae5f1210e33995ec73c67/command/apk.static' "$pkgdir/deps/command/" 41 ln -sf '/versions/xbps.7b73f74ee10f9a6cdc6eb172637b9dd9950954e450c22cfd16d4abb89d25b877/command/xbps-install.static' "$pkgdir/deps/command/" 42 43 for f in '/versions/alpine-keys.5286d3c99270626e30a72bc67c446be92edb62b7cf917d979f195a90baed3623'/keys/alpine/*/*; do 44 test -f "$f" 45 d=$(basename "${f%/*}") 46 mkdir -p "$pkgdir/deps/keys/alpine/$d" 47 ln -sf "$f" "$pkgdir/deps/keys/alpine/$d/" 48 done 49 50 mkdir -p "$pkgdir/deps/keys/void" 51 for f in '/versions/xbps.7b73f74ee10f9a6cdc6eb172637b9dd9950954e450c22cfd16d4abb89d25b877'/keys/void/*; do 52 ln -sf "$f" "$pkgdir/deps/keys/void/" 53 done 54 55 cd "$pthbs_destdir/versions/$pthbs_package" 56 find -type d -o -print | awk -F/ ' 57 BEGIN { 58 x["./command/container_sysroot_run"]=1 59 x["./command/ns_run"]=1 60 x["./command/ns_umount_script.awk"]=1 61 x["./command/pidns_run.py"]=1 62 x["./zsh/site-functions/confz_containers_init"]=1 63 x["./zsh/site-functions/confz_site_containers_init"]=1} 64 65 function r1(s) { 66 sub("^[.]/[^/]*", ".", s) 67 return s 68 } 69 function s1(repl, s) { 70 sub("^[.]/[^/]*", "./"repl, s) 71 return s 72 } 73 function link(src) { 74 x[$0]=0 75 printf "%s\t%s\n", $0, src 76 printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr" 77 } 78 $1!="."{exit 1} 79 80 81 $2 == "zsh" { link($0); next } 82 $2 == "vimfiles" { link($0); next } 83 $2 == "command" { link($0); next } 84 $2 == "bin" { link(s1("command", $0)); next } 85 86 $2 == "library.so" { link($0); next } 87 $2 == "library" { link($0); next } 88 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next } 89 $2 == "lib" && $NF ~ /\.so(|\..*)$/ { link(s1("library.so", $0)); next } 90 91 $2 == "share" && $3 ~ /^(info|man|doc|icons|terminfo)$/ { link(r1($0)); next } 92 93 $2 == "man" { link($0); next } 94 $2 == "info" { link($0); next } 95 $2 == "doc" { link($0); next } 96 $2 == "icons" { link($0); next } 97 $2 == "terminfo" { link($0); next } 98 $2 == "data" { link($0); next } 99 $2 == "include" { link($0); next } 100 101 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" } 102 103 END { 104 for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" } 105 for(fname in x) { 106 if(x[fname]) { 107 printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr" 108 exit 3 109 } 110 } 111 }' >.install-links.new 112 mv .install-links.new .install-links