summaryrefslogtreecommitdiffstats
path: root/gitolite
diff options
context:
space:
mode:
authorMalfurious <m@lfurio.us>2023-09-15 08:49:25 -0400
committerMalfurious <m@lfurio.us>2023-09-15 10:53:24 -0400
commitc1db5d6e6557ac5f3b9d408eb2de888bf096a370 (patch)
tree73b2ff4824313805629ee98efd1844fd7b636da1 /gitolite
parent5756572b09a78541d9d0d9fc6b21a6c006a99894 (diff)
downloadsrcnode-c1db5d6e6557ac5f3b9d408eb2de888bf096a370.tar.gz
srcnode-c1db5d6e6557ac5f3b9d408eb2de888bf096a370.zip
gitolite: Add admin initialization script
Per docker image changes, this serves as an alternative entrypoint for performing initial pubkey configuration. Signed-off-by: Malfurious <m@lfurio.us>
Diffstat (limited to 'gitolite')
-rw-r--r--gitolite/Dockerfile2
-rwxr-xr-xgitolite/initialize.sh16
2 files changed, 17 insertions, 1 deletions
diff --git a/gitolite/Dockerfile b/gitolite/Dockerfile
index e3ff032..5d34312 100644
--- a/gitolite/Dockerfile
+++ b/gitolite/Dockerfile
@@ -22,7 +22,7 @@ RUN useradd \
# Install files
COPY --chown=git:git dotfiles /git/
COPY sshd_config /etc/ssh/
-COPY gitolite.conf entrypoint.sh /app/
+COPY gitolite.conf entrypoint.sh initialize.sh /app/
# Setup SSH keys
# We manually generate and store host keys in a separate volume, so that
diff --git a/gitolite/initialize.sh b/gitolite/initialize.sh
new file mode 100755
index 0000000..6806acd
--- /dev/null
+++ b/gitolite/initialize.sh
@@ -0,0 +1,16 @@
+#!/bin/bash -e
+
+# This script is manually invoked when first setting up a site to initialize the
+# gitolite repositories database and set up a user-supplied pubkey for initial
+# administrator access.
+
+echo -e "This will erase data in the gitolite repository volume!"
+echo -e "One SSH pubkey will be used as the initial administrator of the new install."
+echo -e "\nKey selected: $1"
+cat "/tmp/$1"
+echo -e "\nPress Enter/Return to continue..."
+
+read -r confirm
+
+rm -rf /git/.gitolite /git/repositories/*
+su git -c "gitolite setup -pk /tmp/$1"