Skip to content
This repository has been archived by the owner on Nov 28, 2021. It is now read-only.

Commit

Permalink
Added logging headers and skip already installed packages
Browse files Browse the repository at this point in the history
  • Loading branch information
R4YM3 committed Jun 6, 2021
1 parent 137f8c3 commit b3698f9
Show file tree
Hide file tree
Showing 20 changed files with 184 additions and 80 deletions.
4 changes: 4 additions & 0 deletions config/dotfiles/files/.aliases
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ elif [[ "$OSTYPE" == "darwin"* ]]; then
source $DOTFILES_CONFIG_DIR/macos/.aliases
fi

alias dv="cd ~/Development"
alias dl="cd ~/Downloads"
alias dt="cd ~/Desktop"

# Enable aliases to be sudo’ed
alias sudo='sudo '

Expand Down
2 changes: 1 addition & 1 deletion config/dotfiles/setup.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

source ./helpers.sh
header "Installing dotfiles"

FILES="$DOTFILES_DIR/config/dotfiles/files"

Expand Down
3 changes: 0 additions & 3 deletions config/folders/setup.sh

This file was deleted.

9 changes: 8 additions & 1 deletion config/gnome/setup.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
#!/bin/bash

header "Gnome"

# default dark mode theme to fallback
gsettings set org.gnome.desktop.interface gtk-theme 'Adwaita-dark'

# install dracula theme
WANTED_THEME='Dracula'

mkdir -p ~/.themes
mkdir -p ~/.icons
mkdir -p ~/.zsh

# Download, unpack and install dracula theme
CURRENT_GTK_THEME=$(gsettings get org.gnome.desktop.interface gtk-theme)
if [ $CURRENT_GTK_THEME != WANTED_THEME ]; then
Expand All @@ -13,7 +21,6 @@ if [ $CURRENT_GTK_THEME != WANTED_THEME ]; then
rm master
mv ./gtk-master ./Dracula


gsettings set org.gnome.desktop.interface gtk-theme "Dracula"
gsettings set org.gnome.desktop.wm.preferences theme "Dracula"
fi
Expand Down
4 changes: 4 additions & 0 deletions config/macos/setup.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#!/bin/bash

header "Mac OS"

# key repeat
defaults write -g InitialKeyRepeat -int 10 # normal minimum is 15 (225 ms)
defaults write -g KeyRepeat -int 1 # normal minimum is 2 (30 ms)
Expand Down
8 changes: 5 additions & 3 deletions config/nvim/setup.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
header "install neovimm"
#!/bin/bash

header "Neovim"

step "Install neovim dependecies"
python3 -m pip install --upgrade pynvim
Expand All @@ -16,8 +18,8 @@ step "Install packages"
nvim +'PlugInstall --sync' +qa

step "Configure Youcompleteme package"
cd ~/.config/nvim/plugged/youcompleteme && python3 install.py --all
python3 ~/.config/nvim/plugged/youcompleteme/install.py --all

step "Install fonts"
# TODO: FireCode Nerd Fron = required
cd ~/Downloads && git clone https://github.com/ryanoasis/nerd-fonts && ~/Downloads/nerd-fonts/install.sh
git clone https://github.com/ryanoasis/nerd-fonts ~/Downloads/nerd-fonts && ~/Downloads/nerd-fonts/install.sh
4 changes: 4 additions & 0 deletions config/tmux/setup.sh
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
#!/bin/bash

header "Tmux"

ln -sfn "$DOTFILES_DIR/config/tmux/.tmux.conf" ~/
4 changes: 3 additions & 1 deletion config/tmuxinator/setup.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
echo "SETUP TMUXINATOR SYMLINKS??"
#!/bin/bash

header "Tmuxinator"

TMUXINATOR_CONFIG_PROJECTS_DIR="$DOTFILES_DIR/config/tmuxinator/projects"

Expand Down
2 changes: 2 additions & 0 deletions config/zsh/.zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,5 @@ export PATH="/usr/local/bin:$PATH"
export PATH="/usr/local/bin:$PATH"
export PATH="/usr/local/bin:$PATH"
export PATH="/usr/local/bin:$PATH"
export PATH="/usr/local/bin:$PATH"
export PATH="/usr/local/bin:$PATH"
9 changes: 4 additions & 5 deletions config/zsh/setup.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
#!/bin/bash

rm -rf ~/.oh-my-zsh
git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
header "Setup ZSH"

cd ~/.oh-my-zsh
[ ! -d "~/.oh-my-zsh" ] && git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh

install_dotfile "$DOTFILES_DIR/config/zsh/.zshrc"
[ ! -d "~/.zshrc" ] && install_dotfile "$DOTFILES_DIR/config/zsh/.zshrc"

# downloads plugins
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting --depth 1
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.zsh -o ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/git-completion# curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.zsh -o ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/git-completion
# curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.zsh -o ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/git-completion curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.zsh -o ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/git-completion

# install nvm

Expand Down
4 changes: 4 additions & 0 deletions helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ function step {
echo "${GREEN}$1${RESET}"
}

function already_installed {
echo "Already installed: $1"
}

function install_dotfile {
ln -sf $1 ~/
}
Expand Down
90 changes: 47 additions & 43 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@

