Changeset 599 for applications/shepherd

Show
Ignore:
Timestamp:
03/06/07 17:34:42 (6 years ago)
Author:
lincoln
Message:

change --noupdate logic around: shepherd will now always check whuffy for updates and then whinge to the user if they have set --noupdate but there are updates pending. it will still honour the --noupdate and not actually download or apply the updates though.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • applications/shepherd

    r593 r599  
    22 
    33my $progname = 'shepherd'; 
    4 my $version = '0.4.74'; 
     4my $version = '0.4.75'; 
    55 
    66# tv_grab_au 
     
    189189# --------------------------------------------------------------------------- 
    190190 
    191 unless ($opt->{noupdate}) 
    192 { 
    193     if (&update())  
    194     { 
    195         &write_config_file; 
    196     } 
     191if (&update()) 
     192{ 
     193    &write_config_file; 
    197194} 
    198195 
     
    282279        if (update_component($proggy, $latestversion, $progtype, $csum1, $csum2)) 
    283280        { 
    284             $made_changes = 1; 
     281            $made_changes++; 
    285282        } 
    286283        delete $clist{$proggy}; 
     284    } 
     285 
     286    # if user has set system to not update, then simply tell them if there are updates 
     287    if ((defined $opt->{noupdate}) && ($made_changes)) { 
     288        &log(2,"\n$made_changes components with pending updates, but --noupdate specified.\n". 
     289               "It is recommended that you manually run --update at your earliest convenience,\n". 
     290                "as these updates may be for critical bugfixes!\n\n"); 
     291        &countdown(20); 
     292        return 0; 
    287293    } 
    288294 
     
    292298            &log("\nDeleted component: $_.\n"); 
    293299            disable($_, 2); 
    294             $made_changes = 1; 
     300            $made_changes++; 
    295301        } 
    296302    } 
     
    335341    { 
    336342        $result = &versioncmp($ver, $latestversion); 
    337         $action =    $result == -1 ? ($ver ? "UPGRADING" : "NEW") : 
    338                      $result ==  1 ? "DOWNGRADING" : 
    339                                      "up to date"; 
    340     } 
    341     &log(sprintf    "* %-55s%16s\n", 
     343 
     344        if (!defined $opt->{noupdate}) { 
     345            $action =  $result == -1 ? ($ver ? "UPGRADING" : "NEW") : 
     346                       $result ==  1 ? "DOWNGRADING" : 
     347                                       "up to date"; 
     348        } else { 
     349            $action =  $result == -1 ? ($ver ? "UPDATE AVAILABLE" : "NEW COMPONENT") : 
     350                       $result ==  1 ? "DOWNGRADE ADVISED" : 
     351                                       "up to date"; 
     352        } 
     353    } 
     354    &log(2,sprintf  "* %-54s%17s\n", 
    342355                    ucfirst($progtype) . " $proggy" . 
    343356                        ($ver ? " v$ver" : '') . "...", 
    344357                    $action); 
     358 
     359    return $result if (defined $opt->{noupdate}); 
    345360    return 0 unless ($result); 
    346361    install($proggy, $latestversion, $progtype, $ver, $csum1, $csum2);