Qt setup improvements (#2591)
parent
9a4d4adf4a
commit
770ec8ad20
|
@ -7,9 +7,10 @@
|
|||
#define BRANCH "master"
|
||||
#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() {
|
||||
time_t rawtime;
|
||||
|
@ -29,10 +30,12 @@ int fresh_clone() {
|
|||
if(err) return 1;
|
||||
|
||||
// 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;
|
||||
err = std::system("cd /tmp/openpilot && git submodule update --init");
|
||||
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");
|
||||
if(err) return 1;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <curl/curl.h>
|
||||
|
||||
#include <QString>
|
||||
|
@ -17,14 +18,14 @@
|
|||
#include <wayland-client-protocol.h>
|
||||
#endif
|
||||
|
||||
|
||||
int download(std::string url) {
|
||||
CURL *curl;
|
||||
curl = curl_easy_init();
|
||||
if (!curl) return -1;
|
||||
|
||||
FILE *fp;
|
||||
fp = fopen("/tmp/installer", "wb");
|
||||
char tmpfile[] = "/tmp/installer_XXXXXX";
|
||||
FILE *fp = fdopen(mkstemp(tmpfile), "w");
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, NULL);
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
|
||||
|
@ -32,6 +33,8 @@ int download(std::string url) {
|
|||
curl_easy_perform(curl);
|
||||
curl_easy_cleanup(curl);
|
||||
fclose(fp);
|
||||
|
||||
rename(tmpfile, "/tmp/installer");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue