Commit Graph

580 Commits

Author SHA1 Message Date
Andrius Štikonas 50ba46a693 Fix a typo where declarared variable was not used. 2017-09-14 01:27:38 +01:00
Andrius Štikonas 6b4185cff1 Do not crash when partition has no mount points. 2017-09-13 23:28:37 +01:00
Andrius Štikonas 268a68a318 Split fstab lines with both spaces and tabs. 2017-09-13 23:05:32 +01:00
Andrius Štikonas 8f7e0beb0f Sort files in CMakeLists.txt alphabetically. 2017-09-13 18:52:43 +01:00
Andrius Štikonas 34712dd2ed Add fstab file parser.
Remove dependency on KMountPoint and hence KIO.
2017-09-13 18:46:33 +01:00
Andrius Štikonas 6b6ddbdcef Use int for maxLabelLength. 2017-09-11 16:52:20 +01:00
Andrius Štikonas 17e6c32633 Fix more implicit type conversion warnings. 2017-09-11 13:41:03 +01:00
Andrius Štikonas 6c433c264c Port FileSystem::luks away from KDiskFreeSpaceInfo. 2017-09-11 12:19:49 +01:00
Andrius Štikonas a041090168 Port LvmDevice away from KDiskFreeSpaceInfo. 2017-09-11 12:15:37 +01:00
Andrius Štikonas 8a477e689e Minor clang warnings++ 2017-09-11 12:01:39 +01:00
Andrius Štikonas 5433294a5b Fix more minor clang issues. 2017-09-11 00:29:30 +01:00
Andrius Štikonas f7e5f7c7bf Rename KPMcore include guards.
clang in -Weverything mode does not like double underscore.
2017-09-10 20:12:52 +01:00
Andrius Štikonas 0f2ab468eb Disable some characters in FAT label input. 2017-09-10 19:19:08 +01:00
Andrius Štikonas fbf7e78efe Update credits: Pali Rohár 2017-09-10 18:03:41 +01:00
Andrius Štikonas f1654486dc Remove unnecessary semicolon. 2017-09-10 17:26:12 +01:00
Andrius Štikonas 2404689dd0 Port away from KDiskFreeSpaceInfo to QStorageInfo. 2017-09-08 18:35:30 +01:00
Andrius Štikonas 1889b9e8fa Port unmount code away from KMountPoints (KIO). 2017-09-08 17:58:27 +01:00
Andrius Štikonas f1accd1e0d Remove IconThemes dependency from kpmcore. 2017-09-08 15:05:55 +01:00
Andrius Štikonas 5a83e741cb Add support for detecting ISO9660 file systems.
BUG: 364476
2017-09-08 11:42:12 +01:00
Andrius Štikonas 2cfcefd9c9 nilfs2: pass -f to mkfs.nilfs2 to overwrite existing file system 2017-09-08 00:20:35 +01:00
Andrius Štikonas 3866bf6fef Only include <linux/fs.h> on GNU/Linux 2017-09-07 21:34:45 +01:00
Andrius Štikonas 2b52ec492b Only create QRegularExpressionValidator when needed and destroy it afterwards. 2017-09-05 16:20:50 +01:00
Pali Rohár 9cc6596cb4 Implement udf::labelValidator() for validating UDF label
This would rapidly simplify UDF code if all checks are done by caller.

Also checks for MIN_UDF_BLOCKS/MAX_UDF_BLOCKS are removed as they should be
covered by udf::minCapacity() and udf::maxCapacity().
2017-09-05 15:53:24 +01:00
Andrius Štikonas 58f3d09d71 Port away from QRegExp. 2017-09-05 12:57:45 +01:00
Andrius Štikonas 447ae7fc90 Use QValidator to validate label input. 2017-09-05 12:52:34 +01:00
Andrius Štikonas 0badfebcb1 lvm: disable error channel for vgs/pvs commands.
Having an error channel can result in unwanted devices, e.g.:
"/dev//dev/mapper/test: read failed after 0 of 4096 at 0: Input/output error"
2017-09-04 19:55:08 +01:00
Andrius Štikonas 4a39e453dc Add a function for validating labels. 2017-09-04 17:39:29 +01:00
Andrius Štikonas 6ad873223e udf: set MBR partition id to 0x07. 2017-09-03 21:24:15 +01:00
Andrius Štikonas 703270b64c udf: do not hardcode min/max sector size. 2017-09-03 18:40:19 +01:00
Andrius Štikonas c4628ad715 Use block size provided by the backend in UDF file system. 2017-09-03 18:27:57 +01:00
Andrius Štikonas 7dba4b8245 Record sector size in FileSystem class. 2017-09-03 15:37:14 +01:00
Andrius Štikonas d797a47229 QList->QVector. 2017-08-31 10:48:10 +01:00
Andrius Štikonas 756c5b5beb Use QHash instead of QMap for storing LVM LV sizes. 2017-08-31 10:16:16 +01:00
Pali Rohár db13a4bab9 Process UDF label correctly when creating new UDF file system
Mkudffs from udftools prior to version 1.1 damages the label if it contains
non-ASCII characters.

The Volume Identifier (--vid) can only contain 30 bytes, either 30
ISO-8859-1 (Latin 1) characters or 15 UCS-2BE characters. Store the most
characters possible in the Volume Identifier.
2017-08-31 10:13:32 +01:00
Andrius Štikonas 2a118753ae Allow selecting different channels in ExternalCommand output. 2017-08-31 10:13:24 +01:00
Andrius Štikonas fd68f9334c Add createWithLabel support for F2FS. 2017-08-31 10:13:07 +01:00
Andrius Štikonas 6a78a74515 Add support for creating file systems with label.
Some file systems such as UDF or F2FS only support writing labels when creating
them.

At the moment this only works in new partition dialog and not in the partition
properties dialog.
2017-08-31 10:13:01 +01:00
Andrius Štikonas 684a1ce073 Add colour for UDF file system. 2017-08-31 10:12:54 +01:00
Pali Rohár feec00f4e7 Add basic support for UDF filesystem
For reading UDF label and UUID is needed blkid >= 2.30. For creating new
UDF filesystem is needed mkudffs binary from the udftools package.

When creating new UDF fileystem, revision 2.01 for hard disk media is used.
Therefore it is not possible to use it for optical (or other) medias.

Problems:
* Check for min and max capacity is incorrect as it depends on logical
  (sector) size of the disk.
* Check for max label length is incorrect too as it depends on characters
  itself in label.
* Specifying label is not working yet as FileSystem::create() does not get
  label parameter.
* UDF filesystem should be used on unpartitioned disk, without MBR or GPT
  and spanning whole disk, but KDE Partition Manager does not support it.
* When MBR is used, MBR partition id should be 0x07, but currently it is
  incorrect 0x83. See: https://serverfault.com/a/829172 (same for GPT)
2017-08-31 10:12:44 +01:00
Andrius Štikonas 13c063a150 Fix a possible null pointer dereference.
On some systems getlogin() function might fail to obtain user name.
For now just check whether pointer is nullptr. In that case suspending
plasma device automounter would not work but at least we will not crash.

In future it might make sense to try to use other methods of obtaining login
name, such as running "who am i".

BUG: 381987
2017-07-04 21:07:54 +01:00
Andrius Štikonas 037380228d QRegularExpression->QJson
lsblk LUKS mapping point parsing now uses json.
2017-07-04 14:42:39 +01:00
Andrius Štikonas 311a171307 Use QtJson to parse lsblk output. 2017-06-28 14:11:43 +01:00
Harald Sitter 984a4e9ace fix device RO check
Summary:
- mark deviceNode const
- copy it as deviceName
- mutate deviceName by removing `/dev/`
- use the new deviceName for the read-only check

this makes sure we emit the unmodified deviceNode (e.g. /dev/vda) rather
than the name (e.g. vda). unbreaks for example calamares which doesn't
know what to do with "vda".

CCBUG: 378607

Test Plan:
- without fix clamares fails to list devices
- with the fix calamares lists devices

Reviewers: stikonas

Reviewed By: stikonas

Differential Revision: https://phabricator.kde.org/D6414
2017-06-28 13:51:27 +02:00
Andrius Štikonas a35702e911 Use lsblk's TYPE=disk when scanning for devices.
The previous way relied on kernel device numbers but this gets ugly, especially
in cases when device number is not assigned such as virtio disks.

