diff --git a/kylin-background-upgrade.pro.user b/kylin-background-upgrade.pro.user deleted file mode 100644 index 475afd8..0000000 --- a/kylin-background-upgrade.pro.user +++ /dev/null @@ -1,318 +0,0 @@ - - - - - - EnvironmentId - {d65ece66-fdbd-4e6d-96fa-dd17567c5b6f} - - - ProjectExplorer.Project.ActiveTarget - 0 - - - ProjectExplorer.Project.EditorSettings - - true - false - true - - Cpp - - CppGlobal - - - - QmlJS - - QmlJSGlobal - - - 2 - UTF-8 - false - 4 - false - 80 - true - true - 1 - true - false - 0 - true - true - 0 - 8 - true - 1 - true - true - true - false - - - - ProjectExplorer.Project.PluginSettings - - - true - - - - ProjectExplorer.Project.Target.0 - - 桌面 - 桌面 - {93f11d50-6f62-41c4-8ce9-7bf187ad830b} - 0 - 0 - 0 - - /home/lxy/project/kylin-background-upgrade/1.3.2.0/build-kylin-background-upgrade-unknown-Debug - - - true - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - - - /home/lxy/project/kylin-background-upgrade/1.3.2.0/build-kylin-background-upgrade-unknown-Release - - - true - QtProjectManager.QMakeBuildStep - false - - false - false - false - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - - /home/lxy/project/kylin-background-upgrade/1.3.2.0/build-kylin-background-upgrade-unknown-Profile - - - true - QtProjectManager.QMakeBuildStep - true - - false - true - false - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - 3 - - - 0 - Deploy - Deploy - ProjectExplorer.BuildSteps.Deploy - - 1 - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - kylin-background-upgrade2 - Qt4ProjectManager.Qt4RunConfiguration:/home/lxy/project/kylin-background-upgrade/yhkylin-v101/kylin-background-upgrade/kylin-background-upgrade.pro - /home/lxy/project/kylin-background-upgrade/yhkylin-v101/kylin-background-upgrade/kylin-background-upgrade.pro - --check-upgrade - false - - false - true - true - false - false - true - - /home/lxy/project/kylin-background-upgrade/1.3.2.0/build-kylin-background-upgrade-unknown-Debug - - 1 - - - - ProjectExplorer.Project.TargetCount - 1 - - - ProjectExplorer.Project.Updater.FileVersion - 22 - - - Version - 22 - - diff --git a/kylin-background-upgrade.pro.user.3d34bcf b/kylin-background-upgrade.pro.user.3d34bcf deleted file mode 100644 index f026e3e..0000000 --- a/kylin-background-upgrade.pro.user.3d34bcf +++ /dev/null @@ -1,314 +0,0 @@ - - - - - - EnvironmentId - {3d34bcf0-6a81-46d0-90d9-4cc7667111f8} - - - ProjectExplorer.Project.ActiveTarget - 0 - - - ProjectExplorer.Project.EditorSettings - - true - false - true - - Cpp - - CppGlobal - - - - QmlJS - - QmlJSGlobal - - - 2 - UTF-8 - false - 4 - false - 80 - true - true - 1 - true - false - 0 - true - true - 0 - 8 - true - 1 - true - true - true - false - - - - ProjectExplorer.Project.PluginSettings - - - - ProjectExplorer.Project.Target.0 - - 桌面 - 桌面 - {fb955230-392d-4c01-8fb0-8bfc9c0d7279} - 0 - 0 - 0 - - /home/lxy/kylin-background-upgrade/sp3/build-kylin-background-upgrade-unknown-Debug - - - true - QtProjectManager.QMakeBuildStep - true - - false - false - false - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - - - /home/lxy/kylin-background-upgrade/sp3/build-kylin-background-upgrade-unknown-Release - - - true - QtProjectManager.QMakeBuildStep - false - - false - false - false - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - - /home/lxy/kylin-background-upgrade/sp3/build-kylin-background-upgrade-unknown-Profile - - - true - QtProjectManager.QMakeBuildStep - true - - false - true - false - - - true - Qt4ProjectManager.MakeStep - - false - - - false - - 2 - Build - Build - ProjectExplorer.BuildSteps.Build - - - - true - Qt4ProjectManager.MakeStep - - true - clean - - false - - 1 - Clean - Clean - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Profile - Qt4ProjectManager.Qt4BuildConfiguration - 0 - - 3 - - - 0 - Deploy - Deploy - ProjectExplorer.BuildSteps.Deploy - - 1 - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - dwarf - - cpu-cycles - - - 250 - - -e - cpu-cycles - --call-graph - dwarf,4096 - -F - 250 - - -F - true - 4096 - false - false - 1000 - - true - - false - false - false - false - true - 0.01 - 10 - true - kcachegrind - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - Qt4ProjectManager.Qt4RunConfiguration:/home/lxy/project/kylin-background-upgrade/openKylin/kylin-background-upgrade/kylin-background-upgrade.pro - /home/lxy/project/kylin-background-upgrade/openKylin/kylin-background-upgrade/kylin-background-upgrade.pro - --check-upgrade - false - - false - true - true - false - false - true - - /home/lxy/kylin-background-upgrade/sp3/build-kylin-background-upgrade-unknown-Debug - - 1 - - - - ProjectExplorer.Project.TargetCount - 1 - - - ProjectExplorer.Project.Updater.FileVersion - 22 - - - Version - 22 - - diff --git a/src/main.cpp b/src/main.cpp index 631f621..e3c717b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -140,6 +140,19 @@ void log_env_init(QString arg){ } } +bool _is_openkylin() +{ + QString OPENKYLIN_DISTTRIBUTOR = "Openkylin"; + QString command = "lsb_release -i -s"; + QProcess process; + process.start(command); + process.waitForFinished(); + + QString result = process.readAllStandardOutput(); + int ret = result.left(OPENKYLIN_DISTTRIBUTOR.length()).compare(OPENKYLIN_DISTTRIBUTOR.left(OPENKYLIN_DISTTRIBUTOR.length())); + return (0 == ret)?true:false; +} + int main(int argc, char *argv[]) { QString arg=QString::fromLatin1(argv[1]); @@ -173,6 +186,10 @@ int main(int argc, char *argv[]) qDebug()<<"Another process is silently upgrading, exit!"; exit(0); } + if (_is_openkylin()) { + qDebug()<<"openkylin, exit!"; + exit(0); + } } #if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)) diff --git a/src/updatewidget.cpp b/src/updatewidget.cpp index a075e62..318a314 100644 --- a/src/updatewidget.cpp +++ b/src/updatewidget.cpp @@ -464,6 +464,19 @@ char *updatewidget::insideTime() } +bool updatewidget::_is_openkylin() +{ + QString OPENKYLIN_DISTTRIBUTOR = "Openkylin"; + QString command = "lsb_release -i -s"; + QProcess process; + process.start(command); + process.waitForFinished(); + + QString result = process.readAllStandardOutput(); + int ret = result.left(OPENKYLIN_DISTTRIBUTOR.length()).compare(OPENKYLIN_DISTTRIBUTOR.left(OPENKYLIN_DISTTRIBUTOR.length())); + return (0 == ret)?true:false; +} + /** * @brief updatewidget::agreeBtnClicked * 同意更新按钮槽函数 @@ -486,7 +499,7 @@ void updatewidget::agreeBtnClicked() } file.close(); QProcess p(0); - if (_is_2107) { + if (_is_2107&&!_is_openkylin()) { p.startDetached("ukui-control-center --upgrade"); qDebug()<<"exec --upgrade"; } else { diff --git a/src/updatewidget.h b/src/updatewidget.h index 27ee6f8..f6b7ab6 100644 --- a/src/updatewidget.h +++ b/src/updatewidget.h @@ -85,6 +85,7 @@ public: void listenPanelChange(); void initPanelDbusGsetting(); // 初始化与任务栏gsetting和dbus bool eventFilter(QObject *, QEvent *); // 添加事件过滤器声明 + bool _is_openkylin(); private: Ui::Form *ui;