From cc490f57b339b1fb37f74bcb68426c2172e06ada Mon Sep 17 00:00:00 2001 From: "@USER@" <@EMAIL@> Date: Wed, 7 Oct 2026 15:42:34 +0200 Subject: [PATCH] feat(install): zsh is the default macOS shell; remote install keeps its prompts - choose_macos_shell answers zsh on Enter, on no terminal and on an unknown value; MACOS_SHELL=bash still picks bash. - remote-install.sh hands /dev/tty to install.sh when one can be opened: piped into bash, stdin was the script, so install.sh saw no terminal and silently skipped the identity, shell and offer questions. - remote-install.sh cloned master by default; origin only has main (the documented raw URL 404s on master, 200 on main). README updated. --- CLAUDE.md | 4 ++-- README.md | 8 ++++---- install.sh | 15 ++++++++------- remote-install.sh | 14 ++++++++++---- 4 files changed, 24 insertions(+), 17 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index d584a64..279f2ac 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -42,8 +42,8 @@ cloudpex/{cloudpex,install.sh,README.md} on-demand SMB mount helper → /usr/loc install.sh offers to mask `tmp.mount`. Swap is not the fix (the cap and ENOSPC stay). macOS: install.sh swaps apt-get for Homebrew (colima for Docker, brew services for -code-server/mariadb, `~/.bash_profile` → `~/.bashrc`), asks bash or zsh (`MACOS_SHELL` -presets it; zsh = oh-my-zsh + `zsh/` files, bash = brew bash 5) and prints the Linux-only +code-server/mariadb, `~/.bash_profile` → `~/.bashrc`), asks zsh or bash (zsh by default, +`MACOS_SHELL` presets it; zsh = oh-my-zsh + `zsh/` files, bash = brew bash 5) and prints the Linux-only items it skipped. Keep `bashrc-osx` = `bashrc-linux` + macOS deltas only, and the zsh files in step with them (same env, aliases, prompt). diff --git a/README.md b/README.md index 17dfe26..a01ef4c 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Personal dotfiles — vim + bash configuration and a one-shot installer. Install everything (clone + setup) with one command: ```sh -curl -fsSL https://git.bchanot.fr/bchanot/config/raw/branch/master/remote-install.sh | bash +curl -fsSL https://git.bchanot.fr/bchanot/config/raw/branch/main/remote-install.sh | bash ``` (Runs a remote script through `bash` — see the [Install](#install) section for what it does and the manual alternative.) @@ -43,10 +43,10 @@ curl -fsSL https://git.bchanot.fr/bchanot/config/raw/branch/master/remote-instal ### One-liner (clone + install) ```sh -curl -fsSL https://git.bchanot.fr/bchanot/config/raw/branch/master/remote-install.sh | bash +curl -fsSL https://git.bchanot.fr/bchanot/config/raw/branch/main/remote-install.sh | bash ``` -`remote-install.sh` ensures `git` is present, clones the repo to `~/config` (or pulls if already there), then runs `install.sh`. Override with env vars: `REPO_URL=... CLONE_DIR=... BRANCH=... curl ... | bash`. +`remote-install.sh` ensures `git` is present, clones the repo to `~/config` (or pulls if already there), then runs `install.sh` with the terminal as its stdin, so the questions below (identity, macOS shell, offers) are asked even though the script arrives through a pipe. Override with env vars: `REPO_URL=... CLONE_DIR=... BRANCH=... curl ... | bash`. > Piping a remote script into `bash` runs unreviewed code over the network. Read [`remote-install.sh`](remote-install.sh) first, or use the manual clone below. @@ -98,7 +98,7 @@ The script is re-runnable: each run re-backs up to `~/Oldconfig` (overwriting th ### macOS -The same `./install.sh` detects macOS and replaces `apt-get` with Homebrew. It first asks which login shell you want, **bash** or **zsh** (`[bash]` by default; answer in advance with `MACOS_SHELL=zsh ./install.sh`, and with no terminal attached it picks bash): +The same `./install.sh` detects macOS and replaces `apt-get` with Homebrew. It first asks which login shell you want, **zsh** or **bash** (`[zsh]` by default; answer in advance with `MACOS_SHELL=bash ./install.sh`, and with no terminal attached it picks zsh): 1. Installs Homebrew with its official script when `brew` is missing (this also pulls the Xcode Command Line Tools: clang, make, git), then `brew update` + `brew upgrade`. 2. Installs the apt list mapped to formulae: `vim git git-lfs git-filter-repo gitleaks pkgconf shellcheck gh git-delta curl gnupg lftp inetutils unzip tree tmux fzf dtach node python pipx php mariadb imagemagick ffmpeg weasyprint poppler qpdf webp libavif bash`. Brew's `php` already ships gd, mbstring, xml, intl, curl and mysql. diff --git a/install.sh b/install.sh index da5e97b..bf5f636 100755 --- a/install.sh +++ b/install.sh @@ -345,18 +345,19 @@ install_colima_docker() { start_brew_service colima } -# macOS login shell: bash (brew's bash 5 + bashrc-osx) or zsh (oh-my-zsh + -# zshrc-osx). MACOS_SHELL=bash|zsh answers in advance; with no terminal attached -# and no answer, bash. Prints the choice on stdout (the question goes to stderr). +# macOS login shell: zsh (oh-my-zsh + zshrc-osx, the macOS default) or bash +# (brew's bash 5 + bashrc-osx). MACOS_SHELL=bash|zsh answers in advance; with no +# terminal attached and no answer, zsh. Prints the choice on stdout (the question +# goes to stderr). choose_macos_shell() { local answer="${MACOS_SHELL:-}" if [ -z "$answer" ] && [ -t 0 ]; then - read -rp "Login shell on macOS: bash or zsh (oh-my-zsh)? [bash] " answer || true + read -rp "Login shell on macOS: zsh (oh-my-zsh) or bash? [zsh] " answer || true fi case "$answer" in - zsh) echo zsh ;; - bash|"") echo bash ;; - *) echo "Unknown shell '$answer' — using bash" >&2; echo bash ;; + zsh|"") echo zsh ;; + bash) echo bash ;; + *) echo "Unknown shell '$answer' — using zsh" >&2; echo zsh ;; esac } diff --git a/remote-install.sh b/remote-install.sh index d83b79b..6041920 100755 --- a/remote-install.sh +++ b/remote-install.sh @@ -1,14 +1,14 @@ #!/usr/bin/env bash # remote-install.sh — one-liner bootstrap: clone this repo, then run install.sh. # Usage: -# curl -fsSL https://git.bchanot.fr/bchanot/config/raw/branch/master/remote-install.sh | bash +# curl -fsSL https://git.bchanot.fr/bchanot/config/raw/branch/main/remote-install.sh | bash # Override defaults with env vars: # REPO_URL=... CLONE_DIR=... BRANCH=... curl ... | bash set -euo pipefail REPO_URL="${REPO_URL:-https://git.bchanot.fr/bchanot/config.git}" CLONE_DIR="${CLONE_DIR:-$HOME/config}" -BRANCH="${BRANCH:-master}" +BRANCH="${BRANCH:-main}" # git is required to fetch the repo. Install it on Debian/Ubuntu, else bail with a hint. if ! command -v git >/dev/null 2>&1; then @@ -36,6 +36,12 @@ else git clone --quiet --branch "$BRANCH" "$REPO_URL" "$CLONE_DIR" fi -# Hand off to the OS-detecting installer. +# Hand off to the OS-detecting installer. Piped into bash, stdin is the script +# itself, so install.sh would see no terminal and skip every question (identity, +# macOS shell, offers). Give it the terminal back when there is one. echo "Running install.sh" -bash "$CLONE_DIR/install.sh" +if ( : /dev/null; then + bash "$CLONE_DIR/install.sh"