summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMalfurious <m@lfurio.us>2023-09-16 13:07:18 -0400
committerMalfurious <m@lfurio.us>2023-09-16 13:07:18 -0400
commit0b329d20c64502e3a9e932590f7872e09167d001 (patch)
tree8e883cc73c23414a20fc2c46c474753e376db0a7
parent4cc4870fd7c7e57379dc605d377bb2e6e09473ae (diff)
downloadsrcnode-0b329d20c64502e3a9e932590f7872e09167d001.tar.gz
srcnode-0b329d20c64502e3a9e932590f7872e09167d001.zip
Add host script for initial configuration flow
The new installation procedure is to start with ./configure to set your pubkey up for admin access. The initialize script is updated to use an active prompt, since as-is, CTRL-C won't properly terminate the script to cancel. Signed-off-by: Malfurious <m@lfurio.us>
-rwxr-xr-xconfigure22
-rwxr-xr-xgitolite/initialize.sh6
2 files changed, 27 insertions, 1 deletions
diff --git a/configure b/configure
new file mode 100755
index 0000000..53d8e1c
--- /dev/null
+++ b/configure
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+usage() {
+ echo "usage: ./configure <ssh-pubkey>"
+ echo "Please give me your administrator public key, whose filename must"
+ echo "end in '.pub'. Paths beginning with '~' are not allowed, however"
+ echo "your shell might pre-expand them."
+ exit 1
+}
+
+echo "$1" | grep -Eq '^~' && usage
+echo "$1" | grep -Eq '.+\.pub$' || usage
+
+echo "$1" | grep -Eq '^/' && keypath="$1" || keypath="$PWD/$1"
+keyname=$(basename "$keypath")
+
+docker compose run \
+ --build \
+ --rm \
+ --volume "$keypath:/tmp/$keyname:ro" \
+ gitolite \
+ /app/initialize.sh "$keyname"
diff --git a/gitolite/initialize.sh b/gitolite/initialize.sh
index 6806acd..10aa4f0 100755
--- a/gitolite/initialize.sh
+++ b/gitolite/initialize.sh
@@ -8,9 +8,13 @@ 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..."
+echo -ne "\nEnter 'YES' to continue: "
read -r confirm
+if [ "$confirm" != "YES" ]; then
+ echo "ABORTING!"
+ exit 0
+fi
rm -rf /git/.gitolite /git/repositories/*
su git -c "gitolite setup -pk /tmp/$1"