diff options
Diffstat (limited to 'rbutil/rbutilqt/base/bootloaderinstallbase.cpp')
-rw-r--r-- | rbutil/rbutilqt/base/bootloaderinstallbase.cpp | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/rbutil/rbutilqt/base/bootloaderinstallbase.cpp b/rbutil/rbutilqt/base/bootloaderinstallbase.cpp index a4cf22af29..8672e29a4f 100644 --- a/rbutil/rbutilqt/base/bootloaderinstallbase.cpp +++ b/rbutil/rbutilqt/base/bootloaderinstallbase.cpp | |||
@@ -23,6 +23,12 @@ | |||
23 | #include "bootloaderinstallbase.h" | 23 | #include "bootloaderinstallbase.h" |
24 | #include "utils.h" | 24 | #include "utils.h" |
25 | 25 | ||
26 | #if defined(Q_OS_MACX) | ||
27 | #include <sys/param.h> | ||
28 | #include <sys/ucred.h> | ||
29 | #include <sys/mount.h> | ||
30 | #endif | ||
31 | |||
26 | BootloaderInstallBase::BootloaderType BootloaderInstallBase::installed(void) | 32 | BootloaderInstallBase::BootloaderType BootloaderInstallBase::installed(void) |
27 | { | 33 | { |
28 | return BootloaderUnknown; | 34 | return BootloaderUnknown; |
@@ -189,6 +195,52 @@ QString BootloaderInstallBase::postinstallHints(QString model) | |||
189 | } | 195 | } |
190 | 196 | ||
191 | 197 | ||
198 | #if defined(Q_OS_MACX) | ||
199 | void BootloaderInstallBase::waitRemount() | ||
200 | { | ||
201 | m_remountTries = 600; | ||
202 | emit logItem(tr("Waiting for system to remount player"), LOGINFO); | ||
203 | |||
204 | QTimer::singleShot(100, this, SLOT(checkRemount())); | ||
205 | } | ||
206 | #endif | ||
207 | |||
208 | |||
209 | void BootloaderInstallBase::checkRemount() | ||
210 | { | ||
211 | #if defined(Q_OS_MACX) | ||
212 | if(m_remountTries--) { | ||
213 | int status = 0; | ||
214 | // check if device has been remounted | ||
215 | QCoreApplication::processEvents(); | ||
216 | int num; | ||
217 | struct statfs *mntinf; | ||
218 | |||
219 | num = getmntinfo(&mntinf, MNT_WAIT); | ||
220 | while(num--) { | ||
221 | if(QString(mntinf->f_mntfromname).startsWith(m_remountDevice) | ||
222 | && QString(mntinf->f_fstypename).contains("msdos", Qt::CaseInsensitive)) | ||
223 | status = 1; | ||
224 | mntinf++; | ||
225 | } | ||
226 | if(!status) { | ||
227 | // still not remounted, restart timer. | ||
228 | QTimer::singleShot(500, this, SLOT(checkRemount())); | ||
229 | qDebug() << "player not remounted yet" << m_remountDevice; | ||
230 | } | ||
231 | else { | ||
232 | emit logItem(tr("Player remounted"), LOGINFO); | ||
233 | emit remounted(true); | ||
234 | } | ||
235 | } | ||
236 | else { | ||
237 | emit logItem(tr("Timeout on remount"), LOGERROR); | ||
238 | emit remounted(false); | ||
239 | } | ||
240 | #endif | ||
241 | } | ||
242 | |||
243 | |||
192 | //! @brief set list of possible bootloader files and pick the existing one. | 244 | //! @brief set list of possible bootloader files and pick the existing one. |
193 | //! @param sl list of possible bootloader files. | 245 | //! @param sl list of possible bootloader files. |
194 | void BootloaderInstallBase::setBlFile(QStringList sl) | 246 | void BootloaderInstallBase::setBlFile(QStringList sl) |