/* tuxboot.h from tuxboot Copyright (C) 2007-2008 Geza Kovacs This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License at for more details. */ #ifndef tuxboot_H #define tuxboot_H #include #include #include #include #include //#include #include "ui_tuxboot.h" #include "version.h" #ifdef Q_OS_WIN32 #define WIN32_LEAN_AND_MEAN #define _WIN32_WINNT 0x0500 #include #include #endif #ifdef Q_OS_UNIX #include #endif #ifndef tuxboot #define CLONEZILLA //#define USBINSTALL #endif #ifdef CLONEZILLA #define NODEFAULTBOOT #endif class customver : public QObject { Q_OBJECT }; class uninstaller : public QObject { Q_OBJECT }; class callexternappT : public QThread { public: QString execFile; QString execParm; QString retnValu; void run(); }; class copyfileT : public QThread { Q_OBJECT public: QString source; QString destination; void run(); signals: void datacopied64(qint64 dlbytes, qint64 maxbytes); void finished(); }; class ubngetrequestheader : public QHttpRequestHeader { public: ubngetrequestheader(QString urhost, QString urpath); }; class randtmpfile : public QFile { public: randtmpfile(QString rfpath, QString rfextn); static QString getrandfilename(QString rfpath, QString rfextn); }; class nDirListStor : public QObject { Q_OBJECT public: QStringList nDirFileListSL; int nMinFileSizeBytes; int nMaxFileSizeBytes; bool searchsymlinks; public slots: void sAppendSelfUrlInfoList(QUrlInfo curDirUrl); }; class tuxboot : public QWidget, private Ui::tuxbootui { Q_OBJECT public: tuxboot(QWidget *parent = 0); QString trcurrent; QString trdone; QString appNlang; QString appDir; QString appLoc; QString ubntmpf; QString nameDistro; QString nameVersion; QString userhomeDir; QHash md5hash; bool isarch64; bool islivecd; bool isnetinstall; bool ishdmedia; bool overwriteall; bool searchsymlinks; bool ignoreoutofspace; bool dontgeneratesyslinuxcfg; QStringList locatedsyslinuxcfgfiles; QString targetDrive; QString targetPath; QString installType; QString targetDev; QString rawtargetDev; QString devluid; QString devlabel; QString devuuid; QString postinstmsg; QString kernelLine, kernelParam, kernelLoc, kernelOpts, initrdLine, initrdLoc, initrdOpts; QString slinitrdLine; QString sevzcommand; QString md5sumcommand; QPair, QPair > extraoptionsPL; QMap grub2vars; #ifdef Q_OS_UNIX QString fdiskcommand; QString dfcommand; QString sfdiskcommand; QString bashcommand; QString blkidcommand; QString volidcommand; QString syslinuxcommand; QString extlinuxcommand; bool isext2; #endif bool ubninitialize(QList > oppairs); QString displayfisize(quint64 fisize); QPair >, QStringList> listarchiveconts(QString archivefile); bool overwritefileprompt(QString ovwfileloc); bool ignoreoutofspaceprompt(QString destindir); bool extractfile(QString filepath, QString destinfileL, QString archivefile); bool checkifoutofspace(QString destindir); QString locatekernel(QString archivefile, QPair > archivefileconts); bool extractkernel(QString archivefile, QString kernoutputfile, QPair > archivefileconts); QString locateinitrd(QString archivefile, QPair > archivefileconts); bool extractinitrd(QString archivefile, QString initoutputfile, QPair > archivefileconts); QString extractcfg(QString archivefile, QStringList archivefileconts); QPair, QPair > extractcfgL(QString archivefile, QStringList archivefileconts); QString getfullarchivepath(QString relativefilepath, QStringList archivefile); QString filteroutlist(QString listofdata, QList listofmatches); QString filteroutlist(QStringList listofdata, QList listofmatches); QStringList filteroutlistL(QStringList listofdata, QList listofmatches); void extractiso(QString isofile, QString exoutputdir); void extractiso_krd10(QString isofile, QString exoutputdir); void copyfilegui(QString src, QString dst); QStringList makepathtree(QString dirmkpathw, QStringList pathlist); QStringList extractallfiles(QString archivefile, QString dirxfilesto, QPair > filesizelist, QStringList outputfilelist); QString getgrubcfgargs(QString cfgfile); QPair, QPair > getgrubcfgargsL(QString cfgfile); QString getFirstTextBlock(QString fulltext); void loadgrub2env(QString cfgfile); QString getgrub2cfgargs(QString cfgfile, QString archivefile, QStringList archivefileconts, QStringList visitedincludes); QPair, QPair > getgrub2cfgargsL(QString cfgfile, QString archivefile, QStringList archivefileconts, QStringList visitedincludes); QString getcfgkernargs(QString cfgfile, QString archivefile, QStringList archivefileconts, QStringList visitedincludes); QPair, QPair > getcfgkernargsL(QString cfgfile, QString archivefile, QStringList archivefileconts, QStringList visitedincludes); QString searchforincludesfile(QString includesfile, QString archivefile, QStringList archivefileconts, QStringList visitedincludes); QPair, QPair > searchforincludesfileL(QString includesfile, QString archivefile, QStringList archivefileconts, QStringList visitedincludes); QString searchforgrub2includesfile(QString includesfile, QString archivefile, QStringList archivefileconts, QStringList visitedincludes); QPair, QPair > searchforgrub2includesfileL(QString includesfile, QString archivefile, QStringList archivefileconts, QStringList visitedincludes); void downloadfile(QString fileurl, QString targetfile); void checkisofile(QString md5url, QString targetisofile, QString isoname); QString downloadpagecontents(QString pageurl); QStringList lstFtpDirFiles(QString ldfDirStringUrl, int ldfMinSize, int ldfMaxSize); QStringList lstHttpDirFiles(QString ldfDirStringUrl); QStringList lstNetDirFiles(QString ldfDirStringUrl, int ldfMinSize, int ldfMaxSize); QPair weightedFilterNetDir(QString ldfDirStringUrl, int ldfMinSize, int ldfMaxSize, QList ldfFileMatchExp); QString fileFilterNetDir(QStringList ldfDirStringUrlList, int ldfMinSize, int ldfMaxSize, QList ldfFileMatchExp); QPair filterBestMatch(QStringList ufStringList, QList filterExpList); void sysreboot(); static QString callexternapp(QString xexecFile, QString xexecParm); QString getdevluid(QString voldrive); QString getlabel(QString voldrive); QString getuuid(QString voldrive); void refreshdriveslist(); QStringList listcurdrives(); QStringList listsanedrives(); QStringList listalldrives(); void replaceTextInFile(QString repfilepath, QRegExp replaceme, QString replacewith); QString fixkernelbootoptions(const QString &cfgfileCL); #ifdef Q_OS_UNIX QString locatecommand(QString commandtolocate, QString reqforinstallmode, QString packagename); QString locatedevicenode(QString mountpoint); QString locatemountpoint(QString devicenode); QString getGrubNotation(QString devicenode); QString getGrub2Notation(QString devicenode); int letterToNumber(QChar lettertoconvert); int getDiskNumber(QString devicenode); int getPartitionNumber(QString devicenode); #endif #ifdef Q_OS_WIN32 void installsvzip(); void installmd5sum(); void configsysEdit(); void bootiniEdit(); void vistabcdEdit(); #endif void instIndvfl(QString srcfName, QString dstfName); QString instTempfl(QString srcfName, QString dstfType); void runinst(); void instDetType(); #ifdef Q_OS_UNIX void writegrub2cfg(); #endif void runinsthdd(); void runinstusb(); void fininstall(); void rmFile(const QString &fn); void rmFile(QFile &fn); void mvFile(const QString &fn, const QString &outfn); void mvFile(QFile &fn, QFile &outfn); QStringList update_info(); QString update_dist_version(); QString update_dist_version(QString sub_directory); private slots: void on_distroselect_currentIndexChanged(int distroselectIndex); void on_showalldrivescheckbox_clicked(); void on_typeselect_currentIndexChanged(int typeselectIndex); void on_dverselect_currentIndexChanged(); void on_diskimagetypeselect_currentIndexChanged(); void on_FloppyFileSelector_clicked(); void on_cancelbutton_clicked(); void on_frebootbutton_clicked(); void on_fexitbutton_clicked(); public slots: void dlprogressupdate(int dlbytes, int maxbytes); void dlprogressupdate64(qint64 dlbytes, qint64 maxbytes); void cpprogressupdate64(qint64 dlbytes, qint64 maxbytes); void on_okbutton_clicked(); bool on_updatebutton_clicked(); }; #endif