diff --git a/zsh/update.zsh b/zsh/update.zsh index d9bc824..2da7f3b 100644 --- a/zsh/update.zsh +++ b/zsh/update.zsh @@ -9,6 +9,7 @@ pull-dotfiles() { update() { + start=`date +%s` echo "\033[32;1m=== Starting the update, please enter your password ===\033[0m" # Ask for sudo right now @@ -20,6 +21,7 @@ update() { fi echo "\033[32;1m=== Updating system ===\033[0m" + start_system_update=`date +%s` # Debian based systems command -v apt > /dev/null 2>&1 @@ -53,6 +55,12 @@ update() { # Update rust if installed command -v rustup > /dev/null 2>&1 + + seconds=$((`date +%s` - $start_system_update )) + formatted=`date -ud "@$seconds" +'%H hours %M minutes %S seconds'` + echo "\033[32;1m=== System updated in $formatted ===\033[0m" + + start_rust_update=`date +%s` if [ $? -eq 0 ]; then echo "\033[32;1m=== Updating rustup ===\033[0m" rustup self update @@ -89,8 +97,19 @@ update() { cargo install-update -ag fi + seconds=$((`date +%s` - $start_rust_update )) + formatted=`date -ud "@$seconds" +'%H hours %M minutes %S seconds'` + echo "\033[32;1m=== Rust updated in $formatted ===\033[0m" + # Update the dotfiles + start_dotfiles_update=`date +%s` pull-dotfiles - echo "\033[32;1m=== Update finished ===\033[0m" + seconds=$((`date +%s` - $start_dotfiles_update )) + formatted=`date -ud "@$seconds" +'%H hours %M minutes %S seconds'` + echo "\033[32;1m=== Dotfiles updated in $formatted ===\033[0m" + + seconds=$((`date +%s` - $start_system_update )) + formatted=`date -ud "@$seconds" +'%H hours %M minutes %S seconds'` + echo "\033[32;1m=== Update finished in $formatted ===\033[0m" }