Compare commits
5 Commits
working-fl
...
ecb1f7be3e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ecb1f7be3e | ||
|
|
66e4247199 | ||
|
|
1661e3e060 | ||
|
|
68d7520e26 | ||
|
|
cd6100548c |
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.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ Small and lightweight image and iso flasher build on `dd`.
|
|||||||
[](https://en.wikipedia.org/wiki/Software_release_life_cycle#Beta)
|
[](https://en.wikipedia.org/wiki/Software_release_life_cycle#Beta)
|
||||||
|
|
||||||
# About
|
# About
|
||||||
Java program using `dd` to make flashing iso and image files easier on the terminal. This program allows anyone to flash iso and image files without having to search for extra GUI tools and by keeping it simple and resource-friendly.
|
Java program using `dd` to make flashing iso and image files easier on the terminal. This program allows anyone to flash iso and image files without having to search for extra GUI tools by keeping it simple and resource-friendly.
|
||||||
|
|
||||||
# Requirements
|
# Requirements
|
||||||
- `Java`: 21 (Download [here](https://www.oracle.com/java/technologies/downloads/#java21)
|
- `Java`: 21 (Download [here](https://www.oracle.com/java/technologies/downloads/#java21)
|
||||||
@@ -21,7 +21,7 @@ Java program using `dd` to make flashing iso and image files easier on the termi
|
|||||||
3. You will be prompted to choose a byte size (default: 4M)
|
3. You will be prompted to choose a byte size (default: 4M)
|
||||||
4. You will be prompted to enter your oflag (default: direct)
|
4. You will be prompted to enter your oflag (default: direct)
|
||||||
5. You will be asked if you are absolutely sure that you want to continue (flashing will wipe all data)
|
5. You will be asked if you are absolutely sure that you want to continue (flashing will wipe all data)
|
||||||
- Alternative: using `cflash [device] [iso-path] [block-size] [oflag]` will skip the first question and instantly ask you, if you're absolutely sure you want to continue.
|
- Alternative: using `cflash [device] [iso-path] [block-size] [oflag]` will skip the questions and instantly ask you, if you're absolutely sure you want to continue.
|
||||||
- Once confirmed, the flash will start and a small progress bar will appear showing the flashing progress.
|
- Once confirmed, the flash will start and a small progress bar will appear showing the flashing progress.
|
||||||
- After completion, the program will detect the OS from the iso and wish you a great time with your new OS. (Example: "Done! Have fun with your new Linux installation!)
|
- After completion, the program will detect the OS from the iso and wish you a great time with your new OS. (Example: "Done! Have fun with your new Linux installation!)
|
||||||
- **IMPORTANT**: Since dd needs sudo rights, ensure you have root priviliges.
|
- **IMPORTANT**: Since dd needs sudo rights, ensure you have root priviliges.
|
||||||
|
|||||||
Reference in New Issue
Block a user