|
From: <cr...@us...> - 2008-06-04 11:00:37
|
Revision: 4191
http://jnode.svn.sourceforge.net/jnode/?rev=4191&view=rev
Author: crawley
Date: 2008-06-04 04:00:35 -0700 (Wed, 04 Jun 2008)
Log Message:
-----------
Converted JGrubCommand
Modified Paths:
--------------
trunk/fs/descriptors/org.jnode.fs.jfat.command.xml
trunk/fs/src/fs/org/jnode/fs/jfat/command/JGrubInstallCommand.java
Modified: trunk/fs/descriptors/org.jnode.fs.jfat.command.xml
===================================================================
--- trunk/fs/descriptors/org.jnode.fs.jfat.command.xml 2008-06-04 10:43:49 UTC (rev 4190)
+++ trunk/fs/descriptors/org.jnode.fs.jfat.command.xml 2008-06-04 11:00:35 UTC (rev 4191)
@@ -32,6 +32,11 @@
<argument argLabel="device"/>
</sequence>
</syntax>
+ <syntax alias="grub">
+ <sequence description="install a grub stage2 loader">
+ <argument argLabel="device"/>
+ </sequence>
+ </syntax>
</extension>
<extension point="org.jnode.security.permissions">
Modified: trunk/fs/src/fs/org/jnode/fs/jfat/command/JGrubInstallCommand.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/jfat/command/JGrubInstallCommand.java 2008-06-04 10:43:49 UTC (rev 4190)
+++ trunk/fs/src/fs/org/jnode/fs/jfat/command/JGrubInstallCommand.java 2008-06-04 11:00:35 UTC (rev 4191)
@@ -29,40 +29,33 @@
import org.jnode.driver.block.BlockDeviceAPI;
import org.jnode.shell.AbstractCommand;
import org.jnode.shell.CommandLine;
-import org.jnode.shell.help.Help;
-import org.jnode.shell.help.Parameter;
-import org.jnode.shell.help.ParsedArguments;
-import org.jnode.shell.help.argument.DeviceArgument;
+import org.jnode.shell.syntax.Argument;
+import org.jnode.shell.syntax.DeviceArgument;
/**
* Grub Installer command for JNode.
- * example of usage : grub hdb0
*
* TODO: Add more options for supporting Grub with user specified file
* TODO: Add more command support for grub installation.
* @author Tango Devian
*/
public class JGrubInstallCommand extends AbstractCommand {
- static final DeviceArgument ARG_DEVICE = new DeviceArgument("device partition", "device where grub stage 2 will be installed", BlockDeviceAPI.class);
+ private final DeviceArgument ARG_DEVICE = new DeviceArgument(
+ "device", Argument.MANDATORY,
+ "device where grub stage 2 will be installed", BlockDeviceAPI.class);
-
- static final Help.Info HELP_INFO = new Help.Info("grub",
- "Install the grub to the specified location.",
- new Parameter(ARG_DEVICE, Parameter.MANDATORY));
- /**
- * @param args
- * @throws Exception
- */
- public static void main(String... args) throws Exception {
+ public JGrubInstallCommand() {
+ super("Install a Grub stage2 loader on a disc device");
+ registerArguments(ARG_DEVICE);
+ }
+
+ public static void main(String[] args) throws Exception {
new JGrubInstallCommand().execute(args);
}
- /**
- *
- */
- public void execute(CommandLine commandLine, InputStream in, PrintStream out, PrintStream err) throws Exception {
- ParsedArguments cmdLine = HELP_INFO.parse(commandLine);
- Device device = ARG_DEVICE.getDevice(cmdLine);
+ public void execute(CommandLine commandLine, InputStream in, PrintStream out, PrintStream err)
+ throws GrubException {
+ Device device = ARG_DEVICE.getValue();
JGrub jgrub = new JGrub(out, err, device);
jgrub.install();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|