From da3b5628ada15687da1d2f4fb8ee29526e7250b2 Mon Sep 17 00:00:00 2001 From: bretello Date: Sun, 6 Dec 2020 01:32:04 +0100 Subject: [PATCH] cleanup documentation/install script --- README.md | 16 ---------------- brethil_dotfile.sh | 14 +++++++------- install.sh | 44 ++++++++++++++++++++------------------------ 3 files changed, 27 insertions(+), 47 deletions(-) diff --git a/README.md b/README.md index 942361f..d4cbc91 100644 --- a/README.md +++ b/README.md @@ -57,22 +57,6 @@ by the install script. The self-update routine can be called manually by calling If you do not want to run the installer script, you can just add source `brethil_dotfile.sh` in your `.zshrc`. This requires antibody installed. -### Installed - -1. `antibody`: zsh plugin manager - - `oh-my-zsh` - - `oh-my-zsh` zsh themes: `brethil` and `brethil-minimal`. -2. (amix's awesome vimrc)[https://www.github.com/amix/vimrc]: A quite nice vim rc. -3. `byobu`: wrapper/config for tmux, a screen multiplexer -4. `grc`/`ccze`: output colorizers, can color the output of any command, usage: - - grc - | ccze - -5. `bmon`: bandwidth monitor, shows graphs for bandwith usage -6. `mtr`: my traceroute, traceroute+ping network utility -7. `htop`: better top - ### Available Functions 0. `cheat`: show cheat sheet for commands using cheat.sh (`cheat `) diff --git a/brethil_dotfile.sh b/brethil_dotfile.sh index a65168a..7e6e29f 100755 --- a/brethil_dotfile.sh +++ b/brethil_dotfile.sh @@ -1,5 +1,5 @@ # Check for update, set DISABLE_UPDATE_PROMPT=yes to disable the prompt and automatically update -env DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT DOTFILES=$DOTFILES zsh -f $DOTFILES/check_for_update.sh +env DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT DOTFILES="$DOTFILES" zsh -f "$DOTFILES/check_for_update.sh" # theme-related variables export ZSH_THEME="brethil" @@ -8,12 +8,12 @@ export VIRTUAL_ENV_DISABLE_PROMPT=true # Source all other plugins source <(antibody init) -export ZSH=$(antibody path robbyrussell/oh-my-zsh) -antibody bundle < $DOTFILES/antibody_plugins.txt +export ZSH="$(antibody path robbyrussell/oh-my-zsh)" +antibody bundle < "$DOTFILES/antibody_plugins.txt" uname="$(uname -a)" if [[ $uname == *"ARCH"* || $uname == *"MANJARO"* ]]; then - antibody bundle < $DOTFILES/antibody_plugins_arch.txt + antibody bundle < "$DOTFILES/antibody_plugins_arch.txt" fi # Enable zsh autocorrection @@ -73,9 +73,9 @@ aliases_file=$DOTFILES/aliases.sh # Aliases definitions colors_file=$DOTFILES/colors.sh # Colors definitions # Source extras -if [ -f $functions_file ]; then source $functions_file; else echo "[brethil-dotfiles] Couldn't load functions: $functions_file"; fi -if [ -f $aliases_file ]; then source $aliases_file; else echo "[brethil-dotfiles] Couldn't load aliases: $aliases_file"; fi -if [ -f $colors_file ]; then source $colors_file; else echo "[brethil-dotfiles] Couldn't load colors: $colors_file";fi +if [ -f "$functions_file" ]; then source "$functions_file"; else echo "[brethil-dotfiles] Couldn't load functions: $functions_file"; fi +if [ -f "$aliases_file" ]; then source "$aliases_file"; else echo "[brethil-dotfiles] Couldn't load aliases: $aliases_file"; fi +if [ -f "$colors_file" ]; then source "$colors_file"; else echo "[brethil-dotfiles] Couldn't load colors: $colors_file";fi ### SETUP PATHS #### export PATH=$PATH:$HOME/bin diff --git a/install.sh b/install.sh index ff92670..cad7e87 100755 --- a/install.sh +++ b/install.sh @@ -5,18 +5,6 @@ # Get the location for the dotfiles DOTFILES=$PWD -# Install packages -# vim, zsh -# antibody: zsh plugin manager -# grc: generic colourizer, colors output of any command -# ccze: similar to the above -# byobu: configuration/wrapper for tmux -# bmon: bandwidth monitor, monitors bandwith usage, shows graph -# mtr: mytraceroute, traceroute tool -# pv: pipe view, monitor the progress of data through a pipe -# byobu: tmux wrapper -# htop: like top, but bettah -# bat: a cat clone on wings PACKAGES="vim zsh antibody git grc ccze bmon mtr tmux byobu htop" function setup_git { @@ -150,15 +138,16 @@ function brethil_dotfiles_setup { mkdir -p "$bin" "$projects" "$git" && echo "Created dirs $bin, $projects, $git" # prepare .zshrc + cp "$HOME/.zshrc"{,.pre-brethil-dotfiles} exec 3>&1 # save stdout - exec 1>"$HOME/.zshrc" + exec 1>>"$HOME/.zshrc" echo -e "\n\n# brethil's dotfiles:" echo "DOTFILES=$DOTFILES" echo "source \$DOTFILES/brethil_dotfile.sh" echo -e "# End of brethil's dotfiles\n\n" exec 1>&3 # restore stdout - antibody bundle $DOTFILES/antibody_plugins.txt + antibody bundle "$DOTFILES/antibody_plugins.txt" antibody update fix_annoyances @@ -179,19 +168,26 @@ function brethil_dotfiles_setup { ln -s $DOTFILES/brethil.zsh-theme ${oh_my_zsh_path}/themes/ # TODO: improve this # Symlink brethil-minimal.zsh-theme ln -s $DOTFILES/brethil-minimal.zsh-theme ${oh_my_zsh_path}/themes/ - - # TODO: powerline? - - } +function main(){ + set -e + set -o pipefail + # Setup + # brethil_dotfiles_setup + source "$DOTFILES/colors.sh" -# Setup -brethil_dotfiles_setup + echo -e "$BOLD$GREEN Install complete!" + echo "" + echo "$WHITE Set \$DOTFILES to $DOTFILES" + echo -e "$RED Functions definitions:$WHITE \$DOTFILES/functions.sh\n\tyou can add your own functions in ~/.dotfiles_functions" + echo -e "$RED Aliases definitions:$WHITE \$DOTFILES/aliases.sh\n\tyou can add your own aliases in ~/.dotfiles_aliases)" + echo -e "$RED Colors definitions:$WHITE \$DOTFILES/colors.sh" + echo -e "$CLEAR" + echo "More zsh plugins can be added using antibody, adding them at \$DOTFILES/antibody_plugins.txt" -echo "Functions definitions in $DOTFILES/functions.sh (you can add your own functions in ~/.dotfiles_functions)" -echo "Aliases definitions in $DOTFILES/aliases.sh (you can add your own aliases in ~/.dotfiles_aliases)" -echo "Colors are defined in $DOTFILES/colors.sh" + echo "Type '. ~/.zshrc' or 'exec zsh -l' to source the new configuration." +} -echo "Type . ~/.zshrc to source the new dotfiles, or simply launch another shell. )" +main