Repository navigation
refactor(installer): merge both init scripts into a single cloud-init bootstrap - #31
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
- replay failing command output under the step status with the exact
command and its call-site line (no more `"$@" failed (line 10)`),
keeping protocol lines atomic for plain run commands too
- parse under bash 3.2: a case inside the FLOW command substitution is
a known 3.2 parser bug, so msg_end now uses if/else
- skip copying authorized_keys onto itself when the adopted user is
the invoking sudo user (cp same-file exits 1)
- skip the suite's non-dry-run fixtures when running as root
- normalize one-line if/case/||-{} bodies to repo style
- print an indented hint when the suite skips its non-dry-run fixtures as root instead of silently running 18 fewer assertions - one assignment per line for the FLOW color constants (repo style)
- preflight os-release ID=ubuntu before the banner so non-Ubuntu hosts get one clear line instead of a cryptic step-1 failure; skipped under dry-run (previews work anywhere); OS_RELEASE seam points the suite at fixture files - add ppa:git-core/ppa behind software-properties-common with -y and an explicit apt refresh (lib.sh convention); ship openssh-server in both package sets so sshd hardening works on minimal images - expand the default vimrc (completeopt, backspace, visual reindent, center-on-scroll/search, buffer tabs, ALT+J/K line moves) + typo fixes - keep usage() on the USAGE heredoc: deriving it from the header broke the piped doors ($0 is bash there, so sed failed with rc=1) - build FLOW with read -d '' instead of $(cat ...): bash 3.2 mis-lexes unbalanced quotes in command-substitution heredocs (the vimrc's ':m '>+1 marks made /bin/bash -n fail at EOF) - reject empty --profile= and --profile "" like a bare --profile instead of silently auto-detecting - tests: piped --help/unknown flag, empty profile values, guard reject and dry-run skip, add-apt-repository fixture stubs -- init suite 50, battery 182/182
|
@coderabbitai review |
|
Summary
Merges
scripts/init.shandscripts/init-lxc.shinto one self-containedbootstrap script that runs either as cloud-init user-data on first boot or via
curl … | bash, replacing the divergent duplicate flows.Goals
lxc/vps) profile with--profile/PROFILEoverride--dry-run, TTY-aware outputConstraints
ID=ubuntu: other distrosfail fast with one clear line before the banner (dry-run previews anywhere)
lib.sh, no clone step, bash 3.2-compatible constructsauthorized_keys(lockout guard)Review focus
sudo -vonce + quoted heredoc passed throughbash -c "$FLOW"with explicit env values>truncation for rerun safety--profile>PROFILE> detect) and dry-run guarantees (never calls sudo)Verification
init_test.sh(50 assertions): CLI, profile precedence,dry-run sequence with a sudo tripwire, step-error and sudo-failure paths,
protocol line atomicity under chatty commands (failing output is replayed
below the status with the exact command and its call-site line), a bash 3.2
parse gate, and the adoption self-copy guard; non-dry-run fixtures are
skipped when the suite runs as root
reject with
init.sh: requires Ubuntu (os-release ID=ubuntu)and rc=1before the banner (macOS too, where os-release is absent), while
--dry-runpreviews fully on all of them; a fresh Ubuntu host passessilently, builds git 2.55.0 from the PPA, and reruns idempotently
cat init.sh | bash -s -- --helpexits 0 and printsUsage:rerun (sudoers/vimrc counts stable), all three doors (dry-run, root,
non-root via
sudo -v→sudo env), non-ttysudo -vfailure loud withzero steps executed, sshd lockout guard (no keys → password auth kept,
sshd -T passwordauthentication yes) and keys-installed hardening flip(
passwordauthentication no), adoption of the existing uid-1000 user,container auto-detection (
lxc),systemctl restart sshdunit aliasRelated