BUG: 378607
2017-06-22 03:11:58 +01:00
Andrius Štikonas fda1e219de Add more major device numbers for virtio.
BUG: 378607
2017-06-20 15:51:13 +01:00
Andrius Štikonas 6b31dd0e85 Remove accidentally commited debug code. 2017-06-14 15:26:02 +02:00
Andrius Štikonas b98dcc90d8 Bump version to 3.1.1. 2017-06-14 00:20:13 +02:00
Andrius Štikonas 9252bc6156 seteuid has to be used instead of setuid.
According to setuid manual, seteuid has to be used to be able to
regain root privileges later.
2017-06-12 22:00:36 +02:00
Andrius Štikonas 63ddb4e472 QList<QString> -> QStringList. 2017-06-12 12:47:17 +02:00
l10n daemon script cb1f76d018 SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2017-06-11 04:31:47 +02:00
Andrius Štikonas 63b5c8c34c Suspend Plasma removable device automounting.
Before doing operations, we connect to DBus session of the original user
and stop kded module for device automounting.

BUG: 368175
2017-06-07 19:21:59 +02:00
Andrius Štikonas 3228fa081a Use qAsConst in ranged based for loops. 2017-06-04 22:26:24 +01:00
Andrius Štikonas d2ce014589 Use range based for instead of Q_FOREACH.
Bump Qt version requirements to 5.7.0
2017-06-01 11:16:09 +01:00
Andrius Štikonas e43d6645e4 Replace VLA with new[]. 2017-06-01 01:36:38 +01:00
Andrius Štikonas 5f0d1cd72b Port qSort. 2017-05-03 19:24:20 +01:00
Christian Morlok b10577e1c7 Fix creation of encrypted volumes
We can't rely on the order of lsblk. Check for the type=crypt instead.

BUG: 379205
2017-04-25 19:08:14 +01:00
Andrius Štikonas ff714f2f0e Fix online label support.
Some filesystems require mountpoint while some deviceNode to change file system
label only. So split writeLabel action into online and offline actions.
2017-04-09 17:49:55 +01:00
Alexander Schlarb 427e37a047 Prevent the libparted backend from exposing "null devices"
REVIEW: 129968
BUG: 375394
2017-02-25 13:45:22 +00:00
Teo Mrnjavac 876a3932fd Do not filter out KVM virtual disks in LibPartedBackend::scanDevices. 2017-02-17 11:55:15 +01:00
Andrius Štikonas 7c901593b2 Use slightly more descriptive variable names. 2017-02-05 15:50:56 +00:00
l10n daemon script 610710e7f4 SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2017-02-05 06:03:02 +01:00
l10n daemon script 0f41f40b1f SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2017-02-04 06:20:00 +01:00
Andrius Štikonas 16c12ddb9e Both swap and LVM PV should not use KDiskFreeSpaceInfo. 2017-01-26 18:07:28 +00:00
Andrius Štikonas b5b3af4b22 Use qCeil to set used sectors for luks file systems.
When using LUKS encrypted LVM logical volumes sector size is large and
we cannot assume that result of division is integer. Without this, number of
used extents can be underestimated by one.
2017-01-26 17:40:41 +00:00
Andrius Štikonas 901d01185f Do not set LUKS logical sector size to 512.
This breaks used space reporting for LUKS encrypted LVM LV.
2017-01-25 18:21:25 +01:00
Andrius Štikonas f8ba25fdfa Improve used space detection to use fs utils when not mounted. 2017-01-05 17:27:17 +00:00
Andrius Štikonas 0bb267830d Fix a bug (that could result in data loss) where left handle of partition resize widget was not actually disabled. 2016-12-31 12:34:38 +02:00
l10n daemon script 2fcc37dfb6 SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2016-12-20 12:47:43 +01:00
Andrius Štikonas d899de94c3 Do not link to KAuth. 2016-12-18 19:44:57 +00:00
l10n daemon script c63567b524 SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2016-12-15 06:24:36 +01:00
Teo Mrnjavac 30ac4bb6ab [Coverity] Initialize all members.
CID 147251
2016-12-13 16:46:36 +01:00
Teo Mrnjavac dcf972b779 [Coverity] Initialize all members.
CID 154913
2016-12-13 16:40:47 +01:00
Teo Mrnjavac a20d81c345 [Coverity] Initialize all members.
CID 154914
2016-12-13 16:36:36 +01:00
Andrius Štikonas cbe21e7ef9 Fix online resize of encrypted volumes. 2016-12-06 21:42:44 +00:00
Andrius Štikonas cc8a2558eb Fix one forgotten instance of fsck.msdos -> fsck.fat. 2016-12-06 01:45:22 +00:00
Teo Mrnjavac a749d1c84d Handle parent change in Partition copy constructor. 2016-12-01 19:00:39 +01:00
Andrius Štikonas 2e960d5c00 Make initLUKS function non-static. 2016-11-30 17:18:51 +00:00
Teo Mrnjavac 52b356e45f Make sure to always also read outerUuid. 2016-11-30 17:44:03 +01:00
Teo Mrnjavac 39ec355b70 Remove obsolete headers. 2016-11-30 16:42:03 +01:00
Teo Mrnjavac 5e40017238 Add FS::luks::outerUuid(). 2016-11-30 16:42:03 +01:00
Andrius Štikonas e42020dc9b Disable loop devices for now.
BUG: https://calamares.io/bugs/browse/CAL-416

