Index: /applications/shepherd
===================================================================
--- /applications/shepherd (revision 323)
+++ /applications/shepherd (revision 324)
@@ -166,22 +166,4 @@
 &open_logfile unless ($opt->{nolog});
 
-if ($opt->{status})
-{
-    &status;
-    exit;
-}
-
-if ($opt->{'show-config'})
-{
-    &show_config;
-    exit;
-}
-
-if ($opt->{'show-channels'})
-{
-    &show_channels;
-    exit;
-}
-
 &process_setup_commands;
 
@@ -614,4 +596,28 @@
 }
 
+sub pending
+{
+    return unless ($components_pending_install);
+
+    my @pending;
+    foreach (keys %$components_pending_install)
+    {
+	push @pending, $_;
+    }
+    unless (@pending)
+    {
+	&log("\nNo components are pending install.\n");
+	return;
+    }
+    &log("\nThe following components are pending install: " .
+	join(', ', @pending) . ".\n\n" .
+	"You may have missing Perl dependencies. To see errors,\n".
+	"run: $progname --update or $progname --check\n");
+
+    # Exit with non-zero status so this sub can be used to
+    # notify an external program (to email the owner, perhaps)
+    # about pending installs.
+    exit 1;
+}
 
 # -----------------------------------------
@@ -1089,4 +1095,5 @@
                         output=s
                         randomize
+			pending
 		     ));
   $debug = $opt->{debug};
@@ -1096,21 +1103,45 @@
 
 
+# Here we can specify which command-line options should call
+# subroutines of the same name. The field following each sub
+# name is a string that can contain a key for what action should
+# be performed following the sub:
+#   W : write config file
+#   S : print --status output
+# Shepherd will exit if at least one of these routines was
+# called.
 sub process_setup_commands
 {
-    my @opts = qw( enable disable setorder check \
-		   setpreftitle clearpreftitle setmirror reset );
-
-    my $run = 0;
-    foreach (@opts)
+    my %routines = (	enable => 'WS',
+			disable => 'WS',
+			setorder => 'WS',
+			check => 'WS',
+			setpreftitle => 'W',
+			clearpreftitle => 'W',
+			setmirror => 'W',
+			'reset' => 'W',
+			status => '',
+			'show-config' => '',
+			'show-channels' => '',
+			'pending' => ''
+		    );
+
+    my @run;
+    foreach (keys %routines)
     {
 	if ($opt->{$_})
 	{
-	    $run = 1;
-	    &$_($opt->{$_});
-	}
-    }
-    return unless ($run);
-    write_config_file();
-    status();
+	    push @run, $_;
+	    my $sub = $_;
+	    $sub =~ s/-/_/g;
+	    &$sub($opt->{$_});
+	}
+    }
+    return unless (@run);
+    foreach (@run)
+    {
+	&write_config_file if ($routines{$_} =~ /W/);
+        &status if ($routines{$_} =~ /S/);
+    }
     exit;
 }
@@ -1497,4 +1528,5 @@
 
     --check               Check status of all components, configure if necessary
+    --pending             List pending installs, if any
 
     --debug               Print lots of debugging messages
