-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall-linux.sh
More file actions
executable file
·1345 lines (1233 loc) · 43.3 KB
/
install-linux.sh
File metadata and controls
executable file
·1345 lines (1233 loc) · 43.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env bash
# ============================================================================
# install-linux.sh — Linux Workstation Setup Script (Ubuntu / Arch)
# ============================================================================
# Idempotent install script for provisioning a new Linux workstation with all
# development tools, CLI utilities, GUI apps, shell customizations, and
# terminal preferences used by Allen Sudbring for Azure documentation work.
#
# Supports:
# - Ubuntu (22.04+) — uses apt + Microsoft/HashiCorp/GitHub repos
# - Arch Linux — uses pacman + yay (AUR helper)
#
# Usage:
# chmod +x install-linux.sh
# ./install-linux.sh
#
# Safe to re-run — checks for each component before installing.
# On re-run, upgrades existing packages and updates configurations.
# ============================================================================
set -euo pipefail
# ── Color helpers ──────────────────────────────────────────────────────────
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
CYAN='\033[0;36m'
BOLD='\033[1m'
NC='\033[0m'
INSTALLED=0
SKIPPED=0
FAILED=0
UPDATED=0
info() { echo -e "${BLUE}[INFO]${NC} $*"; }
success() { echo -e "${GREEN}[OK]${NC} $*"; }
skip() { echo -e "${YELLOW}[SKIP]${NC} $*"; }
warn() { echo -e "${YELLOW}[WARN]${NC} $*"; }
fail() { echo -e "${RED}[FAIL]${NC} $*"; }
section() { echo -e "\n${BOLD}${CYAN}══════════════════════════════════════════${NC}"; echo -e "${BOLD}${CYAN} $*${NC}"; echo -e "${BOLD}${CYAN}══════════════════════════════════════════${NC}\n"; }
mark_installed() { ((INSTALLED++)) || true; }
mark_skipped() { ((SKIPPED++)) || true; }
mark_failed() { ((FAILED++)) || true; }
mark_updated() { ((UPDATED++)) || true; }
MARKER="# Managed by install-linux.sh"
# ── Distro Detection ──────────────────────────────────────────────────────
section "Distro Detection"
DISTRO=""
if [[ -f /etc/os-release ]]; then
# shellcheck source=/dev/null
source /etc/os-release
case "$ID" in
ubuntu|debian|linuxmint|pop)
DISTRO="ubuntu"
info "Detected: $PRETTY_NAME (apt-based)"
;;
arch|endeavouros|manjaro)
DISTRO="arch"
info "Detected: $PRETTY_NAME (pacman-based)"
;;
*)
fail "Unsupported distribution: $ID ($PRETTY_NAME)"
fail "This script supports Ubuntu/Debian and Arch-based distros."
exit 1
;;
esac
else
fail "Cannot detect distribution — /etc/os-release not found"
exit 1
fi
# ── Helper functions ──────────────────────────────────────────────────────
# Install packages via the appropriate package manager
pkg_install() {
local pkg="$1"
if [[ "$DISTRO" == "ubuntu" ]]; then
sudo apt-get install -y -qq "$pkg" 2>/dev/null
else
sudo pacman -S --noconfirm --needed "$pkg" 2>/dev/null
fi
}
# Install multiple packages at once
pkg_install_multi() {
if [[ "$DISTRO" == "ubuntu" ]]; then
sudo apt-get install -y -qq "$@" 2>/dev/null
else
sudo pacman -S --noconfirm --needed "$@" 2>/dev/null
fi
}
# Install from AUR via yay (Arch only)
aur_install() {
local pkg="$1"
if [[ "$DISTRO" == "arch" ]]; then
yay -S --noconfirm --needed "$pkg" 2>/dev/null
fi
}
# Check if a package is installed
pkg_installed() {
local pkg="$1"
if [[ "$DISTRO" == "ubuntu" ]]; then
dpkg -l "$pkg" 2>/dev/null | grep -q "^ii"
else
pacman -Qi "$pkg" &>/dev/null
fi
}
# Check if an AUR package is installed (Arch only)
aur_installed() {
pacman -Qi "$1" &>/dev/null
}
# Refresh PATH
refresh_path() {
export PATH="$HOME/.local/bin:$HOME/.dotnet/tools:/usr/local/bin:$PATH"
hash -r
}
# ── Section 1: System Update & Build Tools ────────────────────────────────
section "System Update & Build Tools"
if [[ "$DISTRO" == "ubuntu" ]]; then
info "Updating apt package lists..."
sudo apt-get update -qq
info "Upgrading installed packages..."
sudo apt-get upgrade -y -qq
mark_updated
info "Installing build essentials..."
pkg_install_multi build-essential curl wget unzip software-properties-common \
apt-transport-https ca-certificates gnupg lsb-release
success "Build essentials installed"
mark_installed
else
info "Updating pacman package database..."
sudo pacman -Syu --noconfirm
mark_updated
info "Installing base-devel..."
pkg_install_multi base-devel curl wget unzip
success "Base development tools installed"
mark_installed
fi
# ── Section 2: AUR Helper (Arch only) ────────────────────────────────────
if [[ "$DISTRO" == "arch" ]]; then
section "AUR Helper (yay)"
if command -v yay &>/dev/null; then
skip "yay already installed"
mark_skipped
else
info "Installing yay AUR helper..."
TEMP_YAY=$(mktemp -d)
git clone https://aur.archlinux.org/yay-bin.git "$TEMP_YAY/yay-bin"
(cd "$TEMP_YAY/yay-bin" && makepkg -si --noconfirm)
rm -rf "$TEMP_YAY"
if command -v yay &>/dev/null; then
success "yay installed"
mark_installed
else
fail "yay installation failed"
mark_failed
fi
fi
fi
# ── Section 3: Ubuntu Repository Setup ────────────────────────────────────
if [[ "$DISTRO" == "ubuntu" ]]; then
section "APT Repository Setup"
# Microsoft GPG key + repos (Edge, VS Code, Azure CLI, PowerShell)
MSFT_KEY="/usr/share/keyrings/microsoft-archive-keyring.gpg"
if [[ ! -f "$MSFT_KEY" ]]; then
info "Adding Microsoft GPG key..."
curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | \
sudo gpg --dearmor -o "$MSFT_KEY"
success "Microsoft GPG key added"
else
skip "Microsoft GPG key already present"
fi
# VS Code repo
VSCODE_REPO="/etc/apt/sources.list.d/vscode.list"
if [[ ! -f "$VSCODE_REPO" ]]; then
info "Adding VS Code repository..."
echo "deb [arch=amd64 signed-by=$MSFT_KEY] https://packages.microsoft.com/repos/code stable main" | \
sudo tee "$VSCODE_REPO" > /dev/null
success "VS Code repo added"
mark_installed
else
skip "VS Code repo already configured"
mark_skipped
fi
# Edge repo
EDGE_REPO="/etc/apt/sources.list.d/microsoft-edge.list"
if [[ ! -f "$EDGE_REPO" ]]; then
info "Adding Microsoft Edge repository..."
echo "deb [arch=amd64 signed-by=$MSFT_KEY] https://packages.microsoft.com/repos/edge stable main" | \
sudo tee "$EDGE_REPO" > /dev/null
success "Edge repo added"
mark_installed
else
skip "Edge repo already configured"
mark_skipped
fi
# Azure CLI repo
AZCLI_REPO="/etc/apt/sources.list.d/azure-cli.list"
if [[ ! -f "$AZCLI_REPO" ]]; then
info "Adding Azure CLI repository..."
echo "deb [arch=amd64 signed-by=$MSFT_KEY] https://packages.microsoft.com/repos/azure-cli $(lsb_release -cs) main" | \
sudo tee "$AZCLI_REPO" > /dev/null
success "Azure CLI repo added"
mark_installed
else
skip "Azure CLI repo already configured"
mark_skipped
fi
# PowerShell repo
PWSH_REPO="/etc/apt/sources.list.d/microsoft-prod.list"
if [[ ! -f "$PWSH_REPO" ]]; then
info "Adding PowerShell (Microsoft prod) repository..."
curl -fsSL "https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/packages-microsoft-prod.deb" -o /tmp/packages-microsoft-prod.deb
sudo dpkg -i /tmp/packages-microsoft-prod.deb
rm -f /tmp/packages-microsoft-prod.deb
success "PowerShell repo added"
mark_installed
else
skip "PowerShell repo already configured"
mark_skipped
fi
# HashiCorp repo (Terraform)
HASHI_REPO="/etc/apt/sources.list.d/hashicorp.list"
if [[ ! -f "$HASHI_REPO" ]]; then
info "Adding HashiCorp repository..."
HASHI_KEY="/usr/share/keyrings/hashicorp-archive-keyring.gpg"
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o "$HASHI_KEY"
echo "deb [arch=amd64 signed-by=$HASHI_KEY] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | \
sudo tee "$HASHI_REPO" > /dev/null
success "HashiCorp repo added"
mark_installed
else
skip "HashiCorp repo already configured"
mark_skipped
fi
# GitHub CLI repo
GH_REPO="/etc/apt/sources.list.d/github-cli.list"
if [[ ! -f "$GH_REPO" ]]; then
info "Adding GitHub CLI repository..."
GH_KEY="/usr/share/keyrings/githubcli-archive-keyring.gpg"
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo tee "$GH_KEY" > /dev/null
echo "deb [arch=amd64 signed-by=$GH_KEY] https://cli.github.com/packages stable main" | \
sudo tee "$GH_REPO" > /dev/null
success "GitHub CLI repo added"
mark_installed
else
skip "GitHub CLI repo already configured"
mark_skipped
fi
# Refresh after adding repos
info "Refreshing package lists..."
sudo apt-get update -qq
fi
# ── Section 4: Core Development Tools ─────────────────────────────────────
section "Core Development Tools"
# Git
if command -v git &>/dev/null; then
skip "Git already installed ($(git --version | cut -d' ' -f3))"
mark_skipped
else
info "Installing Git..."
if pkg_install git; then
success "Git installed"
mark_installed
else
fail "Git installation failed"
mark_failed
fi
fi
# Node.js + npm
if command -v node &>/dev/null; then
skip "Node.js already installed ($(node --version))"
mark_skipped
else
info "Installing Node.js..."
if [[ "$DISTRO" == "ubuntu" ]]; then
pkg_install_multi nodejs npm
else
pkg_install_multi nodejs npm
fi
if command -v node &>/dev/null; then
success "Node.js installed ($(node --version))"
mark_installed
else
fail "Node.js installation failed"
mark_failed
fi
fi
# Python 3
if command -v python3 &>/dev/null; then
skip "Python already installed ($(python3 --version 2>&1))"
mark_skipped
else
info "Installing Python 3..."
if [[ "$DISTRO" == "ubuntu" ]]; then
pkg_install_multi python3 python3-pip python3-venv
else
pkg_install_multi python python-pip
fi
if command -v python3 &>/dev/null; then
success "Python 3 installed"
mark_installed
else
fail "Python 3 installation failed"
mark_failed
fi
fi
# Terraform
if command -v terraform &>/dev/null; then
skip "Terraform already installed ($(terraform version -json 2>/dev/null | head -1 | grep -oP '"terraform_version":"\K[^"]+' || terraform version | head -1))"
mark_skipped
else
info "Installing Terraform..."
if pkg_install terraform; then
success "Terraform installed"
mark_installed
else
fail "Terraform installation failed"
mark_failed
fi
fi
# Docker
if command -v docker &>/dev/null; then
skip "Docker already installed ($(docker --version 2>/dev/null | cut -d' ' -f3 | tr -d ','))"
mark_skipped
else
info "Installing Docker..."
if [[ "$DISTRO" == "ubuntu" ]]; then
pkg_install_multi docker.io docker-compose-plugin
else
pkg_install_multi docker docker-compose
fi
if command -v docker &>/dev/null; then
# Add user to docker group
sudo usermod -aG docker "$USER" 2>/dev/null || true
sudo systemctl enable docker 2>/dev/null || true
sudo systemctl start docker 2>/dev/null || true
success "Docker installed (log out/in to use without sudo)"
mark_installed
else
fail "Docker installation failed"
mark_failed
fi
fi
# Azure CLI
if command -v az &>/dev/null; then
skip "Azure CLI already installed ($(az version --query '"azure-cli"' -o tsv 2>/dev/null))"
mark_skipped
else
info "Installing Azure CLI..."
if [[ "$DISTRO" == "ubuntu" ]]; then
pkg_install azure-cli
else
aur_install azure-cli
fi
if command -v az &>/dev/null; then
success "Azure CLI installed"
mark_installed
else
fail "Azure CLI installation failed"
mark_failed
fi
fi
# PowerShell
if command -v pwsh &>/dev/null; then
skip "PowerShell already installed ($(pwsh --version))"
mark_skipped
else
info "Installing PowerShell..."
if [[ "$DISTRO" == "ubuntu" ]]; then
pkg_install powershell
else
aur_install powershell-bin
fi
if command -v pwsh &>/dev/null; then
success "PowerShell installed"
mark_installed
else
fail "PowerShell installation failed"
mark_failed
fi
fi
# GitHub CLI
if command -v gh &>/dev/null; then
skip "GitHub CLI already installed ($(gh --version | head -1 | cut -d' ' -f3))"
mark_skipped
else
info "Installing GitHub CLI..."
if [[ "$DISTRO" == "ubuntu" ]]; then
pkg_install gh
else
pkg_install github-cli
fi
if command -v gh &>/dev/null; then
success "GitHub CLI installed"
mark_installed
else
fail "GitHub CLI installation failed"
mark_failed
fi
fi
# ── Section 5: CLI Utilities ──────────────────────────────────────────────
section "CLI Utilities"
# Simple command-to-package mapping
declare -A CLI_TOOLS_CMD
declare -A CLI_TOOLS_UBUNTU
declare -A CLI_TOOLS_ARCH
CLI_TOOLS_CMD=(
[ripgrep]="rg"
[fzf]="fzf"
[git-delta]="delta"
[age]="age"
)
CLI_TOOLS_UBUNTU=(
[ripgrep]="ripgrep"
[fzf]="fzf"
[git-delta]="git-delta"
[age]="age"
)
CLI_TOOLS_ARCH=(
[ripgrep]="ripgrep"
[fzf]="fzf"
[git-delta]="git-delta"
[age]="age"
)
for tool in "${!CLI_TOOLS_CMD[@]}"; do
cmd="${CLI_TOOLS_CMD[$tool]}"
if command -v "$cmd" &>/dev/null; then
skip "$tool already installed"
mark_skipped
else
info "Installing $tool..."
if [[ "$DISTRO" == "ubuntu" ]]; then
pkg="${CLI_TOOLS_UBUNTU[$tool]}"
else
pkg="${CLI_TOOLS_ARCH[$tool]}"
fi
if pkg_install "$pkg"; then
success "$tool installed"
mark_installed
else
fail "$tool installation failed"
mark_failed
fi
fi
done
# fd (different package name on Ubuntu)
if command -v fd &>/dev/null || command -v fdfind &>/dev/null; then
skip "fd already installed"
mark_skipped
else
info "Installing fd..."
if [[ "$DISTRO" == "ubuntu" ]]; then
if pkg_install fd-find; then
# Ubuntu names it fdfind — create symlink
if command -v fdfind &>/dev/null && ! command -v fd &>/dev/null; then
sudo ln -sf "$(which fdfind)" /usr/local/bin/fd
fi
success "fd installed (as fd-find, symlinked to fd)"
mark_installed
else
fail "fd installation failed"
mark_failed
fi
else
if pkg_install fd; then
success "fd installed"
mark_installed
else
fail "fd installation failed"
mark_failed
fi
fi
fi
# DuckDB
if command -v duckdb &>/dev/null; then
skip "DuckDB already installed"
mark_skipped
else
info "Installing DuckDB..."
if [[ "$DISTRO" == "ubuntu" ]]; then
# DuckDB not in Ubuntu repos — install from GitHub release
DUCKDB_URL=$(curl -fsSL "https://api.github.com/repos/duckdb/duckdb/releases/latest" | \
grep -oP '"browser_download_url": "\K[^"]*linux-amd64.zip' | head -1) || true
if [[ -n "$DUCKDB_URL" ]]; then
curl -fsSL "$DUCKDB_URL" -o /tmp/duckdb.zip
unzip -o /tmp/duckdb.zip -d /tmp/duckdb
sudo mv /tmp/duckdb/duckdb /usr/local/bin/duckdb
sudo chmod +x /usr/local/bin/duckdb
rm -rf /tmp/duckdb.zip /tmp/duckdb
success "DuckDB installed"
mark_installed
else
fail "DuckDB download URL not found"
mark_failed
fi
else
if pkg_install duckdb; then
success "DuckDB installed"
mark_installed
else
fail "DuckDB installation failed"
mark_failed
fi
fi
fi
# xh
if command -v xh &>/dev/null; then
skip "xh already installed"
mark_skipped
else
info "Installing xh..."
if [[ "$DISTRO" == "ubuntu" ]]; then
XH_URL=$(curl -fsSL "https://api.github.com/repos/ducaale/xh/releases/latest" | \
grep -oP '"browser_download_url": "\K[^"]*x86_64-unknown-linux-musl.tar.gz' | head -1) || true
if [[ -n "$XH_URL" ]]; then
curl -fsSL "$XH_URL" -o /tmp/xh.tar.gz
tar -xzf /tmp/xh.tar.gz -C /tmp
sudo mv /tmp/xh-*/xh /usr/local/bin/xh
sudo chmod +x /usr/local/bin/xh
rm -rf /tmp/xh.tar.gz /tmp/xh-*
success "xh installed"
mark_installed
else
fail "xh download URL not found"
mark_failed
fi
else
if pkg_install xh; then
success "xh installed"
mark_installed
else
fail "xh installation failed"
mark_failed
fi
fi
fi
# watchexec
if command -v watchexec &>/dev/null; then
skip "watchexec already installed"
mark_skipped
else
info "Installing watchexec..."
if [[ "$DISTRO" == "ubuntu" ]]; then
WATCHEXEC_URL=$(curl -fsSL "https://api.github.com/repos/watchexec/watchexec/releases/latest" | \
grep -oP '"browser_download_url": "\K[^"]*x86_64-unknown-linux-musl.tar.xz' | head -1) || true
if [[ -n "$WATCHEXEC_URL" ]]; then
curl -fsSL "$WATCHEXEC_URL" -o /tmp/watchexec.tar.xz
tar -xJf /tmp/watchexec.tar.xz -C /tmp
sudo mv /tmp/watchexec-*/watchexec /usr/local/bin/watchexec
sudo chmod +x /usr/local/bin/watchexec
rm -rf /tmp/watchexec.tar.xz /tmp/watchexec-*
success "watchexec installed"
mark_installed
else
fail "watchexec download URL not found"
mark_failed
fi
else
if pkg_install watchexec; then
success "watchexec installed"
mark_installed
else
fail "watchexec installation failed"
mark_failed
fi
fi
fi
# just
if command -v just &>/dev/null; then
skip "just already installed"
mark_skipped
else
info "Installing just..."
if [[ "$DISTRO" == "ubuntu" ]]; then
JUST_URL=$(curl -fsSL "https://api.github.com/repos/casey/just/releases/latest" | \
grep -oP '"browser_download_url": "\K[^"]*x86_64-unknown-linux-musl.tar.gz' | head -1) || true
if [[ -n "$JUST_URL" ]]; then
curl -fsSL "$JUST_URL" -o /tmp/just.tar.gz
tar -xzf /tmp/just.tar.gz -C /tmp just
sudo mv /tmp/just /usr/local/bin/just
sudo chmod +x /usr/local/bin/just
rm -f /tmp/just.tar.gz
success "just installed"
mark_installed
else
fail "just download URL not found"
mark_failed
fi
else
if pkg_install just; then
success "just installed"
mark_installed
else
fail "just installation failed"
mark_failed
fi
fi
fi
# semgrep (pip on both distros)
if command -v semgrep &>/dev/null; then
skip "semgrep already installed"
mark_skipped
info "Updating semgrep..."
pip install --upgrade --quiet semgrep 2>/dev/null || true
mark_updated
else
info "Installing semgrep..."
if pip install --quiet semgrep 2>/dev/null || pip3 install --quiet semgrep 2>/dev/null; then
refresh_path
success "semgrep installed"
mark_installed
else
fail "semgrep installation failed"
mark_failed
fi
fi
# Bun (official install script)
if command -v bun &>/dev/null; then
skip "Bun already installed ($(bun --version 2>/dev/null))"
mark_skipped
info "Updating Bun..."
bun upgrade 2>/dev/null || true
mark_updated
else
info "Installing Bun..."
if curl -fsSL https://bun.sh/install | bash 2>/dev/null; then
export BUN_INSTALL="$HOME/.bun"
export PATH="$BUN_INSTALL/bin:$PATH"
if command -v bun &>/dev/null; then
success "Bun installed ($(bun --version))"
mark_installed
else
fail "Bun installed but not found in PATH"
mark_failed
fi
else
fail "Bun installation failed"
mark_failed
fi
fi
# oh-my-posh
if command -v oh-my-posh &>/dev/null; then
skip "oh-my-posh already installed"
mark_skipped
else
info "Installing oh-my-posh..."
if [[ "$DISTRO" == "ubuntu" ]]; then
# Official install script — installs to ~/.local/bin
if curl -fsSL https://ohmyposh.dev/install.sh | bash -s 2>/dev/null; then
refresh_path
success "oh-my-posh installed"
mark_installed
else
fail "oh-my-posh installation failed"
mark_failed
fi
else
if pkg_install oh-my-posh; then
success "oh-my-posh installed"
mark_installed
else
fail "oh-my-posh installation failed"
mark_failed
fi
fi
fi
# ── Section 6: GUI Applications ──────────────────────────────────────────
section "GUI Applications"
# Microsoft Edge
if command -v microsoft-edge-stable &>/dev/null || command -v microsoft-edge &>/dev/null; then
skip "Microsoft Edge already installed"
mark_skipped
else
info "Installing Microsoft Edge..."
if [[ "$DISTRO" == "ubuntu" ]]; then
pkg_install microsoft-edge-stable
else
aur_install microsoft-edge-stable-bin
fi
if command -v microsoft-edge-stable &>/dev/null || command -v microsoft-edge &>/dev/null; then
success "Microsoft Edge installed"
mark_installed
else
fail "Microsoft Edge installation failed"
mark_failed
fi
fi
# Visual Studio Code
if command -v code &>/dev/null; then
skip "VS Code already installed"
mark_skipped
else
info "Installing Visual Studio Code..."
if [[ "$DISTRO" == "ubuntu" ]]; then
pkg_install code
else
aur_install visual-studio-code-bin
fi
if command -v code &>/dev/null; then
success "VS Code installed"
mark_installed
else
fail "VS Code installation failed"
mark_failed
fi
fi
# Terminator
if command -v terminator &>/dev/null; then
skip "Terminator already installed"
mark_skipped
else
info "Installing Terminator..."
if pkg_install terminator; then
success "Terminator installed"
mark_installed
else
fail "Terminator installation failed"
mark_failed
fi
fi
# Flameshot
if command -v flameshot &>/dev/null; then
skip "Flameshot already installed"
mark_skipped
else
info "Installing Flameshot..."
if pkg_install flameshot; then
success "Flameshot installed"
mark_installed
else
fail "Flameshot installation failed"
mark_failed
fi
fi
# Remmina + FreeRDP
if command -v remmina &>/dev/null; then
skip "Remmina already installed"
mark_skipped
else
info "Installing Remmina + FreeRDP..."
if [[ "$DISTRO" == "ubuntu" ]]; then
pkg_install_multi remmina remmina-plugin-rdp
else
pkg_install_multi remmina freerdp
fi
if command -v remmina &>/dev/null; then
success "Remmina installed"
mark_installed
else
fail "Remmina installation failed"
mark_failed
fi
fi
# KVM/QEMU + virt-manager
if command -v virt-manager &>/dev/null; then
skip "virt-manager already installed"
mark_skipped
else
info "Installing KVM/QEMU + virt-manager..."
if [[ "$DISTRO" == "ubuntu" ]]; then
pkg_install_multi qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils virt-manager
else
pkg_install_multi qemu-full libvirt virt-manager dnsmasq
fi
if command -v virt-manager &>/dev/null; then
sudo usermod -aG libvirt "$USER" 2>/dev/null || true
sudo systemctl enable libvirtd 2>/dev/null || true
sudo systemctl start libvirtd 2>/dev/null || true
success "KVM/QEMU + virt-manager installed (log out/in for group membership)"
mark_installed
else
fail "virt-manager installation failed"
mark_failed
fi
fi
# ── Section 7: Delugia Nerd Font ──────────────────────────────────────────
section "Delugia Nerd Font"
FONT_DIR="$HOME/.local/share/fonts"
if fc-list 2>/dev/null | grep -qi "Delugia"; then
skip "Delugia Nerd Font already installed"
mark_skipped
else
info "Downloading Delugia Nerd Font from GitHub..."
FONT_URL="https://github.com/adam7/delugia-code/releases/latest/download/Delugia.zip"
TEMP_FONT=$(mktemp -d)
if curl -fsSL "$FONT_URL" -o "$TEMP_FONT/Delugia.zip"; then
mkdir -p "$FONT_DIR"
unzip -o "$TEMP_FONT/Delugia.zip" -d "$TEMP_FONT/delugia" >/dev/null
find "$TEMP_FONT/delugia" -name "*.ttf" -exec cp {} "$FONT_DIR/" \;
fc-cache -f 2>/dev/null
rm -rf "$TEMP_FONT"
if fc-list | grep -qi "Delugia"; then
success "Delugia Nerd Font installed"
mark_installed
else
warn "Delugia font files copied but fc-cache may need a restart"
mark_installed
fi
else
fail "Delugia font download failed"
rm -rf "$TEMP_FONT"
mark_failed
fi
fi
# ── Section 8: Shell Customization (oh-my-bash) ──────────────────────────
section "Shell Customization (oh-my-bash + Bash)"
# oh-my-bash
if [[ -d "$HOME/.oh-my-bash" ]]; then
skip "oh-my-bash already installed"
mark_skipped
info "Updating oh-my-bash..."
(cd "$HOME/.oh-my-bash" && git pull --quiet 2>/dev/null) || true
mark_updated
else
info "Installing oh-my-bash..."
# Use unattended install (OSH_UNATTENDED prevents shell switch prompt)
OSH_UNATTENDED=1 bash -c "$(curl -fsSL https://raw.githubusercontent.com/ohmybash/oh-my-bash/master/tools/install.sh)" "" --unattended 2>/dev/null || true
if [[ -d "$HOME/.oh-my-bash" ]]; then
success "oh-my-bash installed"
mark_installed
else
fail "oh-my-bash installation failed"
mark_failed
fi
fi
# Configure .bashrc with agnoster theme and custom settings
BASHRC="$HOME/.bashrc"
BASH_MARKER="$MARKER — bashrc"
if [[ -f "$BASHRC" ]] && grep -qF "$BASH_MARKER" "$BASHRC" 2>/dev/null; then
skip "Bash customizations already applied"
mark_skipped
else
info "Configuring .bashrc (agnoster theme, PATH, aliases)..."
# Set oh-my-bash theme to agnoster if oh-my-bash is installed
if [[ -f "$BASHRC" ]] && grep -q "OSH_THEME=" "$BASHRC"; then
sed -i 's/^OSH_THEME=.*/OSH_THEME="agnoster"/' "$BASHRC"
fi
cat >> "$BASHRC" << 'BASHEOF'
# Managed by install-linux.sh — bashrc
# PATH additions
export PATH="$HOME/.local/bin:$HOME/.dotnet/tools:$HOME/.bun/bin:$PATH"
# Aliases
alias claude-local='ANTHROPIC_BASE_URL=http://localhost:4001 ANTHROPIC_API_KEY=sk-local-proxy claude'
BASHEOF
success "Bash customizations applied"
mark_installed
fi
# ── Section 9: PowerShell Profile & Modules ──────────────────────────────
section "PowerShell Profile & Modules"
PWSH_PROFILE_DIR="$HOME/.config/powershell"
PWSH_PROFILE="$PWSH_PROFILE_DIR/profile.ps1"
PWSH_MARKER="$MARKER — pwsh"
if command -v pwsh &>/dev/null; then
# Create profile
if [[ -f "$PWSH_PROFILE" ]] && grep -qF "$PWSH_MARKER" "$PWSH_PROFILE" 2>/dev/null; then
skip "PowerShell profile already configured"
mark_skipped
else
info "Configuring PowerShell profile..."
mkdir -p "$PWSH_PROFILE_DIR"
cat >> "$PWSH_PROFILE" << PWSHEOF
$PWSH_MARKER
# oh-my-posh theme
oh-my-posh init pwsh --config "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/agnoster.omp.json" | Invoke-Expression
PWSHEOF
success "PowerShell profile configured"
mark_installed
fi
# PowerShell modules
for module in Az PSReadLine posh-git; do
if pwsh -NoProfile -Command "Get-Module -ListAvailable -Name $module" 2>/dev/null | grep -q "$module"; then
skip "PowerShell module $module already installed"
mark_skipped
info "Updating $module..."
pwsh -NoProfile -Command "Update-Module -Name $module -Force -ErrorAction SilentlyContinue" 2>/dev/null || true
mark_updated
else
info "Installing PowerShell module: $module..."
if pwsh -NoProfile -Command "Install-Module -Name $module -Force -Scope CurrentUser -AllowClobber -AcceptLicense" 2>/dev/null; then
success "PowerShell module $module installed"
mark_installed
else
fail "PowerShell module $module installation failed"
mark_failed
fi
fi
done
else
warn "PowerShell not installed — skipping profile and modules"
mark_skipped
fi
# ── Section 10: NPM Global Packages ──────────────────────────────────────
section "NPM Global Packages"
if command -v npm &>/dev/null; then
# context-mode
if npm list -g context-mode &>/dev/null; then
skip "context-mode already installed"
mark_skipped
info "Updating context-mode..."
npm update -g context-mode 2>/dev/null || true
mark_updated
else
info "Installing context-mode..."
if npm install -g context-mode 2>/dev/null; then
success "context-mode installed"
mark_installed
else
fail "context-mode installation failed"
mark_failed
fi
fi
# @github/copilot
if command -v copilot &>/dev/null || npm list -g @github/copilot &>/dev/null; then
skip "GitHub Copilot CLI agent already installed"
mark_skipped
info "Updating @github/copilot..."
npm update -g @github/copilot 2>/dev/null || true
mark_updated
else
info "Installing GitHub Copilot CLI agent..."
if npm install -g @github/copilot 2>/dev/null; then
success "GitHub Copilot CLI agent installed"
mark_installed
else
fail "GitHub Copilot CLI agent installation failed"
mark_failed
fi