commit 9d4336782a09b5dd62d4c402b14ed63d62274c5b
parent 4f673f1c149052f49c3bc1b12c1feeb342963d90
Author: ccx <root@dorje.wpr.cz>
Date: Thu, 11 Mar 2021 13:21:11 +0100
Added s6-rc
Diffstat:
3 files changed, 46 insertions(+), 11 deletions(-)
diff --git a/.gitmodules b/.gitmodules
@@ -1,3 +1,6 @@
[submodule "slashpackage"]
path = package
url = /home/ccx/git/slashpackage
+[submodule "carbon-s6-rc"]
+ path = s6-rc
+ url = https://ccx.te2000.cz/git/carbon-s6-rc
diff --git a/install b/install
@@ -1,7 +1,9 @@
#!/bin/zsh
setopt no_unset warn_create_global extended_glob
-zmodload -F zsh/stat b:zstat
-zmodload -m -F zsh/files b:zf_\*
+zmodload -F zsh/stat b:zstat || exit $?
+zmodload -m -F zsh/files b:zf_\* || exit $?
+zmodload zsh/zutil || exit $?
+
cd $0:h || exit $?
require() {
@@ -35,9 +37,19 @@ install_package() {
exec env slashpackage=${sm_dst[$submodule]} ./install-all
}
+install_rc() {
+ local dst=${sm_dst[$submodule]}
+ local cmd=${sm_dst[package]}/command
+ mkdir -p $dst/s6-rc/source || exit $?
+ ( cd $submodule && git archive --format=tar $commit ) | tar -xC $dst/s6-rc/source
+ ((${(j.|.)pipefail})) && exit 1 # exit if git archive or tar exited non-zero
+ $cmd/s6-rc-compile $dst/s6-rc/source $dst/s6-rc/compiled || exit $?
+}
+
install_submodule() {
case $submodule in
(package) install_package;;
+ (s6-rc) install_rc;;
(*) echo >&2 "unhandled submodule: ${(qqq)submodule}";;
esac
}
@@ -46,9 +58,13 @@ check_installed() {
[[ -f ${sm_dst[$submodule]}/.done ]]
}
make_installed() {
+ local dst=${sm_dst[$submodule]}
git submodule update --recursive --force $submodule || exit $?
+ if [[ -e $dst ]]; then
+ rm -r $dst || exit $?
+ fi
( cd $submodule && install_submodule ) || exit $?
- touch ${sm_dst[$submodule]}/.done
+ touch $dst/.done
}
typeset -f -t make_installed
@@ -84,15 +100,30 @@ typeset -f -t make_union
typeset -g submodule
typeset -gA sm_commit sm_dst
-submodule=.
-require committed
-sm_commit[.]=$(git show -s --pretty=format:%H%n) || exit $?
-sm_dst[.]=/versions/all.${sm_commit[.]}
+submodule() {
+ local -a do_commit
+ zparseopts -D c=do_commit
+ submodule=$1
+ if ! [[ -d $1 ]]; then
+ git submodule update --recursive $submodule || exit $?
+ fi
+ (($#do_commit)) && require committed
+ sm_commit[$submodule]=$(cd $submodule && git show -s --pretty=format:%H%n) || exit $?
+ if [[ $submodule == . ]]; then
+ sm_dst[.]=/versions/all.${sm_commit[.]}
+ else
+ sm_dst[$submodule]=/versions/$submodule.${sm_commit[$submodule]}
+ fi
+}
+typeset -f -t submodule
+
+submodule -c s6-rc
+submodule -c .
+
+submodule package
+require installed
-submodule=package
-#require committed
-sm_commit[$submodule]=$(cd $submodule && git show -s --pretty=format:%H%n) || exit $?
-sm_dst[$submodule]=/versions/$submodule.${sm_commit[$submodule]}
+submodule=s6-rc
require installed
submodule=.
diff --git a/s6-rc b/s6-rc
@@ -0,0 +1 @@
+Subproject commit cf87dc7f530a7f819ff7ee2b3fb7980dcb0edc53