OsproberEntry.cpp be gone!

This commit is contained in:
Teo Mrnjavac 2016-07-13 17:30:06 +02:00
parent edecccfa46
commit 1443b335d3
3 changed files with 1 additions and 93 deletions

View File

@ -25,7 +25,6 @@ calamares_add_plugin( partition
core/ColorUtils.cpp
core/DeviceModel.cpp
core/KPMHelpers.cpp
core/OsproberEntry.cpp
core/PartitionActions.cpp
core/PartitionCoreModule.cpp
core/PartitionInfo.cpp

View File

@ -1,90 +0,0 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2016, Teo Mrnjavac <teo@kde.org>
*
* Calamares 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 3 of the License, or
* (at your option) any later version.
*
* Calamares 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 for more details.
*
* You should have received a copy of the GNU General Public License
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
*/
#include "OsproberEntry.h"
#include <QProcess>
QString
OsproberEntry::homePartitionPath()
{
if ( fstab.isEmpty() )
return QString();
foreach ( const FstabEntry& entry, fstab )
{
if ( entry.mountPoint == "/home" )
{
QProcess readlink;
QString partPath;
if ( entry.partitionNode.startsWith( "/dev" ) ) // plain dev node
{
partPath = entry.partitionNode;
}
else if ( entry.partitionNode.startsWith( "LABEL=" ) )
{
partPath = entry.partitionNode.mid( 6 );
partPath.remove( "\"" );
partPath.replace( "\\040", "\\ " );
partPath.prepend( "/dev/disk/by-label/" );
}
else if ( entry.partitionNode.startsWith( "UUID=" ) )
{
partPath = entry.partitionNode.mid( 5 );
partPath.remove( "\"" );
partPath = partPath.toLower();
partPath.prepend( "/dev/disk/by-uuid/" );
}
else if ( entry.partitionNode.startsWith( "PARTLABEL=" ) )
{
partPath = entry.partitionNode.mid( 10 );
partPath.remove( "\"" );
partPath.replace( "\\040", "\\ " );
partPath.prepend( "/dev/disk/by-partlabel/" );
}
else if ( entry.partitionNode.startsWith( "PARTUUID=" ) )
{
partPath = entry.partitionNode.mid( 9 );
partPath.remove( "\"" );
partPath = partPath.toLower();
partPath.prepend( "/dev/disk/by-partuuid/" );
}
// At this point we either have /dev/sda1, or /dev/disk/by-something/...
if ( partPath.startsWith( "/dev/disk/by-" ) ) // we got a fancy node
{
readlink.start( "readlink", { "-en", partPath });
if ( !readlink.waitForStarted( 1000 ) )
return QString();
if ( !readlink.waitForFinished( 1000 ) )
return QString();
if ( readlink.exitCode() != 0 || readlink.exitStatus() != QProcess::NormalExit )
return QString();
partPath = QString::fromLocal8Bit(
readlink.readAllStandardOutput() ).trimmed();
}
return partPath;
}
}
return QString();
}

View File

@ -40,8 +40,7 @@ struct OsproberEntry
bool canBeResized;
QStringList line;
FstabEntryList fstab;
QString homePartitionPath();
QString homePath;
};
typedef QList< OsproberEntry > OsproberEntryList;