update check will always print something
This commit is contained in:
		
							parent
							
								
									abb4a02a9a
								
							
						
					
					
						commit
						22c1a395af
					
				@ -4,7 +4,7 @@ _check_date_if_format() {
 | 
				
			|||||||
    local format=`_date_format`
 | 
					    local format=`_date_format`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if [ "$format" != "" ]; then
 | 
					    if [ "$format" != "" ]; then
 | 
				
			||||||
        _check_date $format
 | 
					        _check_date $format $1
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -60,7 +60,7 @@ _check_date() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    if [ "$new_date" != "$old_date" ]; then
 | 
					    if [ "$new_date" != "$old_date" ]; then
 | 
				
			||||||
        _sentence not_updated
 | 
					        _sentence not_updated
 | 
				
			||||||
    elif [ "$UPDATE_CHECK_ALWAYS" = "true" ]; then
 | 
					    elif [ "$UPDATE_CHECK_ALWAYS" = "true" ] || [ "$2" = "force" ]; then
 | 
				
			||||||
        _sentence updated
 | 
					        _sentence updated
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -71,8 +71,7 @@ update-system() {
 | 
				
			|||||||
    sudoresult=$(sudo -nv 2>&1)
 | 
					    sudoresult=$(sudo -nv 2>&1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if [ $? -eq 0 ]; then
 | 
					    if [ $? -eq 0 ]; then
 | 
				
			||||||
        echo "\033[33;1m=== You are not a sudoer, skipping system update... ===\033[0m"
 | 
					        # Nothing to do
 | 
				
			||||||
        return 1
 | 
					 | 
				
			||||||
    elif echo $sudoresult | grep -q '^sudo:'; then
 | 
					    elif echo $sudoresult | grep -q '^sudo:'; then
 | 
				
			||||||
        echo "\033[32;1m=== Starting system update, please enter your password ===\033[0m"
 | 
					        echo "\033[32;1m=== Starting system update, please enter your password ===\033[0m"
 | 
				
			||||||
        sudo true
 | 
					        sudo true
 | 
				
			||||||
@ -254,6 +253,10 @@ update-neovim() {
 | 
				
			|||||||
    echo "\033[32;1m=== Neovim updated in $formatted ===\033[0m"
 | 
					    echo "\033[32;1m=== Neovim updated in $formatted ===\033[0m"
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					_print_help() {
 | 
				
			||||||
 | 
					    echo
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
main() {
 | 
					main() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if [ $# -eq 0 ]; then
 | 
					    if [ $# -eq 0 ]; then
 | 
				
			||||||
@ -287,18 +290,27 @@ main() {
 | 
				
			|||||||
        formatted=`date -ud "@$seconds" +'%H hours %M minutes %S seconds'`
 | 
					        formatted=`date -ud "@$seconds" +'%H hours %M minutes %S seconds'`
 | 
				
			||||||
        echo "\033[32;1m=== Update finished in $formatted ===\033[0m"
 | 
					        echo "\033[32;1m=== Update finished in $formatted ===\033[0m"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        _check_date_if_format force
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        case $1 in;
 | 
					        while [ $# -gt  0 ]; do
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            "system") update-system;;
 | 
					            case $1 in;
 | 
				
			||||||
            "rust") update-rust;;
 | 
					 | 
				
			||||||
            "npm") update-npm;;
 | 
					 | 
				
			||||||
            "dotfiles") update-dotfiles;;
 | 
					 | 
				
			||||||
            "neovim") update-neovim;;
 | 
					 | 
				
			||||||
            "check") _check_date_if_format;;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        esac
 | 
					                "system") update-system;;
 | 
				
			||||||
 | 
					                "rust") update-rust;;
 | 
				
			||||||
 | 
					                "npm") update-npm;;
 | 
				
			||||||
 | 
					                "dotfiles") update-dotfiles;;
 | 
				
			||||||
 | 
					                "neovim") update-neovim;;
 | 
				
			||||||
 | 
					                "check") _check_date_if_format force;;
 | 
				
			||||||
 | 
					                "startup") _check_date_if_format;;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            esac
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            shift
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user