Skip to content

Commit dcb53dc

Browse files
committed
Fix install command: JGrub whole-disk device names, Step.back handling, getMountPoint() placement
- JGrub.install(): handle whole-disk device names (no partition suffix) by defaulting partition number to 0 instead of failing to parse empty suffix - AbstractInstaller.start(): check Step.back and navigate to previous action - GrubInstallerAction: move getMountPoint() from collect() to execute() so the mount point is set after the user confirms the device, not before - Rebuild ISO (cd-x86-lite) with corrected menu-cdrom.lst where 'all plugins' entries use /full.jgz instead of /default.jgz - Validate GRUB installation on VirtualBox target disk: stages 1, 1.5, 2 written successfully, menu.lst confirmed with full.jgz entries
1 parent f1b473a commit dcb53dc

3 files changed

Lines changed: 13 additions & 3 deletions

File tree

distr/src/install/org/jnode/install/AbstractInstaller.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ public void start() {
5050
Step step = input.collect();
5151
if (step != null && step.equals(Step.quit))
5252
break;
53+
if (step != null && step.equals(Step.back)) {
54+
if (lit.hasPrevious())
55+
action = lit.previous();
56+
else
57+
break out;
58+
continue;
59+
}
5360
}
5461

5562
try {

distr/src/install/org/jnode/install/action/GrubInstallerAction.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@
3838
*/
3939
public class GrubInstallerAction implements InstallerAction {
4040
private JGrub jgrub;
41+
private InputContext inContext;
4142

4243
public ActionInput getInput(final InputContext inContext) {
44+
this.inContext = inContext;
4345
return new ActionInput() {
4446
public AbstractInstaller.Step collect() {
4547
try {
@@ -50,7 +52,6 @@ public AbstractInstaller.Step collect() {
5052
JGrub jgrub = new JGrub(new PrintWriter(new OutputStreamWriter(System.out)), disk);
5153

5254
GrubInstallerAction.this.jgrub = jgrub;
53-
inContext.setStringValue(ActionConstants.INSTALL_ROOT_DIR, jgrub.getMountPoint());
5455
return AbstractInstaller.Step.forth;
5556
} catch (Exception e) {
5657
return AbstractInstaller.Step.back;
@@ -63,6 +64,7 @@ public void execute() throws Exception {
6364
if (jgrub == null) {
6465
throw new IllegalStateException("No installation device selected");
6566
}
67+
inContext.setStringValue(ActionConstants.INSTALL_ROOT_DIR, jgrub.getMountPoint());
6668
jgrub.install();
6769
}
6870

fs/src/commands/org/jnode/fs/jfat/command/JGrub.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,11 @@ public void install() throws GrubException {
9191
i--;
9292
}
9393
final String parentDeviceName = deviceName.substring(0, i + 1);
94-
final int partitionNumber = Integer.parseInt(deviceName.substring(i + 1));
94+
final String partitionSuffix = deviceName.substring(i + 1);
95+
final int partitionNumber = partitionSuffix.isEmpty() ? 0 : Integer.parseInt(partitionSuffix);
9596
//
9697

97-
final Device parentDevice = getDevice(dm, parentDeviceName);
98+
final Device parentDevice = parentDeviceName.isEmpty() ? device : getDevice(dm, parentDeviceName);
9899
final BlockDeviceAPI parentDeviceApi = getBlockDeviceAPI(parentDevice);
99100

100101
stage1.format(parentDeviceApi);

0 commit comments

Comments
 (0)