forked from LazyT/rrcc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
installer.h
82 lines (60 loc) · 2.65 KB
/
installer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#ifndef INSTALLERDLG_H
#define INSTALLERDLG_H
#include "ui_installer.h"
#include "mainwindow.h"
#define VALETUDO_REL "https://api.github.com/repos/hypfer/valetudo/releases"
#define VALETUDO_CFG "https://github.com/Hypfer/Valetudo/raw/master/deployment/valetudo.conf"
#define VALETUDO_HOSTS "https://github.com/Hypfer/Valetudo/raw/master/deployment/etc/hosts"
#define VALETUDO_RCLOCAL "https://github.com/Hypfer/Valetudo/raw/master/deployment/etc/rc.local"
#define VALETUDORE_REL "https://api.github.com/repos/rand256/valetudo/releases"
#define VALETUDORE_CFG "https://github.com/rand256/Valetudo/raw/testing/deployment/valetudo.conf"
#define VALETUDORE_HOSTS "https://github.com/rand256/Valetudo/raw/testing/deployment/etc/hosts"
#define VALETUDORE_RCLOCAL "https://github.com/rand256/Valetudo/raw/testing/deployment/etc/rc.local"
#define VALETUDO_BIN_SRC QStandardPaths::writableLocation(QStandardPaths::TempLocation) + "/valetudo"
#define VALETUDO_CFG_SRC QStandardPaths::writableLocation(QStandardPaths::TempLocation) + "/valetudo.conf"
#define VALETUDO_HOSTS_SRC QStandardPaths::writableLocation(QStandardPaths::TempLocation) + "/hosts"
#define VALETUDO_RCLOCAL_SRC QStandardPaths::writableLocation(QStandardPaths::TempLocation) + "/rc.local"
#define VALETUDO_BIN_DST "/usr/local/bin/valetudo"
#define VALETUDO_CFG_DST "/etc/init/valetudo.conf"
#define VALETUDO_HOSTS_DST "/etc/hosts"
#define VALETUDO_RCLOCAL_DST "/etc/rc.local"
#define VALETUDO_CMD_CHMOD "chmod +x " VALETUDO_BIN_DST
#define VALETUDO_CMD_STOP "%1 stop"
#define VALETUDO_CMD_START "%1 start"
#define HOSTS_INIT "### VALETUDO HOSTS INIT ###"
#define HOSTS_EXIT "### VALETUDO HOSTS EXIT ###"
#define RCLOCAL_INIT "### VALETUDO RC.LOCAL INIT ###"
#define RCLOCAL_EXIT "### VALETUDO RC.LOCAL EXIT ###"
enum {HOSTS, RCLOCAL};
class installerDialog : public QDialog, private Ui::Dialog_Installer
{
Q_OBJECT
public:
installerDialog(QWidget*);
private:
bool Download(QString);
void mergeFiles(int);
void updateProgress();
QNetworkReply *reply = nullptr;
QByteArray download;
QSshSocket *ssh = nullptr;
bool finish, failed;
int step;
bool vre = false;
private slots:
void getReleases();
void downloadProgress(qint64, qint64);
void finished(QNetworkReply*);
void ssh_connected();
void ssh_disconnected();
void ssh_error(QSshSocket::SshError);
void ssh_loginSuccessful();
void ssh_pullSuccessful(QString, QString);
void ssh_pushSuccessful(QString, QString);
void ssh_commandExecuted(QString, QString);
void on_radioButton_valetudo_clicked();
void on_radioButton_valetudore_clicked();
void reject();
void on_buttonBox_clicked(QAbstractButton*);
};
#endif // INSTALLERDLG_H