change repo path from /opt to /opt/hantim

/opt already exists on Linux systems and git clone refuses to clone
into a non-empty directory.
This commit is contained in:
2026-03-13 11:52:51 -04:00
parent 1220698292
commit 7a5de9be6d
6 changed files with 20 additions and 20 deletions
+11 -11
View File
@@ -2,13 +2,13 @@
set -euo pipefail
# Server setup script for a fresh Rocky Linux 9 (or compatible) install.
# Run as root after cloning the repo to /opt/.
# Run as root after cloning the repo to /opt/hantim.
#
# Usage:
# 1. dnf install -y epel-release && dnf install -y git git-crypt
# 2. git clone <repo-url> /opt
# 2. git clone <repo-url> /opt/hantim
# 3. git-crypt unlock /path/to/git-crypt-key
# 4. /opt/setup.sh
# 4. /opt/hantim/setup.sh
#
errors=()
@@ -25,8 +25,8 @@ if ! command -v git-crypt &>/dev/null; then
errors+=("git-crypt is not installed. Run: dnf install -y epel-release && dnf install -y git git-crypt")
fi
if [ "$(pwd)" != "/opt" ] && [ "$(dirname "$(readlink -f "$0")")" != "/opt" ]; then
errors+=("Repo does not appear to be cloned to /opt. Run: git clone <repo-url> /opt")
if [ "$(pwd)" != "/opt/hantim" ] && [ "$(dirname "$(readlink -f "$0")")" != "/opt/hantim" ]; then
errors+=("Repo does not appear to be cloned to /opt/hantim. Run: git clone <repo-url> /opt/hantim")
fi
if git-crypt status &>/dev/null && git-crypt status 2>/dev/null | grep -q '^\*\*\*ENCRYPTED\*\*\*'; then
@@ -38,9 +38,9 @@ if [ ${#errors[@]} -gt 0 ]; then
echo ""
echo "Please complete the initial setup before running this script:"
echo " 1. dnf install -y epel-release && dnf install -y git git-crypt"
echo " 2. git clone <repo-url> /opt"
echo " 2. git clone <repo-url> /opt/hantim"
echo " 3. git-crypt unlock /path/to/git-crypt-key"
echo " 4. /opt/setup.sh"
echo " 4. /opt/hantim/setup.sh"
echo ""
echo "Issues found:"
for err in "${errors[@]}"; do
@@ -64,13 +64,13 @@ mkdir -p /home/deploy/.ssh
chmod 700 /home/deploy/.ssh
if [ ! -f /home/deploy/.ssh/authorized_keys ]; then
echo "WARNING: Add the CI public key manually:"
echo ' command="/opt/scripts/deploy-dispatch.sh",no-port-forwarding,no-agent-forwarding,no-X11-forwarding,no-pty ssh-ed25519 <KEY>'
echo ' command="/opt/hantim/scripts/deploy-dispatch.sh",no-port-forwarding,no-agent-forwarding,no-X11-forwarding,no-pty ssh-ed25519 <KEY>'
echo " into /home/deploy/.ssh/authorized_keys"
fi
chown -R deploy:deploy /home/deploy/.ssh
echo "==> Making scripts executable..."
chmod +x /opt/scripts/*.sh
chmod +x /opt/hantim/scripts/*.sh
echo "==> Creating shared Docker network..."
docker network create shared || true
@@ -79,8 +79,8 @@ echo "==> Logging into Gitea registry..."
echo "Run manually: docker login git.timothykim.net"
echo "==> Starting services..."
cd /opt/docker/nginx && docker compose up -d
cd /opt/docker/timothykim.net && docker compose up -d
cd /opt/hantim/docker/nginx && docker compose up -d
cd /opt/hantim/docker/timothykim.net && docker compose up -d
echo "==> Done. Don't forget to:"
echo " 1. Add the deploy SSH public key to /home/deploy/.ssh/authorized_keys"