pthbs

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

containers (3791B)


      1 #!/usr/bin/env pthbs-build
      2 #+busybox.e60885fe93ee85c01831673bb29f0e62a64903f4ce3094e3dc35bc8ec8887ad9
      3 #+zsh.2ff36a2aed3e11c13386bad0938fa166a6824f8b03b238a97b2922bca3678b2c
      4 #+pthbs-banginstall.0190099d7db974b8ac922bc571bb572989f6a7e1018400f466173a158a98224c
      5 #+execline.70f92114a71a2949f770fa2771b69b3b89b42b65cffb3247fbf2119614967ab5
      6 #@git:846ebdb1a0f1fd9168bd2cab98699ce1406c69cd: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.c9cdb867562a26201a1618e0b1bf2147e6cee6aff1a6901909ee911a4462327a/command/apk.static' "$pkgdir/deps/command/"
     41 ln -sf '/versions/xbps.9831b74b8d46bb8c240d6ba606b13d3a80d67804ddbce5e828bef08377d0f9b0/command/xbps-install.static' "$pkgdir/deps/command/"
     42 
     43 for f in '/versions/alpine-keys.c541ae09189f19994476df864795dd7c26486939981309be95de258ab1554fa1'/keys/alpine/*/*; do
     44 	d=$(basename "${f%/*}")
     45 	mkdir -p "$pkgdir/deps/keys/alpine/$d"
     46 	ln -sf "$f" "$pkgdir/deps/keys/alpine/$d/"
     47 done
     48  
     49 mkdir -p "$pkgdir/deps/keys/void"
     50 for f in '/versions/xbps.9831b74b8d46bb8c240d6ba606b13d3a80d67804ddbce5e828bef08377d0f9b0'/keys/void/*; do
     51 	ln -sf "$f" "$pkgdir/deps/keys/void/"
     52 done
     53 
     54 cd "$pthbs_destdir/versions/$pthbs_package"
     55 find -type d -o -print | awk -F/ '
     56 BEGIN {
     57 	x["./command/container_sysroot_run"]=1
     58 	x["./command/ns_run"]=1
     59 	x["./command/ns_umount_script.awk"]=1
     60 	x["./command/pidns_run.py"]=1
     61 	x["./zsh/site-functions/confz_containers_init"]=1
     62 	x["./zsh/site-functions/confz_site_containers_init"]=1}
     63 
     64 function r1(s) {
     65 	sub("^[.]/[^/]*", ".", s)
     66 	return s
     67 }
     68 function s1(repl, s) {
     69 	sub("^[.]/[^/]*", "./"repl, s)
     70 	return s
     71 }
     72 function link(src) {
     73 	x[$0]=0
     74 	printf "%s\t%s\n", $0, src
     75 	printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr"
     76 }
     77 $1!="."{exit 1}
     78 
     79 
     80 $2 == "zsh" { link($0); next }
     81 $2 == "vimfiles" { link($0); next }
     82 $2 == "command" { link($0); next }
     83 $2 == "bin" { link(s1("command", $0)); next }
     84 
     85 $2 == "library.so" { link($0); next }
     86 $2 == "library" { link($0); next }
     87 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next }
     88 $2 == "lib" && $NF ~ /\.so(|\..*)$/ { link(s1("library.so", $0)); next }
     89 
     90 $2 == "share" && $3 ~ /^(info|man|doc|icons|terminfo)$/ { link(r1($0)); next }
     91 
     92 $2 == "man" { link($0); next }
     93 $2 == "info" { link($0); next }
     94 $2 == "doc" { link($0); next }
     95 $2 == "icons" { link($0); next }
     96 $2 == "terminfo" { link($0); next }
     97 $2 == "data" { link($0); next }
     98 $2 == "include" { link($0); next }
     99 
    100 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" }
    101 
    102 END {
    103 	for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" }
    104 	for(fname in x) {
    105 		if(x[fname]) {
    106 			printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr"
    107 			exit 3
    108 		}
    109 	}
    110 }' >.install-links.new
    111 mv .install-links.new .install-links