mrrl

Minimal Reliable Reproducible Linux
git clone https://ccx.te2000.cz/git/mrrl
Log | Files | Refs | Submodules | README

containers (4923B)


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