carbon-config

config submodule of carbon-core-system
git clone https://ccx.te2000.cz/git/carbon-config
Log | Files | Refs

commit 233bdc8aaca2891fa3244677955593b4f7a278c2
parent fb296d77fdc90f6ac084c177eaef93fd95d7fae5
Author: Jan Pobrislo <ccx@webprojekty.cz>
Date:   Thu, 28 Jul 2022 11:13:50 +0200

Move condition to do s6-rc to the main function.

Diffstat:
Mpostinstall | 53+++++++++++++++++++++++++++++------------------------
1 file changed, 29 insertions(+), 24 deletions(-)

diff --git a/postinstall b/postinstall @@ -98,32 +98,30 @@ setup_storage() { setup_rc() { local diff_ret - if [[ -d /run/s6-rc/ ]]; then - diff --recursive --unified $preinstall_current_p/s6-rc-source ./s6-rc-source; diff_ret=$? - (( $diff_ret == 0 || $diff_ret == 1 )) || \ - die111 "Could not diff s6-rc-source directories; exitcode $diff_ret" - if link_changed package; then - if (( $diff_ret == 1 )); then - # Both s6-rc DB source and installed software changed. - # s6-rc-format-upgrade to tmpdir, then s6-rc-update - local tmp_db=/run/old-s6-rc-db-migration.$EPOCHREALTIME - - s6-rc-compile $tmp_db $preinstall_current_p/s6-rc-source || return $? - s6-rc-format-upgrade -v2 $tmp_db || return $? - s6-rc-update -v2 /current/s6-rc-db/ || return $? - rm -r $tmp_db || return $? - else - # Installed software changed but s6-rc DB source is the same. - # s6-rc-format-upgrade to new compiled DB directly - s6-rc-format-upgrade -v2 /current/s6-rc-db/ || return $? - fi - elif (( $diff_ret == 1 )); then - # s6-rc DB source changed while keeping same version of software. - # s6-rc-update to new compiled DB directly + diff --recursive --unified $preinstall_current_p/s6-rc-source ./s6-rc-source; diff_ret=$? + (( $diff_ret == 0 || $diff_ret == 1 )) || \ + die111 "Could not diff s6-rc-source directories; exitcode $diff_ret" + if link_changed package; then + if (( $diff_ret == 1 )); then + # Both s6-rc DB source and installed software changed. + # s6-rc-format-upgrade to tmpdir, then s6-rc-update + local tmp_db=/run/old-s6-rc-db-migration.$EPOCHREALTIME + + s6-rc-compile $tmp_db $preinstall_current_p/s6-rc-source || return $? + s6-rc-format-upgrade -v2 $tmp_db || return $? s6-rc-update -v2 /current/s6-rc-db/ || return $? + rm -r $tmp_db || return $? + else + # Installed software changed but s6-rc DB source is the same. + # s6-rc-format-upgrade to new compiled DB directly + s6-rc-format-upgrade -v2 /current/s6-rc-db/ || return $? fi - + elif (( $diff_ret == 1 )); then + # s6-rc DB source changed while keeping same version of software. + # s6-rc-update to new compiled DB directly + s6-rc-update -v2 /current/s6-rc-db/ || return $? fi + } setup_fileset() { @@ -150,14 +148,21 @@ postinstall() { ensure_symlink /command current/command || return $? setup_static_symlinks || return $? + if [[ -d /run/s6-rc/ ]]; then # TODO: determine mountpoint changes setup_storage || return $? mount -a || return $? fi + setup_fileset || return $? - setup_rc || return $? + + if [[ -d /run/s6-rc/ ]]; then + setup_rc || return $? + fi + setup_skel || return $? + exit 0 } typeset -ft postinstall