aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWynn Wolf Arbor2020-05-27 21:48:14 +0200
committerWynn Wolf Arbor2020-05-27 21:48:14 +0200
commit5d12f42bb6d8f339dbe76689a0fb2afa51f994d9 (patch)
tree0f9e83ef29af6c0634f91164fee69eb284052fc6
parent3bd87dc46ff202ee3d37e9d5e3e0c5ebfe504bba (diff)
downloadskein-5d12f42bb6d8f339dbe76689a0fb2afa51f994d9.tar.gz
cgit-chroot: Rename to skein-infra
Be more clear about the purpose of this script and rename it to "skein-infra" since users might expect a program carrying "chroot" in its name to enter or otherwise manage a chroot. Additionally, use a consistent format for the environment variables controlling the locations of the cgit chroot and git repositories.
-rw-r--r--Makefile4
-rw-r--r--README.md2
-rwxr-xr-xskein-infra (renamed from cgit-chroot)26
3 files changed, 16 insertions, 16 deletions
diff --git a/Makefile b/Makefile
index 9c44387..02257a8 100644
--- a/Makefile
+++ b/Makefile
@@ -9,9 +9,9 @@ LDFLAGS ?= -static
cgit-about-filter: cgit-about-filter.c
${CC} -o $@ ${CFLAGS} ${LDFLAGS} $<
-install: cgit-chroot cgit-about-filter
- install -D -m 755 -t '${DESTDIR}${LIBEXECDIR}/skein' cgit-chroot
+install: cgit-about-filter skein-infra
install -D -m 755 -t '${DESTDIR}${LIBEXECDIR}/skein' cgit-about-filter
+ install -D -m 755 -t '${DESTDIR}${LIBEXECDIR}/skein' skein-infra
clean:
rm cgit-about-filter
diff --git a/README.md b/README.md
index a0cd413..ffa0751 100644
--- a/README.md
+++ b/README.md
@@ -5,6 +5,6 @@ extensible deployment of cgit using OpenBSD's slowcgi(8).
## Utilities
-- cgit-chroot - set up skein's cgit chroot environment
+- skein-infra - set up skein's cgit chroot infrastructure
- cgit-about-filter - a C implementation of a simple about-filter for
cgit using mandoc(1) and lowdown(1).
diff --git a/cgit-chroot b/skein-infra
index 5d229db..44f55a5 100755
--- a/cgit-chroot
+++ b/skein-infra
@@ -2,11 +2,11 @@
set -e
-CGIT_CHROOT=${CGIT_CHROOT:-/srv/cgit}
-CGIT_GIT_ROOT=${CGIT_GIT_ROOT:-/srv/git}
+SKEIN_CGIT_ROOT=${SKEIN_CGIT_ROOT:-/srv/cgit}
+SKEIN_GIT_ROOT=${SKEIN_GIT_ROOT:-/srv/git}
usage() {
- printf 'usage: cgit-chroot setup|teardown\n' >&2
+ printf 'usage: skein-infra setup|teardown\n' >&2
exit 1
}
@@ -23,7 +23,7 @@ ldel() {
}
remove_prefix() {
- printf "%s" "${1#$CGIT_CHROOT/*}"
+ printf "%s" "${1#$SKEIN_CGIT_ROOT/*}"
}
bind_mount() {
@@ -40,19 +40,19 @@ bind_umount() {
}
setup() {
- mkdir "$CGIT_CHROOT"/dev
- mknod "$CGIT_CHROOT"/dev/null c 1 3
- chmod 666 "$CGIT_CHROOT"/dev/null
+ mkdir "$SKEIN_CGIT_ROOT"/dev
+ mknod "$SKEIN_CGIT_ROOT"/dev/null c 1 3
+ chmod 666 "$SKEIN_CGIT_ROOT"/dev/null
- for i in "$CGIT_CHROOT"/instances/*; do
+ for i in "$SKEIN_CGIT_ROOT"/instances/*; do
test -d "$i" || continue
user=$(basename "$i")
id -ru "$user" >/dev/null || continue
- git_repo_dir="${CGIT_GIT_ROOT}/$user"
+ git_repo_dir="${SKEIN_GIT_ROOT}/$user"
test -d "$git_repo_dir" || continue
- instance_repo_dir="$CGIT_CHROOT"/instances/$user/repos
+ instance_repo_dir="$SKEIN_CGIT_ROOT"/instances/$user/repos
bind_mount "$git_repo_dir" "$instance_repo_dir"
chmod 0701 "$instance_repo_dir"
@@ -60,10 +60,10 @@ setup() {
}
teardown() {
- rm "$CGIT_CHROOT"/dev/null
- rmdir "$CGIT_CHROOT"/dev
+ rm "$SKEIN_CGIT_ROOT"/dev/null
+ rmdir "$SKEIN_CGIT_ROOT"/dev
- for i in "$CGIT_CHROOT"/instances/*/repos; do
+ for i in "$SKEIN_CGIT_ROOT"/instances/*/repos; do
bind_umount "$i"
done
}