-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·99 lines (82 loc) · 2.65 KB
/
install.sh
File metadata and controls
executable file
·99 lines (82 loc) · 2.65 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
#!/bin/bash
# Note: This file is named `install.sh` for compatibility reasons, to ensure it
# works by default with GitHub Codespaces and VSCode Dev Containers.
set -eufo pipefail
WORK_MODE=false
if [[ "${GITHUB_REPOSITORY:-}" != "" && "${GITHUB_REPOSITORY%%/*}" == "journalytic" ]]; then
WORK_MODE=true
elif [[ -d "/workspaces/app" ]]; then
repo_url=$(git -C /workspaces/app remote get-url origin 2>/dev/null || true)
if [[ "$repo_url" == *"journalytic"* ]]; then
WORK_MODE=true
fi
fi
DOTFILES_SOURCE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
export DOTFILES_SOURCE_DIR
SCRIPT_DIR="$DOTFILES_SOURCE_DIR/scripts"
source "$SCRIPT_DIR/lib.sh"
# Parse command line arguments
while [[ $# -gt 0 ]]; do
case $1 in
--work)
WORK_MODE=true
shift
;;
-h | --help)
echo "Usage: $0 [--work]"
echo " --work Configure for work environment"
exit 0
;;
*)
echo "Unknown option $1"
exit 1
;;
esac
done
IS_LXC=false
if grep -qa 'container=lxc' /proc/1/environ 2>/dev/null; then
IS_LXC=true
fi
if [[ "$IS_LXC" != "true" && -z "${REMOTE_CONTAINERS_IPC:-}" && "${USER:-}" != "vscode" && "${CODESPACES:-}" != "true" && "${DOTFILES_CLOUD_INIT:-}" != "true" ]]; then
log_error "This script is intended for dev container/LXC/cloud-init environments only"
exit 1
fi
# Create necessary directories
mkdir -p ~/.local/bin ~/.config/fish/{conf.d,completions}
# Set environment for this session
if [[ "$WORK_MODE" == "true" ]]; then
export DOTFILES_WORK_DC=true
log_info "Setting up work dev container"
else
log_info "Setting up non-work dev container"
fi
export PATH="$HOME/.local/bin:$PATH"
#### Bootstrap Dependencies ####
show_progress "Installing bootstrap dependencies"
sudo apt-get update
sudo apt-get install -y curl git wget unzip gnupg fish neovim
log_success "Bootstrap dependencies installed"
#### Mise ####
show_progress "Installing mise"
curl https://mise.run | sh
if [[ "$WORK_MODE" == "true" ]]; then
mise trust --cd=/workspaces/app --quiet
fi
log_success "mise installed"
#### Chezmoi Setup ####
show_progress "Installing chezmoi and dotfiles"
"$SCRIPT_DIR/install-dotfiles.sh"
log_success "Dotfiles installed and applied"
#### Shell ####
show_progress "Setting up shell"
fish -c "fundle install"
if [[ "$SHELL" != *"fish"* ]]; then
log_info "Changing default shell to fish"
sudo chsh -s "$(which fish)" "$USER"
fi
log_success "Shell setup complete"
#### Claude Code ####
show_progress "Installing Claude Code"
curl -fsSL https://claude.ai/install.sh | bash
log_success "Claude Code installed"
log_success "Dev container setup complete"