bootstrap: self-elevate sudo; document double-click workflow

Added exec sudo bash self-elevation so bootstrap.sh works correctly when
double-clicked ("Run in Terminal") without the user needing to prefix sudo.
If already root, the check is a no-op.

Removed bootstrap.desktop — too fragile across desktop environments.
README now covers both "Open in Terminal" and double-click paths.

https://claude.ai/code/session_01Y4dMKtkqkpvmgDKoRdzhTG
This commit is contained in:
Claude
2026-06-04 01:14:54 +00:00
parent 39280d71cb
commit 8ffebe9a5a
2 changed files with 14 additions and 10 deletions
+9 -10
View File
@@ -17,17 +17,16 @@ Prepare the USB once on any machine (no git required):
2. Unzip it — you'll get a folder called `ubuntu-post-install-main` 2. Unzip it — you'll get a folder called `ubuntu-post-install-main`
3. Copy that folder to your USB drive 3. Copy that folder to your USB drive
On every new box — plug in USB, open a terminal, run: On every new box:
```bash 1. Plug in the USB — it opens in the file manager
sudo bash /media/$(whoami)/DRIVENAME/ubuntu-post-install-main/bootstrap.sh 2. Navigate into the `ubuntu-post-install-main` folder
``` 3. **Either:**
`bootstrap.sh` detects it is running from inside the repo, copies everything - Right-click inside the folder → **Open in Terminal** → type `bash bootstrap.sh`
to `~/ubuntu-post-install`, then launches the wizard — so the USB can be - **Or** double-click `bootstrap.sh` → if prompted, choose **Run in Terminal**
unplugged once setup starts. No auth, no internet needed for the scripts
themselves (services still pull packages and Docker images over the network).
> **Finding your drive name:** Ubuntu mounts USB drives at `/media/USERNAME/DRIVENAME`. The script asks for your password if needed. It detects it is running from
> Run `ls /media/$(whoami)/` right after plugging in to see it. inside the repo, copies everything to `~/ubuntu-post-install`, then launches
the wizard — the USB can be unplugged once setup starts.
**Private repo — PAT (alternative):** **Private repo — PAT (alternative):**
```bash ```bash
+5
View File
@@ -17,6 +17,11 @@
# connected machine, put the directory on a USB drive, done. # connected machine, put the directory on a USB drive, done.
set -euo pipefail set -euo pipefail
# Self-elevate: if double-clicked or run without sudo, ask for password.
if [ "$(id -u)" -ne 0 ]; then
exec sudo bash "$0" "$@"
fi
REPO_URL="https://github.com/outis1one/ubuntu-post-install.git" REPO_URL="https://github.com/outis1one/ubuntu-post-install.git"
# Resolve actual user home when running under sudo # Resolve actual user home when running under sudo