Compare commits
1 Commits
68d7520e26
...
working-fl
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c086bcc2e6 |
@@ -1,12 +1,14 @@
|
|||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
|
|
||||||
public class BlockSize {
|
public class BlockSize {
|
||||||
public static void blockSize(Scanner UserInput) {
|
|
||||||
|
public static String blockSizeString = "";
|
||||||
|
|
||||||
|
static String blockSize(Scanner UserInput) {
|
||||||
System.out.println("Choose a block size (Default: 4M)");
|
System.out.println("Choose a block size (Default: 4M)");
|
||||||
System.out.println("512KB (1), 1M (2), 2M (3), 4M (4), 8M (5), 16M (6)");
|
System.out.println("512KB (1), 1M (2), 2M (3), 4M (4), 8M (5), 16M (6)");
|
||||||
String blockSizeInput = UserInput.nextLine();
|
String blockSizeInput = UserInput.nextLine();
|
||||||
|
|
||||||
String blockSizeString;
|
|
||||||
switch (blockSizeInput) {
|
switch (blockSizeInput) {
|
||||||
case "1":
|
case "1":
|
||||||
blockSizeString = "512KB";
|
blockSizeString = "512KB";
|
||||||
@@ -30,5 +32,7 @@ public class BlockSize {
|
|||||||
blockSizeString = "4M";
|
blockSizeString = "4M";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
System.out.println("Using blocksize of: " + blockSizeString);
|
||||||
|
return blockSizeString;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,13 @@
|
|||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
|
|
||||||
public class FilePathAdd {
|
public class FilePathAdd {
|
||||||
public static void filePath(Scanner UserInput) {
|
|
||||||
|
public static String ImagePath = "";
|
||||||
|
|
||||||
|
protected static String filePath(Scanner UserInput) {
|
||||||
System.out.println("Please enter the FULL Path of your ISO / Image. ()");
|
System.out.println("Please enter the FULL Path of your ISO / Image. ()");
|
||||||
String ImagePath = UserInput.nextLine();
|
ImagePath = UserInput.nextLine();
|
||||||
System.out.println("Using File: " + ImagePath);
|
System.out.println("Using File: " + ImagePath);
|
||||||
|
return ImagePath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
20
Flasher.java
20
Flasher.java
@@ -1,11 +1,21 @@
|
|||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
|
|
||||||
public class Flasher {
|
public class Flasher {
|
||||||
publicstatic voic flasher(Scanner UserInput) {
|
public static void flasher(Scanner UserInput) {
|
||||||
|
|
||||||
|
String input = "";
|
||||||
|
|
||||||
System.out.println("The programm wil use the following configuration, do you want to flash with this? (y/n)");
|
System.out.println("The programm wil use the following configuration, do you want to flash with this? (y/n)");
|
||||||
System.out.println(" - To be flashed device: " + device);
|
System.out.println(" - To be flashed device: " + StorageDeviceLister.fullPath);
|
||||||
|
System.out.println(" - To be used path: " + FilePathAdd.ImagePath);
|
||||||
|
System.out.println(" - To bed used blocksize: " + BlockSize.blockSizeString);
|
||||||
|
System.out.println(" - To be used oflag: " + OflagHandler.oflagHandleString);
|
||||||
|
input = UserInput.nextLine();
|
||||||
|
if (YesNo.check(input)) {
|
||||||
|
System.out.println("Flashing...");
|
||||||
|
} else {
|
||||||
|
System.out.println("Canceling...");
|
||||||
|
System.exit(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public class Main {
|
|||||||
FilePathAdd.filePath(UserInput);
|
FilePathAdd.filePath(UserInput);
|
||||||
BlockSize.blockSize(UserInput);
|
BlockSize.blockSize(UserInput);
|
||||||
OflagHandler.handleOflag(UserInput);
|
OflagHandler.handleOflag(UserInput);
|
||||||
|
Flasher.flasher(UserInput);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
|
|
||||||
public class OflagHandler {
|
public class OflagHandler {
|
||||||
public static void handleOflag(Scanner UserInput) {
|
|
||||||
System.out.println("Okay, next up please define your oflag. If you have the block-size default, you can choose default here aswell");
|
public static String oflagHandleString = "";
|
||||||
System.out.println("Available flags: direct (default), dsync, sync, nocache");
|
|
||||||
|
static String handleOflag(Scanner UserInput) {
|
||||||
|
System.out.println("Okay, next up please define your oflag (Default: direct)");
|
||||||
|
System.out.println("Available flags: direct (1), dsync (2), sync (3), nocache (4)");
|
||||||
String oflagHandleInput = UserInput.nextLine();
|
String oflagHandleInput = UserInput.nextLine();
|
||||||
|
|
||||||
String oflagHandleString;
|
|
||||||
switch (oflagHandleInput) {
|
switch (oflagHandleInput) {
|
||||||
case "1":
|
case "1":
|
||||||
oflagHandleString = "direct";
|
oflagHandleString = "direct";
|
||||||
@@ -24,5 +26,7 @@ public class OflagHandler {
|
|||||||
oflagHandleString = "direct";
|
oflagHandleString = "direct";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
System.out.println("Using oflag: " + oflagHandleString);
|
||||||
|
return oflagHandleString;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 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 and 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)
|
||||||
|
|||||||
@@ -4,7 +4,11 @@ import java.io.InputStreamReader;
|
|||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
|
|
||||||
public class StorageDeviceLister {
|
public class StorageDeviceLister {
|
||||||
static void deviceList(Scanner UserInput) {
|
|
||||||
|
public static String device = "";
|
||||||
|
public static String fullPath = "";
|
||||||
|
|
||||||
|
protected static String deviceList(Scanner UserInput) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ProcessBuilder pb = new ProcessBuilder("lsblk");
|
ProcessBuilder pb = new ProcessBuilder("lsblk");
|
||||||
@@ -22,6 +26,8 @@ public class StorageDeviceLister {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
String device = UserInput.nextLine();
|
String device = UserInput.nextLine();
|
||||||
System.out.println("Using device: " + device);
|
System.out.println("Using device: " + "/dev/" + device);
|
||||||
|
fullPath = "/dev/" + device;
|
||||||
|
return fullPath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user