Switch from git clone to archive-based install
This commit is contained in:
parent
7935469776
commit
3baf943a53
|
|
@ -8,7 +8,7 @@ set -euo pipefail
|
|||
# Installs or updates toes on a Raspberry Pi.
|
||||
# Must be run as the 'toes' user with passwordless sudo.
|
||||
|
||||
REPO="https://git.nose.space/defunkt/toes"
|
||||
ARCHIVE="https://git.nose.space/defunkt/toes/archive/main.tar.gz"
|
||||
DEST=~/toes
|
||||
APPS_DIR=~/apps
|
||||
DATA_DIR=~/data
|
||||
|
|
@ -59,16 +59,11 @@ sudo ln -sf "$BUN" /usr/local/bin/bun
|
|||
|
||||
sudo setcap 'cap_net_bind_service=+ep' "$BUN"
|
||||
|
||||
# ── Clone or pull ────────────────────────────────────────
|
||||
# ── Download ─────────────────────────────────────────────
|
||||
|
||||
if [ -d "$DEST/.git" ]; then
|
||||
info "Pulling latest toes"
|
||||
git -C "$DEST" fetch origin main
|
||||
git -C "$DEST" reset --hard origin/main
|
||||
else
|
||||
info "Cloning toes"
|
||||
git clone "$REPO" "$DEST"
|
||||
fi
|
||||
info "Downloading toes"
|
||||
mkdir -p "$DEST"
|
||||
curl -fsSL "$ARCHIVE" | tar xz --strip-components=1 -C "$DEST"
|
||||
|
||||
# ── Directories ──────────────────────────────────────────
|
||||
|
||||
|
|
@ -91,25 +86,33 @@ REPOS_DIR="$DATA_DIR/repos"
|
|||
mkdir -p "$REPOS_DIR"
|
||||
|
||||
info "Installing bundled apps"
|
||||
pids=()
|
||||
for app_dir in "$DEST"/apps/*/; do
|
||||
app=$(basename "$app_dir")
|
||||
[ -f "$app_dir/package.json" ] || continue
|
||||
echo " $app"
|
||||
cp -a "$app_dir" "$APPS_DIR/$app"
|
||||
quiet bun install --frozen-lockfile --cwd "$APPS_DIR/$app" || quiet bun install --cwd "$APPS_DIR/$app"
|
||||
(
|
||||
cp -a "$app_dir" "$APPS_DIR/$app"
|
||||
quiet bun install --frozen-lockfile --cwd "$APPS_DIR/$app" || quiet bun install --cwd "$APPS_DIR/$app"
|
||||
|
||||
# Seed bare repo for git-based versioning
|
||||
bare="$REPOS_DIR/$app.git"
|
||||
quiet git -C "$APPS_DIR/$app" init -b main
|
||||
quiet git -C "$APPS_DIR/$app" add -A
|
||||
quiet git -C "$APPS_DIR/$app" -c user.name=toes -c user.email=toes@localhost commit -m "install"
|
||||
if [ -d "$bare" ]; then
|
||||
quiet git -C "$APPS_DIR/$app" push --force "$bare" main
|
||||
else
|
||||
quiet git clone --bare "$APPS_DIR/$app" "$bare"
|
||||
quiet git -C "$bare" config http.receivepack true
|
||||
fi
|
||||
rm -rf "$APPS_DIR/$app/.git"
|
||||
# Seed bare repo for git-based versioning
|
||||
bare="$REPOS_DIR/$app.git"
|
||||
quiet git -C "$APPS_DIR/$app" init -b main
|
||||
quiet git -C "$APPS_DIR/$app" add -A
|
||||
quiet git -C "$APPS_DIR/$app" -c user.name=toes -c user.email=toes@localhost commit -m "install"
|
||||
if [ -d "$bare" ]; then
|
||||
quiet git -C "$APPS_DIR/$app" push --force "$bare" main
|
||||
else
|
||||
quiet git clone --bare "$APPS_DIR/$app" "$bare"
|
||||
quiet git -C "$bare" config http.receivepack true
|
||||
fi
|
||||
rm -rf "$APPS_DIR/$app/.git"
|
||||
) &
|
||||
pids+=("$!")
|
||||
done
|
||||
|
||||
for pid in "${pids[@]}"; do
|
||||
wait "$pid" || fail "A bundled app failed to install."
|
||||
done
|
||||
|
||||
# ── CLI + SSH ────────────────────────────────────────────
|
||||
|
|
@ -134,7 +137,7 @@ sudo systemctl restart toes
|
|||
|
||||
# ── Done ─────────────────────────────────────────────────
|
||||
|
||||
VERSION=$(git describe --tags --always 2>/dev/null || echo "unknown")
|
||||
VERSION=$(grep '"version"' "$DEST/package.json" | head -1 | sed 's/.*"version": *"\(.*\)".*/\1/')
|
||||
|
||||
echo ""
|
||||
echo " ${b}${g}🐾 toes $VERSION is up!${r}"
|
||||
|
|
|
|||
|
|
@ -11,11 +11,5 @@ source "$ROOT_DIR/scripts/config.sh"
|
|||
# Run remote install on the target
|
||||
ssh "$SSH_HOST" bash <<'SCRIPT'
|
||||
set -e
|
||||
DEST="${DEST:-$HOME/toes}"
|
||||
if [ -d "$DEST/.git" ]; then
|
||||
cd "$DEST" && git pull
|
||||
else
|
||||
git clone https://git.nose.space/defunkt/toes "$DEST" && cd "$DEST"
|
||||
fi
|
||||
./scripts/install.sh
|
||||
curl -fsSL https://toes.dev/install | sh
|
||||
SCRIPT
|
||||
|
|
|
|||
|
|
@ -63,7 +63,6 @@ export async function proxySubdomain(subdomain: string, req: Request): Promise<R
|
|||
headers.set('x-app-url', app.tunnelUrl ?? `${url.protocol}//${subdomain}.${url.hostname}`)
|
||||
}
|
||||
headers.delete('connection')
|
||||
headers.delete('content-length')
|
||||
headers.delete('keep-alive')
|
||||
headers.delete('transfer-encoding')
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user