--- kdebase-3.1.94/kdm/kfrontend/liloinfo.cpp-- 2003-12-08 07:20:25.000000000 -0500 +++ kdebase-3.1.94/kdm/kfrontend/liloinfo.cpp 2003-12-08 07:23:57.000000000 -0500 @@ -40,59 +40,96 @@ LiloInfo::LiloInfo ( const QString &lilo error = -2; else { + QString rebooting("/usr/sbin/rebootin"); + if( liloloc == rebooting && QFileInfo ( rebooting ).exists() ) + { + LiloProcess liloproc( true ); + initProcessRebootin ( liloproc ); + } + else + { LiloProcess liloproc( liloloc, bootmaploc ); liloproc << "-q" << "-v"; + initProcessLilo ( liloproc ); + } + } + +} - if ( !liloproc.exec() ) - { - error = -3; - return; - } - - liloErrorString = liloproc.error(); - if (!liloErrorString.isEmpty()) - { - error = -4; - return; - } - - QStringList lst = liloproc.getStdout(); - QStringList::Iterator it = lst.begin(); - - for (;; ++it) - { - if (it == lst.end() ) - { - error = -5; - return; - } - if (*it == "Images:") - break; - if ((*it).startsWith( " Default boot command line:" )) - nextOption = (*it).mid( 30, (*it).length() - 31 ); - } - - while (++it != lst.end()) - { - if ((*it)[0] == ' ' && (*it)[1] == ' ' && (*it)[2] != ' ') - options.append( *it ); - } - - options.sort(); - int i = 0; - for ( it = options.begin(); it != options.end(); ++it, ++i ) - { - if ( (*it)[ (*it).length() - 1 ] == '*' ) - { - indexDefault = i; - (*it).truncate( (*it).length() - 1 ); - } - *it = (*it).stripWhiteSpace(); - } - error = 0; +void LiloInfo::initProcessLilo ( LiloProcess & _liloProc ) +{ + if ( !_liloProc.exec() ) + { + error = -3; + return; + } + + liloErrorString = _liloProc.error(); + if (!liloErrorString.isEmpty()) + { + error = -4; + return; + } + + QStringList lst = _liloProc.getStdout(); + //KMessageBox::sorry(0L, QString("list : %1").arg(lst.join(";"))); + QStringList::Iterator it = lst.begin(); + + for (;; ++it) + { + if (it == lst.end() ) + { + error = -5; + return; } + if (*it == "Images:") + break; + if ((*it).startsWith( " Default boot command line:" )) + nextOption = (*it).mid( 30, (*it).length() - 31 ); + } + + while (++it != lst.end()) + { + if ((*it)[0] == ' ' && (*it)[1] == ' ' && (*it)[2] != ' ') + options.append( *it ); + } + + options.sort(); + int i = 0; + for ( it = options.begin(); it != options.end(); ++it, ++i ) + { + if ( (*it)[ (*it).length() - 1 ] == '*' ) + { + indexDefault = i; + (*it).truncate( (*it).length() - 1 ); + } + *it = (*it).stripWhiteSpace(); + } + error = 0; } +void LiloInfo::initProcessRebootin ( LiloProcess & _liloProc ) +{ + if ( !_liloProc.exec() ) + { + error = -3; + return; + } + + liloErrorString = _liloProc.error(); + if (!liloErrorString.isEmpty()) + { + error = -4; + return; + } + + options = _liloProc.getStdout(); + options.sort(); + indexDefault = 0; + error = 0; +} + + int LiloInfo::getBootOptions( QStringList &bootOptions, int &defaultOptionIndex ) { bootOptions = options; @@ -111,17 +148,47 @@ int LiloInfo::setNextBootOption ( const if ( error ) return error; - LiloProcess liloproc( liloloc, bootmaploc ); - liloproc << "-R" << nextBootOption; + QString rebooting("/usr/sbin/rebootin"); + LiloProcess liloproc; + if( liloloc == rebooting && QFileInfo ( rebooting ).exists() ) + { + LiloProcess liloproc( false ); + liloproc << nextBootOption; + if ( !liloproc.exec() ) + return -3; + + liloErrorString = liloproc.error(); + if (!liloErrorString.isEmpty()) + return -4; + } + else + { + LiloProcess liloproc( liloloc, bootmaploc ); + liloproc << "-R" << nextBootOption; + + if ( !liloproc.exec() ) + return -3; + + liloErrorString = liloproc.error(); + if (!liloErrorString.isEmpty()) + return -4; + } + return 0; - if ( !liloproc.exec() ) - return -3; +} - liloErrorString = liloproc.error(); - if (!liloErrorString.isEmpty()) - return -4; +LiloProcess::LiloProcess (bool _listKernel) +: KProcess() +{ + if( _listKernel ) + *this << QString("/usr/sbin/rebootin") << "-l"; + else + *this << QString("/usr/sbin/rebootin") << "-n"; - return 0; + connect ( this, SIGNAL(receivedStdout(KProcess *, char *, int)), + SLOT(processStdout(KProcess *, char *, int)) ); + connect ( this, SIGNAL(receivedStderr(KProcess *, char *, int)), + SLOT(processStderr(KProcess *, char *, int)) ); } --- kdebase-3.1.94/kdm/kfrontend/liloinfo.h.use_rebootin_into_kdm 2003-12-07 14:48:02.000000000 -0500 +++ kdebase-3.1.94/kdm/kfrontend/liloinfo.h 2003-12-08 09:20:00.000000000 -0500 @@ -46,6 +46,7 @@ * -5 = Error parsing Lilo output */ +class LiloProcess; class LiloInfo { public: @@ -56,6 +57,8 @@ class LiloInfo int getNextBootOption ( QString &nextBootOption ); int setNextBootOption ( const QString &nextBootOption ); // QString getErrorDescription() { return liloErrorString; } + void initProcessRebootin ( LiloProcess & _liloProc ); + void initProcessLilo ( LiloProcess & _liloProc ); private: QString liloloc, bootmaploc; @@ -74,6 +77,8 @@ class LiloProcess : public KProcess public: LiloProcess ( const QString &lilolocation, const QString &bootmaplocation ); + LiloProcess (bool _listKernel = false);// specific rebootin lilo process + bool exec(); QStringList getStdout(); QString error();