Qt setup improvements (#2591)
This commit is contained in:
parent
9a4d4adf4a
commit
770ec8ad20
|
@ -7,9 +7,10 @@
|
||||||
#define BRANCH "master"
|
#define BRANCH "master"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define GIT_CLONE_COMMAND "git clone https://github.com/commaai/openpilot.git"
|
#define GIT_URL "https://github.com/commaai/openpilot.git"
|
||||||
|
#define GIT_SSH_URL "git@github.com:commaai/openpilot.git"
|
||||||
|
|
||||||
#define CONTINUE_PATH "/home/comma/continue.sh"
|
#define CONTINUE_PATH "/data/continue.sh"
|
||||||
|
|
||||||
bool time_valid() {
|
bool time_valid() {
|
||||||
time_t rawtime;
|
time_t rawtime;
|
||||||
|
@ -29,10 +30,12 @@ int fresh_clone() {
|
||||||
if(err) return 1;
|
if(err) return 1;
|
||||||
|
|
||||||
// Clone
|
// Clone
|
||||||
err = std::system(GIT_CLONE_COMMAND " -b " BRANCH " --depth=1 /tmp/openpilot");
|
err = std::system("git clone " GIT_URL " -b " BRANCH " --depth=1 /tmp/openpilot");
|
||||||
if(err) return 1;
|
if(err) return 1;
|
||||||
err = std::system("cd /tmp/openpilot && git submodule update --init");
|
err = std::system("cd /tmp/openpilot && git submodule update --init");
|
||||||
if(err) return 1;
|
if(err) return 1;
|
||||||
|
err = std::system("cd /tmp/openpilot && git remote set-url origin --push " GIT_SSH_URL);
|
||||||
|
if(err) return 1;
|
||||||
|
|
||||||
err = std::system("mv /tmp/openpilot /data");
|
err = std::system("mv /tmp/openpilot /data");
|
||||||
if(err) return 1;
|
if(err) return 1;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
@ -17,14 +18,14 @@
|
||||||
#include <wayland-client-protocol.h>
|
#include <wayland-client-protocol.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
int download(std::string url) {
|
int download(std::string url) {
|
||||||
CURL *curl;
|
CURL *curl;
|
||||||
curl = curl_easy_init();
|
curl = curl_easy_init();
|
||||||
if (!curl) return -1;
|
if (!curl) return -1;
|
||||||
|
|
||||||
FILE *fp;
|
char tmpfile[] = "/tmp/installer_XXXXXX";
|
||||||
fp = fopen("/tmp/installer", "wb");
|
FILE *fp = fdopen(mkstemp(tmpfile), "w");
|
||||||
|
|
||||||
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
|
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
|
||||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, NULL);
|
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, NULL);
|
||||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
|
curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
|
||||||
|
@ -32,6 +33,8 @@ int download(std::string url) {
|
||||||
curl_easy_perform(curl);
|
curl_easy_perform(curl);
|
||||||
curl_easy_cleanup(curl);
|
curl_easy_cleanup(curl);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
|
rename(tmpfile, "/tmp/installer");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue