Files
ubuntu-post-install/bootstrap.sh
T
Claude e168d6256c bootstrap.sh self-elevates with sudo; USB install docs rewritten
bootstrap.sh: add self-elevation — if not root, re-exec under sudo.
Double-clicking the script in GNOME ("Run in Terminal") now prompts for
the sudo password automatically, no extra commands needed.

README: rewrite USB section around the real workflow:
  - clone with "Open in Terminal" from the file manager sidebar
  - Option A: right-click folder → Open in Terminal → sudo ./setup.sh
  - Option B: double-click bootstrap.sh → "Run in Terminal?" → sudo prompt
  - note on nautilus-extension-gnome-terminal and exFAT vs ext4

https://claude.ai/code/session_017WJtGcE5jjerAQCUBWUE3H
2026-06-04 02:00:58 +00:00

56 lines
2.0 KiB
Bash
Executable File

#!/bin/bash
# bootstrap.sh — get and run ubuntu-post-install on a fresh system.
#
# One command to paste into a new Ubuntu box:
# curl -fsSL https://raw.githubusercontent.com/outis1one/ubuntu-post-install/main/bootstrap.sh | sudo bash
#
# Or double-click it in the file manager ("Run in Terminal") — it will
# prompt for your sudo password automatically.
#
# What it does:
# 1. Installs git if missing (the only hard dependency)
# 2. Clones (or updates) the repo to ~/ubuntu-post-install
# 3. Launches the interactive setup wizard
set -euo pipefail
# Self-elevate: if not root, re-exec under sudo so a plain double-click works.
if [ "${EUID:-$(id -u)}" -ne 0 ]; then
exec sudo bash "$0" "$@"
fi
REPO_URL="https://github.com/outis1one/ubuntu-post-install.git"
DEST="${HOME:-/root}/ubuntu-post-install"
# Resolve actual user home when running under sudo
if [ -n "${SUDO_USER:-}" ]; then
ACTUAL_HOME="$(getent passwd "$SUDO_USER" | cut -d: -f6)"
DEST="$ACTUAL_HOME/ubuntu-post-install"
fi
echo ""
echo "╔══════════════════════════════════════════════════════════════╗"
echo "║ ubuntu-post-install · bootstrap ║"
echo "╚══════════════════════════════════════════════════════════════╝"
echo ""
# 1) Ensure git is available
if ! command -v git >/dev/null 2>&1; then
echo "Installing git..."
apt-get update -qq && apt-get install -y git
fi
# 2) Clone or update
if [ -d "$DEST/.git" ]; then
echo "Repo already exists at $DEST — pulling latest..."
git -C "$DEST" pull --ff-only || echo " (pull failed — continuing with existing version)"
else
echo "Cloning to $DEST ..."
git clone "$REPO_URL" "$DEST"
fi
echo ""
echo "Launching setup..."
echo ""
exec bash "$DEST/setup.sh"