-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdev_workstation.sh
More file actions
executable file
·115 lines (99 loc) · 3.16 KB
/
Copy pathdev_workstation.sh
File metadata and controls
executable file
·115 lines (99 loc) · 3.16 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
#!/bin/bash
# Function to check OS type
detect_os() {
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
echo "Linux"
elif [[ "$OSTYPE" == "darwin"* ]]; then
echo "MacOS"
else
echo "Unsupported OS"
exit 1
fi
}
# Copy configuration files
copy_config_files() {
cp zshrc ~/.zshrc
cp tmux-linux.conf ~/.tmux.conf
cp vimrc ~/.vimrc
mkdir -p ~/.config/nvim
cp init.vim ~/.config/nvim/init.vim
}
# Source configuration files
source_config_files() {
tmux source ~/.tmux.conf
}
# Install packages based on OS type
install_packages() {
local os_type=$1
if [ "$os_type" == "Linux" ]; then
sudo apt update
sudo apt install -y tmux git golang zsh wget curl neovim vim jq openssl python3 ruby php telnet tree yarn xclip cmake silversearcher-ag
sudo apt update
sudo apt install -y fasd
go install github.com/mfuentesg/ksd@latest
sudo apt --fix-broken install
sudo snap install kustomize --classic
sudo snap install fzf --classic
sudo snap install k9s --classic
sudo snap install kubectx --classic
sudo snap install kubectl --classic
sudo snap install stern --classic
sudo snap install tfenv --classic
sudo snap install ytt --classic
sudo snap install docker
sudo snap install code --classic
elif [ "$os_type" == "MacOS" ]; then
if ! command -v brew &> /dev/null; then
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
brew install tmux git z go zsh wget curl neovim vim helm jq openssl python3.8 python ruby php telnet tree yarn the_silver_searcher cmake nvm\
kustomize fzf grep k9s mfuentesg/tap/ksd kubectx kubernetes-cli stern tfenv ytt npm
brew install --cask docker
brew install --cask visual-studio-code
brew install --cask sequel-ace
fi
#set zsh as default shell
sudo chsh -s $(which zsh)
#tmux tpm install if needed
if [ ! -f "$HOME/.tmux/plugins/tpm/tpm" ]; then
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
fi
#Configure vim
# Install VimPlug
if [ ! -f "$HOME/.vim/autoload/plug.vim" ]; then
curl -fLo "$HOME/.vim/autoload/plug.vim" --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
fi
#Run Vim specific commands
vim +'PlugInstall --sync' +qa
vim +'GoInstallBinaries' +qa
}
install_oh_my_zsh() {
if [ ! -d "$HOME/.oh-my-zsh" ]; then
yes | sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
ZSH_CUSTOM="$HOME/.oh-my-zsh/custom"
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/jonmosco/kube-ps1.git $ZSH_CUSTOM/plugins/kube-ps1
source ~/.zshrc
else
echo "Oh My Zsh is already installed."
fi
}
install_direnv() {
local os_type=$1
if [ "$os_type" == "Linux" ]; then
sudo apt install -y direnv
elif [ "$os_type" == "MacOS" ]; then
brew install direnv
fi
echo 'eval "$(direnv hook zsh)"' >> ~/.zshrc
}
main() {
local os_type=$(detect_os)
install_oh_my_zsh
install_packages "$os_type"
install_direnv "$os_type"
copy_config_files
source_config_files
}
main