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 23eb1c356e461ce7629b66de60d87992bed64f26
Author: ccx <root@dorje.wpr.cz>
Date:   Wed, 10 Mar 2021 19:12:56 +0100

Initial commit

Diffstat:
A.gitmodules | 3+++
Ainstall-versioned-slashpackage | 54++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aslashpackage | 1+
3 files changed, 58 insertions(+), 0 deletions(-)

diff --git a/.gitmodules b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "slashpackage"] + path = slashpackage + url = /home/ccx/git/slashpackage diff --git a/install-versioned-slashpackage b/install-versioned-slashpackage @@ -0,0 +1,54 @@ +#!/bin/zsh +setopt no_unset warn_create_global extended_glob +cd $0:h || exit $? +typeset -g submodule=slashpackage + +set -x + +require() { + if ! check_$1; then + make_$1 + if ! check_$1; then + echo "ERROR: check_$1 failed after make_$1" + fi + fi +} + +check_committed() { + local git_status + git_status=$(cd $submodule && git status -s) || return $? + [[ -z $git_status ]] +} +make_committed() { + local REPLY + local -a empty_dirs + echo "Uncommited changes. Add and commit them?" + empty_dirs=( $submodule/(**~.git)/*(ND/^F) ) + (( $#empty_dirs )) && echo "WARNING: $#empty_dirs empty directories found." + read -q || exit 0 + ( cd $submodule && git add . && git commit ) || exit $? +} + +require committed + +typeset -g commit dst +commit=$(cd $submodule && git show -s --pretty=format:%H%n) || exit $? +dst=/versions/package.$commit + +install_all() { + git checkout --force || exit $? + git clean -fx || exit $? + git submodule update --force || exit $? + exec env slashpackage=$dst ./install-all +} + +check_compiled() { + [[ -f $dst/.done ]] +} +make_compiled() { + git submodule update --recursive --force $submodule || exit $? + ( cd $submodule && install_all ) || exit $? + touch $dst/.done +} +typeset -f -t make_compiled +require compiled diff --git a/slashpackage b/slashpackage @@ -0,0 +1 @@ +Subproject commit 26ac49acd9773a2bbae34c99d09483a374d370ce