From 1443b335d3bf97ecc7fae0ac6fbbd65ab2047992 Mon Sep 17 00:00:00 2001 From: Teo Mrnjavac Date: Wed, 13 Jul 2016 17:30:06 +0200 Subject: [PATCH] OsproberEntry.cpp be gone! --- src/modules/partition/CMakeLists.txt | 1 - src/modules/partition/core/OsproberEntry.cpp | 90 -------------------- src/modules/partition/core/OsproberEntry.h | 3 +- 3 files changed, 1 insertion(+), 93 deletions(-) delete mode 100644 src/modules/partition/core/OsproberEntry.cpp diff --git a/src/modules/partition/CMakeLists.txt b/src/modules/partition/CMakeLists.txt index f514025c6..54214987e 100644 --- a/src/modules/partition/CMakeLists.txt +++ b/src/modules/partition/CMakeLists.txt @@ -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 diff --git a/src/modules/partition/core/OsproberEntry.cpp b/src/modules/partition/core/OsproberEntry.cpp deleted file mode 100644 index a1e0c2b4d..000000000 --- a/src/modules/partition/core/OsproberEntry.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* === This file is part of Calamares - === - * - * Copyright 2016, Teo Mrnjavac - * - * 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 . - */ - -#include "OsproberEntry.h" - -#include - - -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(); -} diff --git a/src/modules/partition/core/OsproberEntry.h b/src/modules/partition/core/OsproberEntry.h index d94082289..36fcaea19 100644 --- a/src/modules/partition/core/OsproberEntry.h +++ b/src/modules/partition/core/OsproberEntry.h @@ -40,8 +40,7 @@ struct OsproberEntry bool canBeResized; QStringList line; FstabEntryList fstab; - - QString homePartitionPath(); + QString homePath; }; typedef QList< OsproberEntry > OsproberEntryList;