bootstrap.sh
This commit is contained in:
36
bootstrap.sh
36
bootstrap.sh
@@ -1,9 +1,11 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -x
|
||||||
|
|
||||||
check_installed() {
|
check_installed() {
|
||||||
packages=("$@")
|
_pkgs=("$@")
|
||||||
all_installed=true
|
all_installed=true
|
||||||
for pkg in "${packages[@]}"; do
|
for pkg in "${_pkgs[@]}"; do
|
||||||
if ! command -v "$pkg" > /dev/null 2>&1; then
|
if ! command -v "$pkg" > /dev/null 2>&1; then
|
||||||
all_installed=false
|
all_installed=false
|
||||||
break
|
break
|
||||||
@@ -12,27 +14,25 @@ check_installed() {
|
|||||||
$all_installed && return 0 || return 1
|
$all_installed && return 0 || return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
install_packages() {
|
install_packages() {
|
||||||
# List of packages to install
|
# List of packages to install
|
||||||
packages="zsh git"
|
packages=(zsh git)
|
||||||
|
|
||||||
if [ ! check_installed zsh tmux git ]; then
|
if ! check_installed "${packages[@]}"; then
|
||||||
# Determine which package manager is available
|
# Determine which package manager is available
|
||||||
if check_installed apt; then
|
if check_installed apt; then
|
||||||
echo "Using apt to install packages..."
|
echo "Using apt to install packages..."
|
||||||
sudo apt update
|
sudo apt update
|
||||||
sudo apt install -y $packages
|
sudo apt install -y "${packages[@]}"
|
||||||
elif check_installed dnf; then
|
elif check_installed dnf; then
|
||||||
echo "Using dnf to install packages..."
|
echo "Using dnf to install packages..."
|
||||||
sudo dnf install -y $packages
|
sudo dnf install -y "${packages[@]}"
|
||||||
elif check_installed yum; then
|
elif check_installed yum; then
|
||||||
echo "Using yum to install packages..."
|
echo "Using yum to install packages..."
|
||||||
sudo yum install -y $packages
|
sudo yum install -y "${packages[@]}"
|
||||||
elif check_installed brew; then
|
elif check_installed brew; then
|
||||||
echo "Using Homebrew to install packages..."
|
echo "Using Homebrew to install packages..."
|
||||||
brew install $packages
|
brew install "${packages[@]}"
|
||||||
else
|
else
|
||||||
echo "No supported package manager found (apt, dnf, yum, brew)."
|
echo "No supported package manager found (apt, dnf, yum, brew)."
|
||||||
return 1
|
return 1
|
||||||
@@ -43,12 +43,24 @@ install_packages() {
|
|||||||
clone_repos () {
|
clone_repos () {
|
||||||
git clone --bare https://git.meinlschmidt.org/jetpac/dotfiles.git ~/.cfg
|
git clone --bare https://git.meinlschmidt.org/jetpac/dotfiles.git ~/.cfg
|
||||||
cd ~/.cfg
|
cd ~/.cfg
|
||||||
|
# alias config='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME'
|
||||||
git config --local status.showUntrackedFiles no
|
git config --local status.showUntrackedFiles no
|
||||||
git checkout
|
cd $HOME
|
||||||
|
rm .zshrc
|
||||||
|
git checkout --git-dir=$HOME/.cfg --work-tree=$HOME
|
||||||
|
|
||||||
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh) --unattended --skip-chsh --keep-zshrc"
|
|
||||||
|
# install oh-my-zsh
|
||||||
|
curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh > /tmp/install_ohmyzsh.sh
|
||||||
|
bash /tmp/install_ohmyzsh.sh --unattended --skip-chsh --keep-zshrc
|
||||||
|
|
||||||
|
# powerlevel10k
|
||||||
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
|
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
|
||||||
|
|
||||||
|
# tmux tpm plugin manager
|
||||||
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
|
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
|
||||||
|
|
||||||
|
# plug for installing vim plugins
|
||||||
curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user