installer: cleanup old cache paths

pull/22489/head
Adeeb Shihadeh 4 years ago
parent 879b50c1a3
commit db81bf52ea
  1. 18
      selfdrive/ui/installer/installer.cc

@ -23,8 +23,7 @@
#define CONTINUE_PATH "/data/continue.sh" #define CONTINUE_PATH "/data/continue.sh"
#endif #endif
// TODO: remove the other paths after a bit const QString CACHE_PATH = "/data/openpilot.cache";
const QList<QString> CACHE_PATHS = {"/data/openpilot.cache", "/system/comma/openpilot", "/usr/comma/openpilot"};
#define INSTALL_PATH "/data/openpilot" #define INSTALL_PATH "/data/openpilot"
#define TMP_INSTALL_PATH "/data/tmppilot" #define TMP_INSTALL_PATH "/data/tmppilot"
@ -104,21 +103,12 @@ void Installer::doInstall() {
qDebug() << "Waiting for valid time"; qDebug() << "Waiting for valid time";
} }
// cleanup // cleanup previous install attemps
run("rm -rf " TMP_INSTALL_PATH " " INSTALL_PATH); run("rm -rf " TMP_INSTALL_PATH " " INSTALL_PATH);
// find the cache path
QString cache;
for (const QString &path : CACHE_PATHS) {
if (QDir(path).exists()) {
cache = path;
break;
}
}
// do the install // do the install
if (!cache.isEmpty()) { if (QDir(CACHE_PATH).exists()) {
cachedFetch(cache); cachedFetch(CACHE_PATH);
} else { } else {
freshClone(); freshClone();
} }

Loading…
Cancel
Save