mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2025-01-27 02:41:10 +00:00
update install udev rules dialog
This commit is contained in:
parent
13bd05853c
commit
2b145cb9cc
2 changed files with 19 additions and 23 deletions
|
@ -572,21 +572,27 @@ public class AppController implements Initializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void installUdevRules(ActionEvent event) {
|
public void installUdevRules(ActionEvent event) {
|
||||||
Hwi.EnumerateService enumerateService = new Hwi.EnumerateService(null);
|
String commands = """
|
||||||
enumerateService.setOnSucceeded(workerStateEvent -> {
|
sudo install -m 644 /opt/sparrow/lib/runtime/conf/udev/*.rules /etc/udev/rules.d
|
||||||
Platform.runLater(this::showInstallUdevMessage);
|
sudo udevadm control --reload
|
||||||
});
|
sudo udevadm trigger
|
||||||
enumerateService.setOnFailed(workerStateEvent -> {
|
sudo groupadd -f plugdev
|
||||||
Platform.runLater(this::showInstallUdevMessage);
|
sudo usermod -aG plugdev `whoami`
|
||||||
});
|
""";
|
||||||
enumerateService.start();
|
String home = System.getProperty(JPACKAGE_APP_PATH);
|
||||||
}
|
if(home != null && !home.startsWith("/opt/sparrow") && home.endsWith("bin/Sparrow")) {
|
||||||
|
home = home.replace("bin/Sparrow", "");
|
||||||
|
commands = commands.replace("/opt/sparrow/", home);
|
||||||
|
}
|
||||||
|
|
||||||
public void showInstallUdevMessage() {
|
TextAreaDialog dialog = new TextAreaDialog(commands, false);
|
||||||
TextAreaDialog dialog = new TextAreaDialog("sudo " + Config.get().getHwi().getAbsolutePath() + " installudevrules", false);
|
|
||||||
dialog.initOwner(rootStack.getScene().getWindow());
|
dialog.initOwner(rootStack.getScene().getWindow());
|
||||||
dialog.setTitle("Install Udev Rules");
|
dialog.setTitle("Install udev Rules");
|
||||||
dialog.getDialogPane().setHeaderText("Installing udev rules ensures devices can connect over USB.\nThis command requires root privileges.\nOpen a shell and enter the following:");
|
dialog.getDialogPane().setHeaderText("""
|
||||||
|
Installing udev rules ensures devices can connect over USB.
|
||||||
|
These commands require root privileges.
|
||||||
|
Open a shell and enter the following.
|
||||||
|
""");
|
||||||
dialog.showAndWait();
|
dialog.showAndWait();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,6 @@ public class Config {
|
||||||
private List<File> recentWalletFiles;
|
private List<File> recentWalletFiles;
|
||||||
private Integer keyDerivationPeriod;
|
private Integer keyDerivationPeriod;
|
||||||
private long dustAttackThreshold = DUST_ATTACK_THRESHOLD_SATS;
|
private long dustAttackThreshold = DUST_ATTACK_THRESHOLD_SATS;
|
||||||
private File hwi;
|
|
||||||
private int enumerateHwPeriod = ENUMERATE_HW_PERIOD_SECS;
|
private int enumerateHwPeriod = ENUMERATE_HW_PERIOD_SECS;
|
||||||
private QRDensity qrDensity;
|
private QRDensity qrDensity;
|
||||||
private Boolean hdCapture;
|
private Boolean hdCapture;
|
||||||
|
@ -371,15 +370,6 @@ public class Config {
|
||||||
return dustAttackThreshold;
|
return dustAttackThreshold;
|
||||||
}
|
}
|
||||||
|
|
||||||
public File getHwi() {
|
|
||||||
return hwi;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHwi(File hwi) {
|
|
||||||
this.hwi = hwi;
|
|
||||||
flush();
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getEnumerateHwPeriod() {
|
public int getEnumerateHwPeriod() {
|
||||||
return enumerateHwPeriod;
|
return enumerateHwPeriod;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue