You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

81 lines
2.2 KiB

#!/usr/bin/env bash
set -x
check_installed() {
_pkgs=("$@")
all_installed=true
for pkg in "${_pkgs[@]}"; do
if ! command -v "$pkg" > /dev/null 2>&1; then
all_installed=false
break
fi
done
$all_installed && return 0 || return 1
}
install_packages() {
# List of packages to install
packages=(zsh git)
if ! check_installed "${packages[@]}"; then
# Determine which package manager is available
if check_installed apt; then
echo "Using apt to install packages..."
sudo apt update
sudo apt install -y "${packages[@]}"
elif check_installed dnf; then
echo "Using dnf to install packages..."
sudo dnf install -y "${packages[@]}"
elif check_installed yum; then
echo "Using yum to install packages..."
sudo yum install -y "${packages[@]}"
elif check_installed brew; then
echo "Using Homebrew to install packages..."
brew install "${packages[@]}"
else
echo "No supported package manager found (apt, dnf, yum, brew)."
return 1
fi
fi
}
clone_repos () {
git clone --bare https://git.meinlschmidt.org/jetpac/dotfiles.git ~/.cfg
# alias config='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME'
git --git-dir=$HOME/.cfg config --local status.showUntrackedFiles no
git --git-dir=$HOME/.cfg --work-tree=$HOME checkout
# 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
# tmux tpm plugin manager
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
}
configure_vim() {
vim +PlugInstall +qall
}
configure_tmux() {
echo "run tmux, prefix + I installs all plugins (needs to have proxies set)"
}
# Call the function to execute the installation
install_packages
clone_repos
configure_vim
configure_tmux
# vim: foldmethod=marker:foldmarker={,}:expandtab:sw=4:ts=4: