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