From 27860c5e32d29123321d89afaf164b3567b5f1f5 Mon Sep 17 00:00:00 2001 From: Chris Wanstrath Date: Thu, 5 Mar 2026 13:09:25 -0800 Subject: [PATCH] Init bare git repos for apps on install --- install/install.sh | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/install/install.sh b/install/install.sh index b6f0b17..44f0588 100644 --- a/install/install.sh +++ b/install/install.sh @@ -13,8 +13,6 @@ DEST=~/toes APPS_DIR=~/apps DATA_DIR=~/data -BUNDLED_APPS="clock code cron env git metrics" - # ── Helpers ────────────────────────────────────────────── quiet() { "$@" > /dev/null 2>&1; } @@ -82,18 +80,37 @@ info "Installing dependencies" quiet bun install info "Building" +rm -rf dist quiet bun run build # ── Bundled apps ───────────────────────────────────────── +REPOS_DIR="$DATA_DIR/repos" +mkdir -p "$REPOS_DIR" + info "Installing bundled apps" -for app in $BUNDLED_APPS; do - [ -d "$DEST/apps/$app" ] || continue +for app_dir in "$DEST"/apps/*/; do + app=$(basename "$app_dir") + [ -f "$app_dir/package.json" ] || continue echo " $app" - cp -r "$DEST/apps/$app" "$APPS_DIR/" + cp -a "$app_dir" "$APPS_DIR/$app" if [ -f "$APPS_DIR/$app/package.json" ]; then quiet bun install --frozen-lockfile --cwd "$APPS_DIR/$app" || quiet bun install --cwd "$APPS_DIR/$app" fi + + # Initialize bare repo for git-based versioning + bare="$REPOS_DIR/$app.git" + if [ ! -d "$bare" ]; then + quiet git init --bare -b main "$bare" + git -C "$bare" config http.receivepack true + fi + tmp=$(mktemp -d) + cp -a "$app_dir"/. "$tmp"/ + quiet git -C "$tmp" init -b main + quiet git -C "$tmp" add -A + quiet git -C "$tmp" -c user.name=toes -c user.email=toes@localhost commit -m "install" + quiet git -C "$tmp" push --force "$bare" main + rm -rf "$tmp" done # ── Systemd ──────────────────────────────────────────────