Make all installers idempotent
This commit is contained in:
		@@ -1,5 +1,7 @@
 | 
			
		||||
cd ~/Downloads
 | 
			
		||||
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
 | 
			
		||||
sudo dpkg -i google-chrome-stable_current_amd64.deb
 | 
			
		||||
rm google-chrome-stable_current_amd64.deb
 | 
			
		||||
cd -
 | 
			
		||||
if ! command -v google-chrome &>/dev/null; then
 | 
			
		||||
	cd ~/Downloads
 | 
			
		||||
	wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
 | 
			
		||||
	sudo dpkg -i google-chrome-stable_current_amd64.deb
 | 
			
		||||
	rm google-chrome-stable_current_amd64.deb
 | 
			
		||||
	cd -
 | 
			
		||||
fi
 | 
			
		||||
 
 | 
			
		||||
@@ -1,11 +1,13 @@
 | 
			
		||||
DOCKER_COMPOSE_VERSION="2.27.0"
 | 
			
		||||
sudo apt install -y docker.io docker-buildx
 | 
			
		||||
if ! command -v docker &>/dev/null; then
 | 
			
		||||
	DOCKER_COMPOSE_VERSION="2.27.0"
 | 
			
		||||
	sudo apt install -y docker.io docker-buildx
 | 
			
		||||
 | 
			
		||||
sudo usermod -aG docker ${USER}
 | 
			
		||||
DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}
 | 
			
		||||
mkdir -p $DOCKER_CONFIG/cli-plugins
 | 
			
		||||
curl -SL https://github.com/docker/compose/releases/download/v$DOCKER_COMPOSE_VERSION/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose
 | 
			
		||||
chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose
 | 
			
		||||
	sudo usermod -aG docker ${USER}
 | 
			
		||||
	DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}
 | 
			
		||||
	mkdir -p $DOCKER_CONFIG/cli-plugins
 | 
			
		||||
	curl -SL https://github.com/docker/compose/releases/download/v$DOCKER_COMPOSE_VERSION/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose
 | 
			
		||||
	chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose
 | 
			
		||||
 | 
			
		||||
sudo docker create -d --restart unless-stopped -p 3306:3306 --name=mysql8 -e MYSQL_ROOT_PASSWORD= -e MYSQL_ALLOW_EMPTY_PASSWORD=true mysql:8
 | 
			
		||||
sudo docker create -d --restart unless-stopped -p 6379:6379 --name=redis redis
 | 
			
		||||
	sudo docker create -d --restart unless-stopped -p 3306:3306 --name=mysql8 -e MYSQL_ROOT_PASSWORD= -e MYSQL_ALLOW_EMPTY_PASSWORD=true mysql:8
 | 
			
		||||
	sudo docker create -d --restart unless-stopped -p 6379:6379 --name=redis redis
 | 
			
		||||
fi
 | 
			
		||||
 
 | 
			
		||||
