Changeset 324
- Timestamp:
- 11/30/06 15:48:13 (6 years ago)
- Files:
-
- 1 modified
-
applications/shepherd (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
applications/shepherd
r323 r324 166 166 &open_logfile unless ($opt->{nolog}); 167 167 168 if ($opt->{status})169 {170 &status;171 exit;172 }173 174 if ($opt->{'show-config'})175 {176 &show_config;177 exit;178 }179 180 if ($opt->{'show-channels'})181 {182 &show_channels;183 exit;184 }185 186 168 &process_setup_commands; 187 169 … … 614 596 } 615 597 598 sub pending 599 { 600 return unless ($components_pending_install); 601 602 my @pending; 603 foreach (keys %$components_pending_install) 604 { 605 push @pending, $_; 606 } 607 unless (@pending) 608 { 609 &log("\nNo components are pending install.\n"); 610 return; 611 } 612 &log("\nThe following components are pending install: " . 613 join(', ', @pending) . ".\n\n" . 614 "You may have missing Perl dependencies. To see errors,\n". 615 "run: $progname --update or $progname --check\n"); 616 617 # Exit with non-zero status so this sub can be used to 618 # notify an external program (to email the owner, perhaps) 619 # about pending installs. 620 exit 1; 621 } 616 622 617 623 # ----------------------------------------- … … 1089 1095 output=s 1090 1096 randomize 1097 pending 1091 1098 )); 1092 1099 $debug = $opt->{debug}; … … 1096 1103 1097 1104 1105 # Here we can specify which command-line options should call 1106 # subroutines of the same name. The field following each sub 1107 # name is a string that can contain a key for what action should 1108 # be performed following the sub: 1109 # W : write config file 1110 # S : print --status output 1111 # Shepherd will exit if at least one of these routines was 1112 # called. 1098 1113 sub process_setup_commands 1099 1114 { 1100 my @opts = qw( enable disable setorder check \ 1101 setpreftitle clearpreftitle setmirror reset ); 1102 1103 my $run = 0; 1104 foreach (@opts) 1115 my %routines = ( enable => 'WS', 1116 disable => 'WS', 1117 setorder => 'WS', 1118 check => 'WS', 1119 setpreftitle => 'W', 1120 clearpreftitle => 'W', 1121 setmirror => 'W', 1122 'reset' => 'W', 1123 status => '', 1124 'show-config' => '', 1125 'show-channels' => '', 1126 'pending' => '' 1127 ); 1128 1129 my @run; 1130 foreach (keys %routines) 1105 1131 { 1106 1132 if ($opt->{$_}) 1107 1133 { 1108 $run = 1; 1109 &$_($opt->{$_}); 1110 } 1111 } 1112 return unless ($run); 1113 write_config_file(); 1114 status(); 1134 push @run, $_; 1135 my $sub = $_; 1136 $sub =~ s/-/_/g; 1137 &$sub($opt->{$_}); 1138 } 1139 } 1140 return unless (@run); 1141 foreach (@run) 1142 { 1143 &write_config_file if ($routines{$_} =~ /W/); 1144 &status if ($routines{$_} =~ /S/); 1145 } 1115 1146 exit; 1116 1147 } … … 1497 1528 1498 1529 --check Check status of all components, configure if necessary 1530 --pending List pending installs, if any 1499 1531 1500 1532 --debug Print lots of debugging messages
