Show durations of updates
This commit is contained in:
parent
1e701fcdb7
commit
7d09b9794e
|
@ -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"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue