Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
added script findbrokendownloads.rb to print out the distros and vers…
…ions for which download links are no longer working
  • Loading branch information
gkovacs committed Oct 11, 2011
1 parent 87bb77a commit 46b5789
Show file tree
Hide file tree
Showing 55 changed files with 6,298 additions and 6,193 deletions.
168 changes: 84 additions & 84 deletions po/unetbootin.pot

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions src/unetbootin/findbrokendownloads.rb
@@ -0,0 +1,26 @@
#!/usr/bin/ruby1.9

# Supply as command line arg the path to the UNetbootin executable
# Outputs distribution:version tuples that failed to download

if `whoami`.strip != 'root'
puts 'Must be run as root'
exit()
end

unetbootin = ARGV[0]

distrolist = `#{unetbootin} action=listdistros`.split("\n")
distrolist.each {|distro|
versions = `#{unetbootin} distribution="#{distro}" action=listversions`.split("\n")
versions.each {|version|
exitstatus = `#{unetbootin} method=distribution installtype=HDD distribution="#{distro}" version="#{version}" testingdownload=y autoinstall=y`
if exitstatus.include? 'downloadfailed'
puts distro + ':' + version
end
Dir.glob('/tmp/un*').each{ |filepath|
File.delete(filepath)
}
}

}
3 changes: 2 additions & 1 deletion src/unetbootin/main.cpp
Expand Up @@ -378,9 +378,10 @@ int main(int argc, char **argv)
icon.addFile(":/unetbootin_32.png", QSize(32,32));
icon.addFile(":/unetbootin_48.png", QSize(48,48));
unetbootin.setWindowIcon(icon);
QObject::connect(&app, SIGNAL(lastWindowClosed()), &unetbootin, SLOT(killApplication()));
bool automate = unetbootin.ubninitialize(oppairs);
unetbootin.show();
if (automate)
unetbootin.on_okbutton_clicked();
QTimer::singleShot(0, &unetbootin, SLOT(on_okbutton_clicked()));
return app.exec();
}
90 changes: 82 additions & 8 deletions src/unetbootin/unetbootin.cpp
Expand Up @@ -185,6 +185,8 @@ bool unetbootin::ubninitialize(QList<QPair<QString, QString> > oppairs)
searchsymlinks = false;
ignoreoutofspace = false;
downloadFailed = false;
exitOnCompletion = false;
testingDownload = false;
persistenceSpaceMB = 0;
#ifdef Q_OS_MAC
ignoreoutofspace = true;
Expand Down Expand Up @@ -406,10 +408,50 @@ bool unetbootin::ubninitialize(QList<QPair<QString, QString> > oppairs)
if (isInt)
this->persistencevalue->setValue(numMBpersistentSpace);
}
else if (pfirst.contains("testingdownload", Qt::CaseInsensitive))
{
if (psecond.contains('y', Qt::CaseInsensitive))
{
testingDownload = true;
exitOnCompletion = true;
}
}
else if (pfirst.contains("exitoncompletion", Qt::CaseInsensitive))
{
if (psecond.contains('y', Qt::CaseInsensitive))
{
exitOnCompletion = true;
}
}
else if (pfirst.contains("autoinstall", Qt::CaseInsensitive))
{
if (psecond.contains('y', Qt::CaseInsensitive))
{
exitOnCompletion = true;
overwriteall = true;
return true;
}
}
else if (pfirst.contains("action", Qt::CaseInsensitive))
{
if (psecond.contains("listdistros", Qt::CaseInsensitive))
{
for (int i = 1; i < this->distroselect->count(); ++i)
{
printf("%s\n", this->distroselect->itemText(i).toAscii().constData());
}
QApplication::exit();
exit(0);
}
else if (psecond.contains("listversions", Qt::CaseInsensitive))
{
for (int i = 1; i < this->dverselect->count(); ++i)
{
printf("%s\n", this->dverselect->itemText(i).toAscii().constData());
}
QApplication::exit();
exit(0);
}
}
}
if (hideCustom)
Expand Down Expand Up @@ -2409,7 +2451,10 @@ QPair<QPair<QStringList, QStringList>, QPair<QStringList, QStringList> > unetboo
void unetbootin::downloadfile(QString fileurl, QString targetfile)
{
if (fileurl.isEmpty())
{
showDownloadFailedScreen(fileurl);
return;
}
if (QFile::exists(targetfile))
{
rmFile(targetfile);
Expand Down Expand Up @@ -2490,21 +2535,39 @@ void unetbootin::downloadfile(QString fileurl, QString targetfile)
if (QFile(targetfile).size() < 1024*512)
{
// download failed
progresslayer->setEnabled(false);
progresslayer->hide();
rebootlayer->setEnabled(true);
rebootlayer->show();
rebootmsgtext->setText(tr("Download of %1 %2 from %3 failed. Please try downloading the ISO file from the website directly and supply it via the diskimage option.").arg(nameDistro).arg(nameVersion).arg(fileurl));
this->frebootbutton->setEnabled(false);
this->frebootbutton->hide();
this->downloadFailed = true;
showDownloadFailedScreen(fileurl);
return;
}
pdesc4->setText("");
pdesc3->setText("");
pdesc2->setText("");
pdesc1->setText("");
tprogress->setValue(0);
if (testingDownload)
{
// Note that this only tests that the first download succeeds
printf("exitstatus:downloadcomplete\n");
QApplication::exit();
exit(0);
}
}

void unetbootin::showDownloadFailedScreen(const QString &fileurl)
{
progresslayer->setEnabled(false);
progresslayer->hide();
rebootlayer->setEnabled(true);
rebootlayer->show();
rebootmsgtext->setText(tr("Download of %1 %2 from %3 failed. Please try downloading the ISO file from the website directly and supply it via the diskimage option.").arg(nameDistro).arg(nameVersion).arg(fileurl));
this->frebootbutton->setEnabled(false);
this->frebootbutton->hide();
this->downloadFailed = true;
if (exitOnCompletion)
{
printf("exitstatus:downloadfailed\n");
QApplication::exit();
exit(0);
}
}

void unetbootin::dlprogressupdate(int dlbytes, int maxbytes)
Expand Down Expand Up @@ -3944,6 +4007,11 @@ void unetbootin::runinstusb()
fininstall();
}

