-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinstall_basics.sh
More file actions
executable file
·159 lines (140 loc) · 4.8 KB
/
install_basics.sh
File metadata and controls
executable file
·159 lines (140 loc) · 4.8 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
#!/bin/bash
export SCRIPT_HOME=$PWD
# --- Arguments and Configuration ---
INSTALL_ZSH=false
INSTALL_NVIM=false
INSTALL_ANACONDA=false
INSTALL_CONDA_CONFIG=false
INSTALL_DOCKER=false
INSTALL_GHOSTTY=false
INSTALL_UV=false
INSTALL_CONDA_ENVS=false
INSTALL_CORE=false
SELECTIVE_MODE=true
show_help() {
echo "Usage: ./install_basics.sh [OPTIONS]"
echo ""
echo "Options:"
echo " --omz Configure OH-MY-ZSH"
echo " --nvim Config Nvim"
echo " --anaconda Install Anaconda"
echo " --conda-config Setup Conda libmamba solver"
echo " --docker Install Docker"
echo " --ghostty Install Ghostty"
echo " --conda-envs Set Anaconda Envs from backup"
echo " --core Update apt and install basic packages"
echo " --all Run all sections"
echo " --interactive Prompt for each section"
echo " -h, --help Show this help message"
echo ""
echo "If no options are provided, no sections run (selective mode). Use --all for a full run."
}
# Parse flags
if [[ $# -gt 0 ]]; then
while [[ $# -gt 0 ]]; do
case $1 in
--omz) INSTALL_ZSH=true; shift ;;
--nvim) INSTALL_NVIM=true; shift ;;
--anaconda) INSTALL_ANACONDA=true; shift ;;
--conda-config) INSTALL_CONDA_CONFIG=true; shift ;;
--docker) INSTALL_DOCKER=true; shift ;;
--ghostty) INSTALL_GHOSTTY=true; shift ;;
--uv) INSTALL_UV=true; shift ;;
--conda-envs) INSTALL_CONDA_ENVS=true; shift ;;
--core) INSTALL_CORE=true; shift ;;
--interactive) SELECTIVE_MODE=false; INTERACTIVE=true; shift ;;
--all)
INSTALL_ZSH=true
INSTALL_NVIM=true
INSTALL_ANACONDA=true
INSTALL_CONDA_CONFIG=true
INSTALL_DOCKER=true
INSTALL_GHOSTTY=true
INSTALL_UV=true
INSTALL_CONDA_ENVS=true
INSTALL_CORE=true
shift
;;
-h|--help) show_help; exit 0 ;;
*) echo "Unknown option: $1"; show_help; exit 1 ;;
esac
done
fi
should_run() {
local flag_val=$1
local prompt_msg=$2
if [[ "$INTERACTIVE" == "true" ]]; then
echo -n "$prompt_msg (y/n)? "
read answer
if [ "$answer" != "${answer#[Yy]}" ] ;then
return 0
else
return 1
fi
elif [[ "$SELECTIVE_MODE" == "true" ]]; then
[[ "$flag_val" == "true" ]]
return $?
else
# Default: Run everything
return 0
fi
}
# Ensure we are on the correct branch for the detected OS
./git-switch-by-os.sh || true
# --- Installation Steps ---
if should_run "$INSTALL_CORE" "Update apt and install core tools"; then
cd ~
sudo apt update && sudo apt upgrade -y
sudo apt install zsh tmux neovim git wget curl openssh-client openssh-server software-properties-common -y
fi
echo -n "Script Home: "
echo $SCRIPT_HOME
if should_run "$INSTALL_ZSH" "Configure OH-MY-ZSH"; then
cd $SCRIPT_HOME
./install_zsh.sh
fi
if should_run "$INSTALL_NVIM" "Config Nvim"; then
cp ./nvim/init.vim ~/.config/nvim/init.vim
nvim +PlugInstall +qall
git config --global core.editor "nano"
fi
if should_run "$INSTALL_ANACONDA" "Install Anaconda"; then
echo "Installing Anaconda"
cd ~
mkdir Dev_Tools && cd Dev_Tools
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
chmod +x Miniconda3-latest-Linux-x86_64.sh
./Miniconda3-latest-Linux-x86_64.sh
~/miniconda3/bin/conda init zsh
fi
if should_run "$INSTALL_CONDA_CONFIG" "Setup Conda Solver"; then
echo "Setting up Conda to use mamba solver"
source ~/.bashrc
conda update -n base conda -y
conda install -n base conda-libmamba-solver -y
conda config --set solver libmamba
fi
if should_run "$INSTALL_DOCKER" "Install Docker"; then
echo "Installing Docker"
cd ~/Dev_Tools
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo groupadd docker
sudo usermod -aG docker $USER
sudo apt install docker-compose -y
fi
if should_run "$INSTALL_GHOSTTY" "Install Ghostty"; then
echo "Installing Ghostty"
(cd /tmp && /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/mkasberg/ghostty-ubuntu/HEAD/install.sh)")
mkdir -p ~/.config/ghostty
cp "$SCRIPT_HOME/ghosty_config.txt" ~/.config/ghostty/config
fi
if should_run "$INSTALL_UV" "Install UV"; then
echo "Installing UV"
curl -LsSf https://astral.sh/uv/install.sh | sh
fi
if should_run "$INSTALL_CONDA_ENVS" "Set Anaconda Envs from backup"; then
echo "Setting Up Conda Envs from Backups"
cd $SCRIPT_HOME
./conda_envs/import_envs.sh
fi