@@ -7,17 +7,28 @@ for entry in dotfiles/*; do
 | 
			
		||||
	# Any existing files will be renamed .bak
 | 
			
		||||
	if [ -f "$entry" ]; then
 | 
			
		||||
		target=~/."$(basename "$entry")"
 | 
			
		||||
		[ -e "$target" ] && mv "$target" "$target.bak"
 | 
			
		||||
		ln -s "$(pwd)/$entry" "$target"
 | 
			
		||||
 | 
			
		||||
		if [ -e "$target" ] && [ "$(readlink "$target")" != "$(pwd)/$entry" ]; then
 | 
			
		||||
			mv "$target" "$target.bak"
 | 
			
		||||
		fi
 | 
			
		||||
 | 
			
		||||
		if [ ! -e "$target" ]; then
 | 
			
		||||
			ln -s "$(pwd)/$entry" "$target"
 | 
			
		||||
		fi
 | 
			
		||||
	fi
 | 
			
		||||
 | 
			
		||||
	# Link all directories in ~/.config/
 | 
			
		||||
	# Any existing directories will be renamed .bak
 | 
			
		||||
	if [ -d "$entry" ]; then
 | 
			
		||||
		target=~/.config/"$(basename "$entry")"
 | 
			
		||||
		[ -e "$target" ] && mv "$target" "$target.bak"
 | 
			
		||||
		ln -s "$(pwd)/$entry" "$target"
 | 
			
		||||
 | 
			
		||||
		if [ -e "$target" ] && [ "$(readlink "$target")" != "$(pwd)/$entry" ]; then
 | 
			
		||||
			mv "$target" "$target.bak"
 | 
			
		||||
		fi
 | 
			
		||||
 | 
			
		||||
		if [ ! -e "$target" ]; then
 | 
			
		||||
			ln -s "$(pwd)/$entry" "$target"
 | 
			
		||||
		fi
 | 
			
		||||
	fi
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
unset entry
 | 
			
		||||
 
 | 
			
		||||
@@ -1,8 +1,10 @@
 | 
			
		||||
cd ~/Downloads
 | 
			
		||||
wget https://github.com/ryanoasis/nerd-fonts/releases/download/v3.1.1/CascadiaMono.zip
 | 
			
		||||
unzip CascadiaMono.zip -d CascadiaFont
 | 
			
		||||
mkdir -p ~/.local/share/fonts
 | 
			
		||||
cp CascadiaFont/*.ttf ~/.local/share/fonts
 | 
			
		||||
rm -rf CascadiaMono.zip CascadiaFont
 | 
			
		||||
fc-cache
 | 
			
		||||
cd -
 | 
			
		||||
if ! [ -f "$HOME/.local/share/fonts/CaskaydiaMonoNerdFont-Regular.ttf" ]; then
 | 
			
		||||
	cd ~/Downloads
 | 
			
		||||
	wget https://github.com/ryanoasis/nerd-fonts/releases/download/v3.1.1/CascadiaMono.zip
 | 
			
		||||
	unzip CascadiaMono.zip -d CascadiaFont
 | 
			
		||||
	mkdir -p ~/.local/share/fonts
 | 
			
		||||
	cp CascadiaFont/*.ttf ~/.local/share/fonts
 | 
			
		||||
	rm -rf CascadiaMono.zip CascadiaFont
 | 
			
		||||
	fc-cache
 | 
			
		||||
	cd -
 | 
			
		||||
fi
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,7 @@
 | 
			
		||||
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg &&
 | 
			
		||||
	sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg &&
 | 
			
		||||
	echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list >/dev/null &&
 | 
			
		||||
	sudo apt update &&
 | 
			
		||||
	sudo apt install gh -y
 | 
			
		||||
if ! command -v gh &>/dev/null; then
 | 
			
		||||
	curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg &&
 | 
			
		||||
		sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg &&
 | 
			
		||||
		echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list >/dev/null &&
 | 
			
		||||
		sudo apt update &&
 | 
			
		||||
		sudo apt install gh -y
 | 
			
		||||
fi
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,9 @@
 | 
			
		||||
cd ~/Downloads
 | 
			
		||||
LAZYDOCKER_VERSION=$(curl -s "https://api.github.com/repos/jesseduffield/lazydocker/releases/latest" | grep -Po '"tag_name": "v\K[^"]*')
 | 
			
		||||
curl -sLo lazydocker.tar.gz "https://github.com/jesseduffield/lazydocker/releases/latest/download/lazydocker_${LAZYDOCKER_VERSION}_Linux_x86_64.tar.gz"
 | 
			
		||||
tar -xf lazydocker.tar.gz lazydocker
 | 
			
		||||
sudo install lazydocker /usr/local/bin
 | 
			
		||||
rm lazydocker.tar.gz
 | 
			
		||||
cd -
 | 
			
		||||
if ! command -v lazydocker &>/dev/null; then
 | 
			
		||||
	cd ~/Downloads
 | 
			
		||||
	LAZYDOCKER_VERSION=$(curl -s "https://api.github.com/repos/jesseduffield/lazydocker/releases/latest" | grep -Po '"tag_name": "v\K[^"]*')
 | 
			
		||||
	curl -sLo lazydocker.tar.gz "https://github.com/jesseduffield/lazydocker/releases/latest/download/lazydocker_${LAZYDOCKER_VERSION}_Linux_x86_64.tar.gz"
 | 
			
		||||
	tar -xf lazydocker.tar.gz lazydocker
 | 
			
		||||
	sudo install lazydocker /usr/local/bin
 | 
			
		||||
	rm lazydocker.tar.gz
 | 
			
		||||
	cd -
 | 
			
		||||
fi
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,9 @@
 | 
			
		||||
cd ~/Downloads
 | 
			
		||||
LAZYGIT_VERSION=$(curl -s "https://api.github.com/repos/jesseduffield/lazygit/releases/latest" | grep -Po '"tag_name": "v\K[^"]*')
 | 
			
		||||
curl -sLo lazygit.tar.gz "https://github.com/jesseduffield/lazygit/releases/latest/download/lazygit_${LAZYGIT_VERSION}_Linux_x86_64.tar.gz"
 | 
			
		||||
tar -xf lazygit.tar.gz lazygit
 | 
			
		||||
sudo install lazygit /usr/local/bin
 | 
			
		||||
rm lazygit.tar.gz
 | 
			
		||||
cd -
 | 
			
		||||
if ! command -v lazygit &>/dev/null; then
 | 
			
		||||
	cd ~/Downloads
 | 
			
		||||
	LAZYGIT_VERSION=$(curl -s "https://api.github.com/repos/jesseduffield/lazygit/releases/latest" | grep -Po '"tag_name": "v\K[^"]*')
 | 
			
		||||
	curl -sLo lazygit.tar.gz "https://github.com/jesseduffield/lazygit/releases/latest/download/lazygit_${LAZYGIT_VERSION}_Linux_x86_64.tar.gz"
 | 
			
		||||
	tar -xf lazygit.tar.gz lazygit
 | 
			
		||||
	sudo install lazygit /usr/local/bin
 | 
			
		||||
	rm lazygit.tar.gz
 | 
			
		||||
	cd -
 | 
			
		||||
fi
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,6 @@
 | 
			
		||||
sudo add-apt-repository -y ppa:neovim-ppa/stable
 | 
			
		||||
sudo apt update -y
 | 
			
		||||
sudo apt install -y neovim
 | 
			
		||||
git clone https://github.com/LazyVim/starter ~/.config/nvim
 | 
			
		||||
if ! command -v neovim &>/dev/null; then
 | 
			
		||||
	sudo add-apt-repository -y ppa:neovim-ppa/stable
 | 
			
		||||
	sudo apt update -y
 | 
			
		||||
	sudo apt install -y neovim
 | 
			
		||||
	git clone https://github.com/LazyVim/starter ~/.config/nvim
 | 
			
		||||
fi
 | 
			
		||||
 
 | 
			
		||||
@@ -1,12 +1,13 @@
 | 
			
		||||
git clone https://github.com/nodenv/nodenv.git ~/.nodenv
 | 
			
		||||
sudo ln -vs ~/.nodenv/bin/nodenv /usr/local/bin/nodenv
 | 
			
		||||
cd ~/.nodenv
 | 
			
		||||
src/configure && make -C src || true
 | 
			
		||||
cd ~/
 | 
			
		||||
mkdir -p "$(nodenv root)"/plugins
 | 
			
		||||
git clone https://github.com/nodenv/node-build.git "$(nodenv root)"/plugins/node-build
 | 
			
		||||
git clone https://github.com/nodenv/nodenv-aliases.git $(nodenv root)/plugins/nodenv-aliases
 | 
			
		||||
nodenv install 20.11.1
 | 
			
		||||
nodenv global 20.11.1
 | 
			
		||||
sudo ln -vs $(nodenv root)/shims/* /usr/local/bin/
 | 
			
		||||
 | 
			
		||||
if ! command -v nodenv &>/dev/null; then
 | 
			
		||||
	git clone https://github.com/nodenv/nodenv.git ~/.nodenv
 | 
			
		||||
	sudo ln -vs ~/.nodenv/bin/nodenv /usr/local/bin/nodenv
 | 
			
		||||
	cd ~/.nodenv
 | 
			
		||||
	src/configure && make -C src || true
 | 
			
		||||
	cd ~/
 | 
			
		||||
	mkdir -p "$(nodenv root)"/plugins
 | 
			
		||||
	git clone https://github.com/nodenv/node-build.git "$(nodenv root)"/plugins/node-build
 | 
			
		||||
	git clone https://github.com/nodenv/nodenv-aliases.git $(nodenv root)/plugins/nodenv-aliases
 | 
			
		||||
	nodenv install 20.11.1
 | 
			
		||||
	nodenv global 20.11.1
 | 
			
		||||
	sudo ln -vs $(nodenv root)/shims/* /usr/local/bin/
 | 
			
		||||
fi
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,8 @@
 | 
			
		||||
DEFAULT_RUBY_VERSION="3.3.1"
 | 
			
		||||
if ! command -v rbenv &>/dev/null; then
 | 
			
		||||
	DEFAULT_RUBY_VERSION="3.3.1"
 | 
			
		||||
 | 
			
		||||
sudo apt install -y rbenv
 | 
			
		||||
git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build
 | 
			
		||||
rbenv install $DEFAULT_RUBY_VERSION
 | 
			
		||||
rbenv global $DEFAULT_RUBY_VERSION
 | 
			
		||||
	sudo apt install -y rbenv
 | 
			
		||||
	git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build
 | 
			
		||||
	rbenv install $DEFAULT_RUBY_VERSION
 | 
			
		||||
	rbenv global $DEFAULT_RUBY_VERSION
 | 
			
		||||
fi
 | 
			
		||||
 
 | 
			
		||||
@@ -1,9 +1,11 @@
 | 
			
		||||
sudo snap install typora
 | 
			
		||||
cd ~/Downloads
 | 
			
		||||
git clone https://github.com/dhh/ia_typora
 | 
			
		||||
mkdir -p ~/.local/share/fonts
 | 
			
		||||
cp ia_typora/fonts/iAWriterMonoS-* ~/.local/share/fonts/
 | 
			
		||||
fc-cache
 | 
			
		||||
mkdir -p ~/snap/typora/88/.config/Typora/themes/
 | 
			
		||||
cp ia_typora/ia_typora*.css ~/snap/typora/88/.config/Typora/themes/
 | 
			
		||||
cd -
 | 
			
		||||
if ! command -v typora &>/dev/null; then
 | 
			
		||||
	sudo snap install typora
 | 
			
		||||
	cd ~/Downloads
 | 
			
		||||
	git clone https://github.com/dhh/ia_typora
 | 
			
		||||
	mkdir -p ~/.local/share/fonts
 | 
			
		||||
	cp ia_typora/fonts/iAWriterMonoS-* ~/.local/share/fonts/
 | 
			
		||||
	fc-cache
 | 
			
		||||
	mkdir -p ~/snap/typora/88/.config/Typora/themes/
 | 
			
		||||
	cp ia_typora/ia_typora*.css ~/snap/typora/88/.config/Typora/themes/
 | 
			
		||||
	cd -
 | 
			
		||||
fi
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,6 @@
 | 
			
		||||
sudo add-apt-repository universe -y
 | 
			
		||||
sudo add-apt-repository ppa:agornostal/ulauncher -y
 | 
			
		||||
sudo apt update -y
 | 
			
		||||
sudo apt install -y ulauncher
 | 
			
		||||
if ! command -v ulauncher &>/dev/null; then
 | 
			
		||||
	sudo add-apt-repository universe -y
 | 
			
		||||
	sudo add-apt-repository ppa:agornostal/ulauncher -y
 | 
			
		||||
	sudo apt update -y
 | 
			
		||||
	sudo apt install -y ulauncher
 | 
			
		||||
fi
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user