diff --git a/home/.chezmoiscripts/run_onchange_after_10-install-packages.sh.tmpl b/home/.chezmoiscripts/run_onchange_after_10-install-packages.sh.tmpl index 1440d12..dfa9b32 100644 --- a/home/.chezmoiscripts/run_onchange_after_10-install-packages.sh.tmpl +++ b/home/.chezmoiscripts/run_onchange_after_10-install-packages.sh.tmpl @@ -1,10 +1,17 @@ #!/usr/bin/env bash -# Load local library -. ./run_before-common.lib - +# Logging function +log() { + printf "${C_BLU}>>>>> %s <<<<<${F_RST}" "$1" +} + +# Testing existance function +exist() { + command -v "$1$" >/dev/null 2>&1 +} +# Packages to install packages=( curl direnv @@ -19,7 +26,7 @@ packages=( {{ if (eq .chezmoi.osRelease.id "manjaro" "arch") -}} - info1 ">>>>> Begin Arch/Manjaro Linux packages installation <<<<<" + log ">>>>> Begin Arch/Manjaro Linux packages installation <<<<<" ## Update system {{- if ne .chezmoi.username "root" }} @@ -29,8 +36,8 @@ packages=( {{- end}} ## Install yay - if [ ! $(command -v yay) ]; then - info2 "installing yay" + if [ ! exist "yay" ]; then + log "installing yay" {{- if ne .chezmoi.username "root" }} sudo pacman -S --needed --noconfirm git base-devel {{- else}} @@ -45,16 +52,16 @@ packages=( ## Install packages for package in ${packages[@]}; do if [ "$(yay -Qq $package 2> /dev/null)" != $package ]; then - info2 "installing ${package}..." + log "installing ${package}..." yay -S --noconfirm $package fi done - info1 ">>>>> Finish Arch/Manjaro Linux packages installation <<<<<" + log ">>>>> Finish Arch/Manjaro Linux packages installation <<<<<" {{ else if (eq .chezmoi.osRelease.id "debian" "ubuntu") -}} - info1 ">>>>> Begin Debian/Ubuntu Linux packages installation <<<<<" + log ">>>>> Begin Debian/Ubuntu Linux packages installation <<<<<" DEBIAN_FRONTEND=noninteractive @@ -96,7 +103,7 @@ packages=( ) for package in ${packages[@]}; do - info2 "installing ${package}..." + log "installing ${package}..." {{- if ne .chezmoi.username "root" }} sudo -E apt-get install --yes --no-install-recommends --ignore-missing $package @@ -105,7 +112,7 @@ packages=( {{- end }} done - info1 ">>>>> Finish Debian/Ubuntu Linux packages installation <<<<<" + log ">>>>> Finish Debian/Ubuntu Linux packages installation <<<<<" {{- end }} diff --git a/home/.chezmoiscripts/run_onchange_after_20-config-zim.sh.tmpl b/home/.chezmoiscripts/run_onchange_after_20-config-zim.sh.tmpl index e4518fa..2adebc0 100644 --- a/home/.chezmoiscripts/run_onchange_after_20-config-zim.sh.tmpl +++ b/home/.chezmoiscripts/run_onchange_after_20-config-zim.sh.tmpl @@ -1,14 +1,22 @@ #!/usr/bin/env bash -# Load local library -. ./run_before-common.lib +# Logging function +log() { + printf "${C_BLU}>>>>> %s <<<<<${F_RST}" "$1" +} + +# Testing existance function +exist() { + command -v "$1$" >/dev/null 2>&1 +} -ZIMDIR=${HOME}/.zim +ZIMDIR=${HOME}/.zim: +# Packages to install packages=( starship zsh @@ -17,14 +25,14 @@ packages=( ### Install Zsh ### -info1 ">>>>> Begin Zsh installation <<<<<" +log ">>>>> Begin Zsh installation <<<<<" {{ if (eq .chezmoi.osRelease.id "manjaro" "arch") -}} ## install packages for package in ${packages[@]}; do if [ "$(yay -Qq $package 2> /dev/null)" != $package ]; then - info2 "installing ${package}..." + log "installing ${package}..." yay -S --noconfirm $package fi done @@ -36,7 +44,7 @@ info1 ">>>>> Begin Zsh installation <<<<<" ## install packages for package in ${packages[@]}; do - info2 "installing ${package}..." + log "installing ${package}..." {{- if ne .chezmoi.username "root" }} sudo -E apt-get install --yes --no-install-recommends --ignore-missing $package @@ -45,18 +53,18 @@ info1 ">>>>> Begin Zsh installation <<<<<" {{- end }} done - info2 "installing starship..." + log "installing starship..." mist install starship-bin {{- end }} -info1 ">>>>> Finish Zsh installation <<<<<" +log ">>>>> Finish Zsh installation <<<<<" ### Config Zsh ### -info1 ">>>>> Installing Zim Framework <<<<<" +log ">>>>> Installing Zim Framework <<<<<" $(which zsh) -c "source ${ZIMDIR}/zimfw.zsh init -q" -info1 ">>>>> Finish zsh installation <<<<<" +log ">>>>> Finish zsh installation <<<<<" diff --git a/home/.chezmoiscripts/run_onchange_after_80-install-lvim.sh.tmpl b/home/.chezmoiscripts/run_onchange_after_80-install-lvim.sh.tmpl index 68bc686..52c09e4 100644 --- a/home/.chezmoiscripts/run_onchange_after_80-install-lvim.sh.tmpl +++ b/home/.chezmoiscripts/run_onchange_after_80-install-lvim.sh.tmpl @@ -1,10 +1,18 @@ #!/usr/bin/env bash -# Load local library -. ./run_before-common.lib +# Logging function +log() { + printf "${C_BLU}>>>>> %s <<<<<${F_RST}" "$1" +} + +# Testing existance function +exist() { + command -v "$1$" >/dev/null 2>&1 +} +# Packages to install packages=( cargo go @@ -17,7 +25,7 @@ packages=( -info1 ">>>>> Begin LVim installation <<<<<" +log ">>>>> Begin LVim installation <<<<<" {{ if (eq .chezmoi.osRelease.id "manjaro" "arch") -}} @@ -27,7 +35,7 @@ info1 ">>>>> Begin LVim installation <<<<<" ## Install packages for package in ${packages[@]}; do if [ "$(yay -Qq $package 2> /dev/null)" != $package ]; then - info2 "installing ${package}..." + log "installing ${package}..." yay -S --noconfirm $package fi done @@ -51,7 +59,7 @@ info1 ">>>>> Begin LVim installation <<<<<" packages=(${packages[@]//neovim/}) for package in ${packages[@]}; do - info2 "installing ${package}..." + log "installing ${package}..." {{- if ne .chezmoi.username "root" }} sudo -E apt-get install --yes --no-install-recommends --ignore-missing $package @@ -60,14 +68,14 @@ info1 ">>>>> Begin LVim installation <<<<<" {{- end }} done - info2 "installing neovim..." + log "installing neovim..." mist install neovim {{- end }} -info2 "installing lvim..." +log "installing lvim..." LV_BRANCH='release-1.3/neovim-0.9' bash <(curl -s 'https://raw.githubusercontent.com/LunarVim/LunarVim/release-1.3/neovim-0.9/utils/installer/install.sh') -info1 ">>>>> Finish LVim installation <<<<<" +log ">>>>> Finish LVim installation <<<<<"