Show durations of updates

This commit is contained in:
Thomas Forgione 2018-11-19 09:59:36 +01:00
parent 1e701fcdb7
commit 7d09b9794e
No known key found for this signature in database
GPG Key ID: 203DAEA747F48F41
1 changed files with 20 additions and 1 deletions

View File

@ -9,6 +9,7 @@ pull-dotfiles() {
update() { update() {
start=`date +%s`
echo "\033[32;1m=== Starting the update, please enter your password ===\033[0m" echo "\033[32;1m=== Starting the update, please enter your password ===\033[0m"
# Ask for sudo right now # Ask for sudo right now
@ -20,6 +21,7 @@ update() {
fi fi
echo "\033[32;1m=== Updating system ===\033[0m" echo "\033[32;1m=== Updating system ===\033[0m"
start_system_update=`date +%s`
# Debian based systems # Debian based systems
command -v apt > /dev/null 2>&1 command -v apt > /dev/null 2>&1
@ -53,6 +55,12 @@ update() {
# Update rust if installed # Update rust if installed
command -v rustup > /dev/null 2>&1 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 if [ $? -eq 0 ]; then
echo "\033[32;1m=== Updating rustup ===\033[0m" echo "\033[32;1m=== Updating rustup ===\033[0m"
rustup self update rustup self update
@ -89,8 +97,19 @@ update() {
cargo install-update -ag cargo install-update -ag
fi 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 # Update the dotfiles
start_dotfiles_update=`date +%s`
pull-dotfiles 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"
} }