After the release we can break API and add option to include/exclude them.
2016-11-25 15:31:09 +00:00
Andrius Štikonas e0afdeb6cb Move sorting comparison function to lambda. 2016-11-19 01:39:10 +00:00
Andrius Štikonas 6926046edb Sort LVM LV volumes alphabetically. 2016-11-19 01:36:15 +00:00
Friedrich W. H. Kossebau da0b939bf6 Use generic commits.kde.org for homepage instead of now outdated quickgit.kde.org 2016-11-16 18:36:51 +01:00
Teo Mrnjavac eb3b90ec9e Handle cryptsetup luksUUID failure. 2016-11-16 15:20:54 +01:00
Andrius Štikonas 3c58349561 Make sure KDiskFreeSpaceInfo is never used for swap. 2016-11-15 17:00:59 +00:00
Andrius Štikonas a78e6f986e Disable pasting into LVM VG. It does not yet work. 2016-11-10 14:52:02 +00:00
Andrius Štikonas 0c8035f667 Improve wording in comments a bit. 2016-11-10 14:37:48 +00:00
Andrius Štikonas f9d9d8912b Disable copying LVM LVs. It does not yet work. 2016-11-10 14:29:38 +00:00
Andrius Štikonas ee49c05d60 Remove ResizeVolumeGroup operation from operation stack if it has no jobs. 2016-11-07 18:56:26 +00:00
Andrius Štikonas ca0def38f7 Add a comment. 2016-11-07 17:49:30 +00:00
Andrius Štikonas 4ed3ce6267 Check if fileSystem pointer is nullptr before trying to read used space
Hopefully it fixes the following crashes as well:
BUG: 364863
BUG: 365872
2016-11-07 17:45:22 +00:00
Andrius Štikonas f948569fef Pass --force to vgremove in order to allow removing deactivated volume groups. 2016-11-05 21:48:30 +00:00
Andrius Štikonas d0ed72fd20 Fix a typo in LVM VG Operation description. 2016-11-05 20:34:52 +00:00
Andrius Štikonas e3214a1b48 Do not call KDiskFreeSpaceInfo::freeSpaceInfo without a non-empty mount point. 2016-11-05 20:29:31 +00:00
Andrius Štikonas eb0c32e9dc Improve checking whether LVM VG can be removed.
E.g. if we remove all LVM LVs without applying operations then LVM VG removal
should be possible.

This still does not take into account inactive LVM volumes.
2016-11-05 15:33:20 +00:00
Andrius Štikonas 5c2d485b32 Delete partition table in LVM VG remove operation. 2016-11-05 13:10:30 +00:00
Andrius Štikonas d6c375f959 Update copyrights. 2016-11-04 14:20:11 +00:00
Andrius Štikonas 6ebe0acf56 Spelling fix. 2016-11-04 00:49:42 +00:00
Andrius Štikonas 6717ea913d Fix resize volume group job description. 2016-11-03 22:15:43 +00:00