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