pthbs

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

system-config (2221B)


      1 {% extends "genlinks" %}
      2 {%- block script %}
      3 #+{{pkg_install_name("busybox")}}
      4 #+{{pkg_install_name("diffutils")}}
      5 #+{{pkg_install_name("gnu-make")}}
      6 #+{{pkg_install_name("aat")}}
      7 #+{{pkg_install_name("fileset")}}
      8 #+{{pkg_install_name("rsync")}}
      9 #+{{pkg_install_name("execline")}}
     10 #+{{pkg_install_name("kbd")}}
     11 #+{{pkg_install_name("mdevd")}}
     12 #+{{pkg_install_name("s6-linux-utils")}}
     13 #+{{pkg_install_name("s6-rc")}}
     14 #+{{pkg_install_name("s6")}}
     15 #+{{pkg_install_name("zsh")}}
     16 #+{{pkg_install_name("system-config-scripts")}}
     17 #+{{pkg_install_name("logincaps")}}
     18 #@git:{{submodule.current[name]}}:{{name}}
     19 
     20 {% include "functions/vars" %}
     21 def_prefix
     22 def_dest
     23 err_notfound() {
     24 	printf >&2 'Executable not found for command "%s"\n' "$1"
     25 	exit 1
     26 }
     27 linkdep() {
     28 	exe=$(command which "$1") || err_notfound "$1"
     29 	exe=$(realpath "$exe")
     30 	name=$(basename "$1")
     31 	if ! test -x "$exe"; then
     32 		printf 'Error: executable not found: %s\n' "$1"
     33 	fi
     34 	mkdir -p "$dest/deps/command"
     35 	ln -sf $exe "$dest/deps/command/$name"
     36 }
     37 
     38 cd '{{name}}'
     39 
     40 printf '%s\n' >config/etc/motd \
     41 	"Welcome to $(cat ./config/hostname)!" \
     42 	'Current running configuration was generated from {{name}}:{{submodule.current[name]}}' \
     43 	'Last change on {{submodule.commit_info(submodule.current[name])}}'
     44 
     45 printf '%s\n' >config/etc/skel/loginexec \
     46 	"#!$(which execlineb) -S0" \
     47 	'user_loginexec $@'
     48 chmod +x config/etc/skel/loginexec
     49 
     50 env 'pthbs_path_{{name}}'="$prefix" \
     51 	'pthbs_path_containers={{pkg_install_dir("containers.environment")}}' \
     52 	'pthbs_path_mdevd={{pkg_install_dir("mdevd.environment")}}' \
     53 	{{make}} all
     54 
     55 sort -u build/execfile | while IFS= read exename; do
     56 	linkdep "$exename"
     57 done
     58 
     59 mkdir "$dest/command"
     60 awk -v "zsh=$(which zsh)" <./postinstall >"$dest/command/install-as-current-environment.postinstall" '
     61 NR==1 { print "#!" zsh; next }
     62 /@@current@@/ { print "current=/run/current"; next }
     63 /@@versions@@/ { print "versions='{{versions}}'"; next }
     64 1
     65 '
     66 chmod +x "$dest/command/install-as-current-environment.postinstall"
     67 
     68 mkdir -p "$dest/config/"
     69 rsync -ai ./config/ "$dest/config/"
     70 rsync -ai ./out/ "$dest/config/"
     71 mv -v keys "$dest/"
     72 
     73 {% endblock -%}
     74 {% block rules %}
     75 $2 == "config" { link($0); next }
     76 $2 == "keys" { link($0); next }
     77 {% endblock -%}