#!/usr/bin/env bash
export DOTFILES_DIR
export DEVELPMENT_DIR

# DOTFILES_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
DOTFILES_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
DEVELOPMENT_DIR=~/DevelopmentA
DEVELOPMENT_DIR=~/Development

source ./helpers.sh

Expand All @@ -14,81 +12,87 @@ function install_linux_drivers {
}

function setup_environment {
clear

if [[ "$OSTYPE" == "linux-gnu"* ]]; then
setup_linux
setup_generic
elif [[ "$OSTYPE" == "darwin"* ]]; then
# setup_macos
setup_macos
setup_generic
else
echo "Error: not able to setup environment: unknown OS"
fi
}

function setup_linux {
source ./config/folders/setup.sh # TODO: required ?
source ./install/apt.sh
source ./install/snap.sh
source ./config/gnome/setup.sh # TODO: requires wallpaper
}

function setup_macos {
#source ./install/xcode.sh
#source ./install/brew.sh
#source ./install/brew-cask.sh
#source ./install/mas.sh
read -p "Please login App Store to install apps from App Store, press <enter> to continue"
clear

source ./install/xcode.sh
source ./install/mas.sh
source ./install/brew.sh #TODO only install brew if not yet intalled
source ./install/brew-cask.sh #TODO only install brew if not yet intalled
source ./config/macos/setup.sh
}

function setup_generic {
source ./config/zsh/setup.sh
source ./config/dotfiles/setup.sh
source ./config/zsh/setup.sh
source ./install/node.sh
source ./config/nvim/setup.sh
source ./config/tmux/setup.sh
source ./config/tmuxinator/setup.sh
}

function setup_development_projects {
clear
source ./projects/hetwebbureau/install.sh
}

function init_menu {
echo "select the operation ************"
echo " 1) Install Linux drivers"
echo " 2) Setup enviroment"
echo " 3) Setup development projects"
echo " 4) Quit"
function request_sudo {
clear
echo "Requesting sudo powers upfront"
sudo -v
}

read n
case $n in
1)
sudo -v
install_linux_drivers
;;
2)
sudo -v
setup_environment
function print_main_menu {
clear

if [[ "$OSTYPE" == "darwin"* ]]; then
# zsh as default shell
sudo echo /usr/local/bin/zsh >> /etc/shells
echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.zshrc
chsh -s /usr/local/bin/zsh
fi
echo "What do you want to setup?"
echo " 1) Install Linux drivers"
echo " 2) Setup enviroment"
echo " 3) Setup development projects"
echo " 4) Quit"

;;
3)
setup_development_projects
;;
4)
exit
;;
*)
echo "invalid option $REPLY";;
esac
read n
case $n in
1)
request_sudo
install_linux_drivers
print_main_menu
;;
2)
request_sudo
setup_environment
print_main_menu
;;
3)
setup_development_projects
print_main_menu
;;
4)
exit
;;
*)
echo "invalid option $REPLY";;
esac
}

init_menu

print_main_menu
15 changes: 14 additions & 1 deletion install/apt.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env bash

header "Apt"

# Install apt

apps=(
Expand Down Expand Up @@ -32,9 +34,11 @@ apps=(
git-crypt
gnome-tweak-tool
graphviz
htop
kubectl
lynx
mono-xbuild
ncdu
neovim
nodejs
openconnect
Expand All @@ -44,6 +48,7 @@ apps=(
python3-pip
snapd
software-properties-commona
timetrap
tmux
tmuxinator

Expand All @@ -55,7 +60,15 @@ apps=(
upgrade
)

sudo apt install -y "${apps[@]}"
for i in "${apps[@]}"
do
apt list | grep $1 &>/dev/null
if [[ $? != 0 ]] ; then
sudo apt install -y $i
else
already_installed $i
fi
done

if ! command -v google-chrome --version &> /dev/null
then
Expand Down
32 changes: 25 additions & 7 deletions install/brew-cask.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,10 @@ which -s brew
if [[ $? != 0 ]] ; then
# Install Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
else
brew update
fi

# Install cask packages

brew install --cask

apps=(
1password
firefox
Expand All @@ -27,9 +23,31 @@ apps=(
tidal
vlc
whatsapp

# Quick Look Plugins (https://github.com/sindresorhus/quick-look-plugins)
apparency
qlcolorcode
qlmarkdown
qlprettypatch
qlstephen
qlvideo
quicklook-csv
quicklook-json
quicklookase
suspicious-package
webpquicklook
)

brew install --cask "${apps[@]}"
header "Brew cask"

BREW_LIST=$(brew list)

# Quick Look Plugins (https://github.com/sindresorhus/quick-look-plugins)
brew install --cask qlcolorcode qlstephen qlmarkdown quicklook-json qlprettypatch quicklook-csv webpquicklook suspicious-package && qlmanage qlimagesize apparency quicklookase qlvideo -r
for i in "${apps[@]}"
do
echo $BREW_LIST | grep $i &>/dev/null
if [[ $? != 0 ]] ; then
brew install --cask $i
else
already_installed $i
fi
done
Loading

0 comments on commit b3698f9

Please sign in to comment.