void unetbootin::killApplication()
{
exit(0);
}

void unetbootin::fininstall()
{
#ifdef Q_OS_UNIX
Expand Down Expand Up @@ -4004,4 +4072,10 @@ void unetbootin::fininstall()
this->frebootbutton->hide();
#endif
}
if (exitOnCompletion)
{
printf("exitstatus:success\n");
QApplication::exit();
exit(0);
}
}
4 changes: 4 additions & 0 deletions src/unetbootin/unetbootin.h
Expand Up @@ -202,6 +202,8 @@ class unetbootin : public QWidget, private Ui::unetbootinui
bool ignoreoutofspace;
bool dontgeneratesyslinuxcfg;
bool downloadFailed;
bool exitOnCompletion;
bool testingDownload;
int persistenceSpaceMB;
QString extraBootOptions;
QStringList locatedsyslinuxcfgfiles;
Expand Down Expand Up @@ -323,6 +325,7 @@ class unetbootin : public QWidget, private Ui::unetbootinui
void rmFile(QFile &fn);
void mvFile(const QString &fn, const QString &outfn);
void mvFile(QFile &fn, QFile &outfn);
void showDownloadFailedScreen(const QString &fileurl);

private slots:
void on_distroselect_currentIndexChanged(int distroselectIndex);
Expand All @@ -342,6 +345,7 @@ public slots:
void dlprogressupdate64(qint64 dlbytes, qint64 maxbytes);
void cpprogressupdate64(qint64 dlbytes, qint64 maxbytes);
void on_okbutton_clicked();
void killApplication();
};

#endif
Expand Down

0 comments on commit 46b5789

Please sign in to comment.