mrrl

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

system-config (2556B)


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