carbon-core-system

Integration repository for versioned configuration and software on Carbon
git clone https://ccx.te2000.cz/git/carbon-core-system
Log | Files | Refs | Submodules

commit 14b0535d3eeddf7c232b1cee093d5a83ac25624f
parent 10e0aff32196ca646eec267b1a4a011dc41fe2f8
Author: ccx <root@dorje.wpr.cz>
Date:   Mon, 21 Feb 2022 02:37:23 +0100

Create and verify symlinks for /command and /etc/loginexec

Diffstat:
Minstall | 27++++++++++++++++++++++++++-
1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/install b/install @@ -220,7 +220,31 @@ preinstall() { } #typeset -ft preinstall +ensure_symlink() { + local target + if ! [[ -e $1 ]]; then + s6-ln -s $2 $1 || return $? + fi + + if [[ $2 == /* ]]; then + target=$2:A + else + target=$1:h/$2 + target=$target:A + fi + + if ! [[ -h $1 ]]; then + echo >&2 "Error: not a symlink: ${(qqq)1}" + return 1 + elif [[ $1:A != $target ]]; then + echo >&2 "Error: ${(qqq)1} points to ${(qqq)1:A} instead of ${(qqq)target}" + return 1 + fi +} + postinstall() { + ensure_symlink /etc/loginexec ../current/bzr/logincaps/etc/loginexec + ensure_symlink /command current/command if [[ -d /run/s6-rc/ ]]; then if link_changed package; then @@ -240,9 +264,10 @@ postinstall() { # s6-rc-update to new source directly s6-rc-update -v2 /current/s6-rc-db/ || return $? fi + if link_changed bzr/containers || link_changed bzr/confz; then zsh -lc "quiet=1 confz site_containers" </dev/null 2>&1 | cat -v - ret=$((${(j.|.)pipestatus})) + ret=$((${(j.|.)pipestatus})) # Nonzero iff any of commands in pipeline returned nonzero. if (($ret)); then echo >&2 "Error: command failed ($ret): confz site_containers" return $ret