#!/bin/bash ## Define Arrays packages=( "zsh" "htop" "figlet" "tmux" "curl" "net-tools" "dnsutils" "tree" ) configfiles=( ".zshrc" ".zsh_plugins.txt" ".p10k.zsh" ".tmux.conf" ".config/htop/htoprc" "/usr/share/nano/yaml.nanorc" ) configfileslinux=( "/etc/nanorc" ) motdfiles=( "/etc/update-motd.d/00-header" "/etc/update-motd.d/10-uname" "/etc/update-motd.d/10-sysinfo" "/etc/update-motd.d/90-footer" ) cd ~ if test -d ~/.config/htop; then echo Htop folder found - skipping removing. else mkdir ~/.config/htop fi ## Install packages if [ "$(uname)" = "Darwin" ]; then echo MacOS found - no installation of packages needed. else for i in "${packages[@]}" do dpkg -s $i &> /dev/null if [ $? -eq 0 ]; then echo $i is installed - skipping. else $i is missing. Installing now. apt install -y $i fi done fi ## Remove Config Files for j in "${configfiles[@]}" do rm $j done if [ "$(uname)" != "Darwin" ]; then for l in "${configfileslinux[@]}" do rm $j done fi ## Remove Motd Files if [ "$(uname)" = "Darwin" ]; then echo MacOS found - no motd files to remove. else for k in "${motdfiles[@]}" do if test -f $k; then rm $k fi done fi ## Remove Antigen if installed if [ -d ~/.antigen ]; then echo Antigen is installed. Removing... rm -R ~/.antigen rm ~/.antigen.zsh fi ## Install Antidote - replacement of Antigen if test -f ~/.antidote; then echo "Antidote allready installed." else echo "Installing antidote..." git clone --depth=1 https://github.com/mattmc3/antidote.git ${ZDOTDIR:-~}/.antidote fi ## Create Symlinks ln -s ~/.zshconfig/zshrc .zshrc ln -s ~/.zshconfig/yaml.nanorc /usr/share/nano/yaml.nanorc ln -s ~/.zshconfig/tmux .tmux.conf ln -s ~/.zshconfig/htoprc .config/htop/htoprc ln -s ~/.zshconfig/p10k.zsh .p10k.zsh ln -s ~/.zshconfig/.zsh_plugins.txt .zsh_plugins.txt ln -s ~/.zshconfig/nanorc /etc/nanorc ## Make ZSH as default Shell chsh -s $(which zsh) ## Copy Files, fix permissions if [ "$(uname)" = "Darwin" ]; then echo MacOS found - No motd changes needed. else cp ~/.zshconfig/motd/* /etc/update-motd.d/ chmod +x /etc/update-motd.d/* echo > /etc/motd fi