[Fai-commit] r4635 - people/eartoast/addons/class-reference
glaweh-guest at alioth.debian.org
glaweh-guest at alioth.debian.org
Thu Oct 18 16:41:21 UTC 2007
Author: glaweh-guest
Date: 2007-10-18 16:41:21 +0000 (Thu, 18 Oct 2007)
New Revision: 4635
Modified:
people/eartoast/addons/class-reference/fai-classes-config
Log:
change semantics:
- first non-option command line argument is the fai configdir
- add getopt support for '-h' and '--help'
- add a help message
Modified: people/eartoast/addons/class-reference/fai-classes-config
===================================================================
--- people/eartoast/addons/class-reference/fai-classes-config 2007-10-18 15:54:06 UTC (rev 4634)
+++ people/eartoast/addons/class-reference/fai-classes-config 2007-10-18 16:41:21 UTC (rev 4635)
@@ -8,9 +8,13 @@
# ...
use strict;
+use Getopt::Std;
use File::Find;
use File::Basename;
+# Command line options
+our $opt_h;
+
# Dirs used for revision control system's metadata
my @rcs_dirs = qw'CVS .svn .arch-ids {arch}';
@@ -275,8 +279,27 @@
}
}
-die "run this script within the fai config space" unless (-d "class");
+sub HELP_MESSAGE {
+ my $name = basename($0);
+ print << "EOF";
+Usage: $name <fai-configdir>
+EOF
+ exit 1;
+}
+
+
+# Main program
+
+getopts('h');
+HELP_MESSAGE() if ($opt_h);
+HELP_MESSAGE() unless ($ARGV[0]);
+if (! -d "$ARGV[0]/class") {
+ print STDERR "$ARGV[0]/class does not exist. Is $ARGV[0] really a FAI configdir?\n";
+ exit 1;
+}
+chdir $ARGV[0];
+
scan_class();
scan_files();
scan_scripts();
More information about the Fai-commit
mailing list