Skip to content
Snippets Groups Projects
Commit 1443b335 authored by Teo Mrnjavac's avatar Teo Mrnjavac
Browse files

OsproberEntry.cpp be gone!

parent edecccfa
No related branches found
No related tags found
No related merge requests found
...@@ -25,7 +25,6 @@ calamares_add_plugin( partition ...@@ -25,7 +25,6 @@ calamares_add_plugin( partition
core/ColorUtils.cpp core/ColorUtils.cpp
core/DeviceModel.cpp core/DeviceModel.cpp
core/KPMHelpers.cpp core/KPMHelpers.cpp
core/OsproberEntry.cpp
core/PartitionActions.cpp core/PartitionActions.cpp
core/PartitionCoreModule.cpp core/PartitionCoreModule.cpp
core/PartitionInfo.cpp core/PartitionInfo.cpp
......
/* === 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();
}
...@@ -40,8 +40,7 @@ struct OsproberEntry ...@@ -40,8 +40,7 @@ struct OsproberEntry
bool canBeResized; bool canBeResized;
QStringList line; QStringList line;
FstabEntryList fstab; FstabEntryList fstab;
QString homePath;
QString homePartitionPath();
}; };
typedef QList< OsproberEntry > OsproberEntryList; typedef QList< OsproberEntry > OsproberEntryList;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment