From f2c351dcd00ccb5c8e1e896a96d5f224f8385164 Mon Sep 17 00:00:00 2001 From: Britney Fransen Date: Wed, 1 Oct 2014 15:12:36 +0000 Subject: mythinstall: check pacman to see if db agrees with installed programs closes #976 --- .../MythVantage-app/mythinstall/main.cpp | 92 +++++++++++++++++++++- abs/core/mythinstall/PKGBUILD | 2 +- 2 files changed, 90 insertions(+), 4 deletions(-) diff --git a/abs/core/mythinstall/MythVantage-app/mythinstall/main.cpp b/abs/core/mythinstall/MythVantage-app/mythinstall/main.cpp index fa16918..bac24ad 100755 --- a/abs/core/mythinstall/MythVantage-app/mythinstall/main.cpp +++ b/abs/core/mythinstall/MythVantage-app/mythinstall/main.cpp @@ -100,8 +100,8 @@ int main(int argc, char **argv) QString question; - int FRONTEND_EXIT_NO_MYTHCONTEXT = 1; - int FRONTEND_EXIT_INVALID_CMDLINE =1 ; +// int FRONTEND_EXIT_NO_MYTHCONTEXT = 1; +// int FRONTEND_EXIT_INVALID_CMDLINE =1 ; QApplication a(argc, argv); QCoreApplication::setApplicationName("mythinstall"); @@ -152,7 +152,7 @@ int main(int argc, char **argv) LOG(VB_GENERAL, LOG_INFO, QString("mythinstall: Screen stuff")); QString tmpArg = (cmdline.toString("screen")) ; QStringList pairs = QStringList::split(",", tmpArg); - for (unsigned int index = 0; index < pairs.size(); ++index) + for (int index = 0; index < pairs.size(); ++index) { if ( pairs[index] == "network" ) { @@ -305,6 +305,92 @@ int main(int argc, char **argv) system("cp -f /etc/systemconfig /tmp/systemconfig.bak"); QString olddb = gCoreContext->GetSetting("HostMysqlserver"); QString oldhostype = gCoreContext->GetSetting("HostSystemType"); + + //sync db with pacman + if (bShowplugins || bShowsoftware) + { + system("pacman -Q > /tmp/pacman_installed"); + QString progPacmanNamesArray[] = { "mythappletrailers", + "mytharchive", + "mythbrowser", + "mythgallery", + "mythgame", + "dolphin-emu", + "fceux", + "sdlmame", + "mednafen", + "mupen64plus-svn", + "romdb", + "snes9x", + "xe", + "mythmusic", + "mythnetvision", + "mythnews", + "libdvdcss", + "mythweather", + "mythzoneminder", + "huludesktop", + "miro", + "xbmc", + "web-on-linhes", + "foldingathome"}; + QString progDBNamesArray[] = { "Hostpluginmythappletrailers", + "Hostpluginmytharchive", + "Hostpluginmythbrowser", + "Hostpluginmythgallery", + "Hostpluginmythgame", + "HostpluginmythgameDolphin", + "Hostpluginmythgamefceux", + "HostpluginmythgameMame", + "HostpluginmythgameMednafen", + "Hostpluginmythgamemupen64", + "HostpluginmythgameROMDB", + "Hostpluginmythgamesnes9x", + "HostpluginmythgameXe", + "Hostpluginmythmusic", + "Hostpluginmythnetvision", + "Hostpluginmythnews", + "Hostpluginmythvideo_dvdcss", + "Hostpluginmythweather", + "Hostpluginmythzoneminder", + "HostHuluDesktop", + "HostMiro", + "HostXBMC", + "Hostwebonlinhes", + "Hostfoldingathome"}; + char cmd[200]; + int grepstatus; + int pacmanNamesArraySize = sizeof(progPacmanNamesArray) / sizeof(progPacmanNamesArray[0]); + + //for loop to run though progPacmanNamesArray + for(int i = 0; i < pacmanNamesArraySize; i++) + { + QByteArray PacName = progPacmanNamesArray[i].toLocal8Bit(); + const char *PacNameChar = PacName.data(); + sprintf(cmd, "grep -q '%s ' /tmp/pacman_installed", PacNameChar); + + //LOG(VB_GENERAL, LOG_INFO, QString(progPacmanNamesArray[i])); + //LOG(VB_GENERAL, LOG_INFO, QString(progDBNamesArray[i])); + QString currDBValue = gCoreContext->GetSetting(progDBNamesArray[i]); + //LOG(VB_GENERAL, LOG_INFO, QString(currDBValue)); + grepstatus = system(cmd); + if ( grepstatus != 0 && currDBValue == "1" ) + { + //LOG(VB_GENERAL, LOG_INFO, QString("pkg NOT found and db 1")); + gCoreContext->SaveSetting(progDBNamesArray[i],"0" ); + runconfig = true; + } + else if ( grepstatus == 0 && currDBValue == "0" ) + { + //LOG(VB_GENERAL, LOG_INFO, QString("pkg found and db 0")); + gCoreContext->SaveSetting(progDBNamesArray[i],"1" ); + runconfig = true; + } + } + system("rm -f /tmp/pacman_installed"); + } + //DONE sync db with pacman + runsettings(false,bShowNetwork,bShowHostype,bShowMisc,bShowshutdown,bShowadvanced,bShowsound,bShowadvancedX,bShowAccesscontrol,bShowplugins,bShowsoftware,bShowuser,bShowwebuser,bShowddns,bShowinfrared,bShowscreensaver,bShowsupplemental,bShowremotes_only,bShowvnc,bShowFileshare); QString newdb = gCoreContext->GetSetting("HostMysqlserver"); QString newhostype = gCoreContext->GetSetting("HostSystemType"); diff --git a/abs/core/mythinstall/PKGBUILD b/abs/core/mythinstall/PKGBUILD index ada24b9..b741439 100644 --- a/abs/core/mythinstall/PKGBUILD +++ b/abs/core/mythinstall/PKGBUILD @@ -1,7 +1,7 @@ # Maintainer: Jams pkgname=mythinstall pkgver=8.2 -pkgrel=1 +pkgrel=2 pkgdesc="LinHES installer/systemconfig GUI." arch=('i686' 'x86_64') depends=('mythtv>=0.27') -- cgit v0.12