Skip to content

Commit f1e40b1

Browse files
ulises-cclaude
andcommitted
refactor: hoist platform_install_tier to core as apt-family default
ubuntu.sh and server.sh had near-identical platform_install_tier copies that diverged only in whether the low tier installed snaps. That divergence was incidental (no low-priority server snaps exist) and would have silently dropped any future low server snap. Make the low tier run snap uniformly and hoist one shared copy into lib/core.sh beside apt_install_tier; arch.sh keeps its yay override. Package selection stays data-driven via package_manager.<platform> in packages.json, so a manager only installs where a package declares it -- no profile conditional needed in the install path. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 94fd830 commit f1e40b1

3 files changed

Lines changed: 27 additions & 42 deletions

File tree

lib/core.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,30 @@ apt_install_tier() {
417417
run sudo apt install -y $names
418418
}
419419

420+
# apt + snap tier composition — shared by the Ubuntu desktop and the server
421+
# profile. Selection is data-driven (package_manager.<platform> in packages.json),
422+
# so each manager runs at every tier uniformly; a package only installs where it
423+
# declares that platform. arch.sh overrides this with the yay batch.
424+
platform_install_tier() {
425+
case "$1" in
426+
high)
427+
printf '==> Installing high-priority apt packages...\n'
428+
apt_install_tier high
429+
;;
430+
medium)
431+
printf '==> Installing medium-priority apt packages...\n'
432+
apt_install_tier medium
433+
printf '\n==> Installing snap packages...\n'
434+
snap_install_tier medium
435+
setup_bat_fd_symlinks
436+
;;
437+
low)
438+
apt_install_tier low
439+
snap_install_tier low
440+
;;
441+
esac
442+
}
443+
420444
# Tailscale via the official curl installer — apt-family default (ubuntu + server).
421445
# arch.sh overrides this (tailscale ships in the yay batch; just enable the daemon).
422446
platform_tailscale_step() {

platforms/server.sh

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,6 @@ platform_bootstrap() {
1010
apt_bootstrap
1111
}
1212

13-
platform_install_tier() {
14-
case "$1" in
15-
high)
16-
printf '==> Installing high-priority apt packages...\n'
17-
apt_install_tier high
18-
;;
19-
medium)
20-
printf '==> Installing medium-priority apt packages...\n'
21-
apt_install_tier medium
22-
printf '\n==> Installing snap packages...\n'
23-
snap_install_tier medium
24-
setup_bat_fd_symlinks
25-
;;
26-
low)
27-
apt_install_tier low
28-
;;
29-
esac
30-
}
31-
3213
# Pre-clone the antidote plugins now while the network is provably up; otherwise
3314
# the first interactive login does the GitHub clones lazily.
3415
server_preclone_antidote() {

platforms/ubuntu.sh

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,12 @@
11
#!/usr/bin/env bash
2-
# Ubuntu/Debian desktop quirks: apt + snap tier composition, batcat/fdfind
3-
# symlinks, pyenv build deps. The apt install/Tailscale/Docker hooks and apt
4-
# bootstrap are shared defaults in lib/core.sh.
2+
# Ubuntu/Debian desktop quirks: pyenv build deps. The apt bootstrap, install
3+
# tiers, snap, symlinks, and Tailscale/Docker hooks are all shared defaults in
4+
# lib/core.sh.
55

66
platform_bootstrap() {
77
apt_bootstrap
88
}
99

10-
platform_install_tier() {
11-
case "$1" in
12-
high)
13-
printf '==> Installing high-priority apt packages...\n'
14-
apt_install_tier high
15-
;;
16-
medium)
17-
printf '==> Installing medium-priority apt packages...\n'
18-
apt_install_tier medium
19-
printf '\n==> Installing snap packages...\n'
20-
snap_install_tier medium
21-
setup_bat_fd_symlinks
22-
;;
23-
low)
24-
apt_install_tier low
25-
snap_install_tier low
26-
;;
27-
esac
28-
}
29-
3010
platform_pyenv_build_deps() {
3111
sudo apt install -y libssl-dev libffi-dev libncurses-dev libreadline-dev \
3212
libbz2-dev libsqlite3-dev liblzma-dev zlib1g-dev tk-dev

0 commit comments

Comments
 (0)