diff options
author | Britney Fransen <brfransen@gmail.com> | 2017-01-26 15:18:59 (GMT) |
---|---|---|
committer | Britney Fransen <brfransen@gmail.com> | 2017-01-26 15:18:59 (GMT) |
commit | 61403468c91adfdb5287b56d864b34ae1725b97c (patch) | |
tree | 5b435d97151be4415d520dd63cfd337446706f1d /abs/core/mythinstall | |
parent | 3bf15b6a08a8ff7466ca03da6b1888774c384e00 (diff) | |
download | linhes_pkgbuild-61403468c91adfdb5287b56d864b34ae1725b97c.zip linhes_pkgbuild-61403468c91adfdb5287b56d864b34ae1725b97c.tar.gz linhes_pkgbuild-61403468c91adfdb5287b56d864b34ae1725b97c.tar.bz2 |
mythinstall: add check to see if partition sizes are too large for selected disk
Diffstat (limited to 'abs/core/mythinstall')
3 files changed, 99 insertions, 16 deletions
diff --git a/abs/core/mythinstall/MythVantage-app/mythinstall/installationtype.cpp b/abs/core/mythinstall/MythVantage-app/mythinstall/installationtype.cpp index 96866dc..cb2e918 100755 --- a/abs/core/mythinstall/MythVantage-app/mythinstall/installationtype.cpp +++ b/abs/core/mythinstall/MythVantage-app/mythinstall/installationtype.cpp @@ -1,23 +1,106 @@ +//#include <QObject> #include <mythcontext.h> #include <unistd.h> -#include "installationtype.h" #include <QTextStream> - #include <qdir.h> + #include "mv_common.h" +#include "mythprogressdialog.h" +#include "installationtype.h" +#include "mythsystemlegacy.h" int mythinstalltype (QString tmp_install_drive) { - - Mythinstalltype setting; - //FINDME this is needed to populate the default values and have the triggered config work - setting.Load(); - setting.Save(); - - int retc = 1 ; - if ( setting.exec() == QDialog::Accepted ) + QString line; + QString disksize; + QString rootsize; + QString homesize; + QString sqlsize; + QString useswap; + QString swapsize; + QString datasize; + QString usealldata; + int neededsize; + int disksizeMB; + + int retc = 1; + while ( retc != 0 ) { - retc = 0; + Mythinstalltype setting; + //FINDME this is needed to populate the default values and have the triggered config work + setting.Load(); + setting.Save(); + + if ( setting.exec() == QDialog::Accepted ) + { + //get users sizes + rootsize = gCoreContext->GetSetting("HOSTOSsize"); + homesize = gCoreContext->GetSetting("HOSTHOMEsize"); + sqlsize = gCoreContext->GetSetting("HOSTDatabasesize"); + useswap = gCoreContext->GetSetting("HostUseSWAP"); + swapsize = gCoreContext->GetSetting("HOSTSWAPsize"); + usealldata = gCoreContext->GetSetting("HostUseALLdata"); + datasize = gCoreContext->GetSetting("HOSTDATAsize"); + //check if using swap + if ( useswap == "0" ) + swapsize = "0"; + //calculate size of all partitions; + neededsize = rootsize.toInt() * 1024 + homesize.toInt() *1024 + + sqlsize.toInt() * 1024 + swapsize.toInt(); + //add 300 MB to neededsize if usealldata is enabled + if ( usealldata == "1" ) + neededsize = neededsize + 300; + else + neededsize = neededsize + datasize.toInt() * 1024; + //get selected drive size + //using myth_system as QFile wouldn't read /proc/partitions directly + myth_system("cat /proc/partitions > /tmp/proc.partitions"); + QFile file("/tmp/proc.partitions"); + if (file.open(QIODevice::ReadOnly | QIODevice::Text)) + { + QTextStream t( &file ); + while (!t.atEnd()) + { + line = t.readLine(); + line = line.simplified(); + if ( line.endsWith(tmp_install_drive) ) + { + disksize = line.section( " ", 2, 2 ); + //QTextStream(stdout) << "disksize:" + disksize << endl; + break; + } + } + } + file.close(); + //convert to MB and match calulation in installdialog.cpp + disksizeMB = qRound(disksize.toFloat() * 1024 / 1000000); + + if (neededsize > disksizeMB) + { + DialogCode val = MythPopupBox::Show2ButtonPopup( + GetMythMainWindow(), + "Error", "The total partition sizes (" + QString::number(neededsize) + " MB) are too large for the selected drive (" + QString::number(disksizeMB) + " MB). Continuing may result in a failed install.", + QObject::tr("Continue"), + QObject::tr("Try Again"), + kDialogCodeButton1); + if ( val == kDialogCodeButton0 ) + { + retc = 0; + } + else + { + retc = 1; + } + } + else + { + retc = 0; + } + } + else + { + retc = 0; + } } return retc; @@ -94,7 +177,7 @@ static HostSpinBox *HOSTSWAPsize() { QTextStream t( &file ); // use a text stream line = t.readLine(); - if ( line.startsWith("MemTotal:")) + if ( line.startsWith("MemTotal:") ) { currentitem = line.simplified(); currentitem = currentitem.section( " ", 1, 1 ); @@ -104,7 +187,7 @@ static HostSpinBox *HOSTSWAPsize() bool ok; int mem = currentitem.toInt( &ok, 10 ); // dec == 0, ok == FALSE //QTextStream(stdout) << mem << endl; - mem = mem/1024 ; + mem = mem / 1024 + 16; //QTextStream(stdout) << mem << endl; if ( ! ok ) diff --git a/abs/core/mythinstall/MythVantage-app/mythinstall/installdialog.cpp b/abs/core/mythinstall/MythVantage-app/mythinstall/installdialog.cpp index 1724da7..6b338f4 100755 --- a/abs/core/mythinstall/MythVantage-app/mythinstall/installdialog.cpp +++ b/abs/core/mythinstall/MythVantage-app/mythinstall/installdialog.cpp @@ -1075,7 +1075,7 @@ int WelcomeDialog::ask_validate_network(void) GetMythMainWindow(), "", pop_text, tr("Continue"), - tr("Try again"), + tr("Try Again"), kDialogCodeButton0); if (kDialogCodeButton0 == val ) retval = 0; diff --git a/abs/core/mythinstall/PKGBUILD b/abs/core/mythinstall/PKGBUILD index 4c5b223..9235032 100644 --- a/abs/core/mythinstall/PKGBUILD +++ b/abs/core/mythinstall/PKGBUILD @@ -1,7 +1,7 @@ # Maintainer: Jams pkgname=mythinstall -pkgver=8.4 -pkgrel=5 +pkgver=8.4.3 +pkgrel=1 pkgdesc="LinHES installer/systemconfig GUI." arch=('i686' 'x86_64') depends=('mythtv>=0.28') |