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 6435a62560242457f44e878012ecfb43bd5df50b
parent 3054bc84b31ee25564b3d59affac223300797fa4
Author: ccx <root@dorje.wpr.cz>
Date:   Mon, 29 Mar 2021 20:13:00 +0200

Update "init" and make committing from ./install saner.

Diffstat:
Minstall | 13++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/install b/install @@ -17,13 +17,16 @@ require() { check_committed() { local git_status - git_status=$(cd $submodule && git status -s) || return $? - [[ -z $git_status ]] + local -a changes + git_status=$(cd $submodule && git status -s --ignore-submodules=dirty) || return $? + [[ -z $git_status ]] && return 0 + printf "Following changes found in %s:\n%s\n" $submodule "$git_status" + return 1 } make_committed() { local REPLY local -a empty_dirs - echo "Uncommited changes. Add and commit them?" + echo "Uncommitted changes. Add and commit them?" empty_dirs=( $submodule/(**~.git)/*(ND/^F) ) (( $#empty_dirs )) && echo "WARNING: $#empty_dirs empty directories found." read -q || exit 0 @@ -96,7 +99,6 @@ check_installed() { } make_installed() { local dst=${sm_dst[$submodule]} - git submodule update --recursive --force $submodule || exit $? if [[ -e $dst ]]; then rm -r $dst || exit $? fi @@ -129,9 +131,10 @@ submodule() { sm_dst[.]=/versions/all.${sm_commit[.]} else sm_dst[$submodule]=/versions/$submodule.${sm_commit[$submodule]} + git submodule update --recursive --force $submodule || exit $? fi } -typeset -f -t submodule +#typeset -f -t submodule # End of functions, now install things in right order