Added dd
This commit is contained in:
26
Dd.java
Normal file
26
Dd.java
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
|
||||||
|
public class Dd {
|
||||||
|
public static void dd() {
|
||||||
|
try {
|
||||||
|
ProcessBuilder pb = new ProcessBuilder("sudo", "dd", "if=" + FilePathAdd.ImagePath, "of=" + StorageDeviceLister.fullPath, "bs=" + BlockSize.blockSizeString, "status=progress", "oflag=" + OflagHandler.oflagHandleString);
|
||||||
|
pb.redirectErrorStream(true);
|
||||||
|
Process process = pb.start();
|
||||||
|
|
||||||
|
BufferedReader reader = new BufferedReader(
|
||||||
|
new InputStreamReader(process.getInputStream())
|
||||||
|
);
|
||||||
|
|
||||||
|
int character;
|
||||||
|
while ((character = reader.read()) != -1) {
|
||||||
|
char c = (char) character;
|
||||||
|
System.out.print(c);
|
||||||
|
System.out.flush();
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,10 +12,12 @@ public class Flasher {
|
|||||||
System.out.println(" - To be used oflag: " + OflagHandler.oflagHandleString);
|
System.out.println(" - To be used oflag: " + OflagHandler.oflagHandleString);
|
||||||
input = UserInput.nextLine();
|
input = UserInput.nextLine();
|
||||||
if (YesNo.check(input)) {
|
if (YesNo.check(input)) {
|
||||||
System.out.println("Flashing...");
|
System.out.println("Starting to flash...");
|
||||||
} else {
|
} else {
|
||||||
System.out.println("Canceling...");
|
System.out.println("Canceling...");
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
|
Dd.dd();
|
||||||
|
System.out.println("Flash completed.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user