Commit Graph

1162 Commits

Author SHA1 Message Date
Andrius Štikonas 1d7a4e4010 Port away from KPluginLoader::metaData. 2022-01-10 00:33:43 +00:00
Andrius Štikonas 30d428c697 Port away from KPluginMetaData::serviceTypes. 2022-01-10 00:24:53 +00:00
Andrius Štikonas 5ffc5c6f23 Fix davfs entries being omitted from fstab file.
BUG: 447961
2022-01-05 23:00:17 +00:00
Andrius Štikonas e58ab02bac Add support for copying unknown partitions.
BUG: 447784
2022-01-01 16:18:57 +00:00
Andrius Štikonas d2fb56bcd2 Allow running chmod in externalcommand helper. 2021-12-28 15:26:01 +00:00
Tomaz Canabrava 770e16eb02 Use --recursive instead of -r 2021-12-28 15:07:35 +00:00
Tomaz Canabrava 36bb57c0dd Add posix permissions on filesystems used in posix systems 2021-12-28 15:07:35 +00:00
Tomaz Canabrava e1774d4026 Remove unused member 2021-12-28 15:07:35 +00:00
Tomaz Canabrava 9093b27bd8 Move the changePosixPermission to the Filesystem
And implement it on ext2, 3, 4. I don't know all the filesystems
that can have posix permissions, those three will do. if we need
more in the future we implement them, it's two lines of code.
2021-12-28 15:07:35 +00:00
Tomaz Canabrava 6c14ddb043 Add new job to change permission of the newly created partition 2021-12-28 15:07:35 +00:00
Andrius Štikonas 68c8fecffd Simplify code using K_PLUGIN_CLASS_WITH_JSON macro.
Also move kpmcore plugins into separate namespace.
2021-12-24 18:58:41 +00:00
Andrius Štikonas a5bdd5a4eb Switch to ntfsinfo to read NTFS usage.
BUG: 447248
2021-12-24 00:03:05 +00:00
Andrius Štikonas 31921c59fa Fix broken fstab when mount point includes space.
fstab column width was calculated before spaces were escaped which would
result in no space between mount point and file system type columns.

BUG: 446218
2021-12-04 23:31:02 +00:00
Tomaz Canabrava 65f986dc29 Add method to query if polkit is installed correctly
The std::cout and qDebugs on the external command helper is
not visible to the user as it runs in another process via dbus
this is highly annoying if you want to be able to discover what's
wrong on the command line.

A method that checks if the file is in the right place should be
called by the users of this library
2021-11-29 11:16:33 -03:00
Harald Sitter b3d0cfccaf set cmake interface dir on the target
this carries through into the Targets.cmake file we install which in
turn means that the imported target for the consumer defines its include
directory. this removes the need to manually add the include dir

also updated the readme accordingly
2021-11-23 10:14:58 +01:00
l10n daemon script 172b76fe9b GIT_SILENT made messages (after extraction) 2021-11-20 00:30:09 +00:00
Andrius Štikonas e9fc875c5e Fix seek error when filling device with random data or zeroes. 2021-11-12 01:02:34 +00:00
l10n daemon script a9998425fd 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"
2021-11-09 01:23:12 +00:00
l10n daemon script 74218e12d6 GIT_SILENT made messages (after extraction) 2021-11-09 00:19:35 +00:00
Andrius Štikonas 282cfdcde1 Do not destroy zfs pool when removing zfs partition.
This can be dangerous, e.g. if partition is part of raid set.
So better be more cautious and in some cases fail to remove partition
than lose data.
2021-10-30 21:13:09 +01:00
l10n daemon script 2734c58069 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"
2021-09-08 01:30:14 +00:00
l10n daemon script d31f1733b6 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"
2021-09-06 01:28:56 +00:00
Artem Grinev 00e6b77c29 Initialize all fields in Partition 2021-08-29 00:16:57 +04:00
Artem Grinev f4664671d6 Clear attributes on new partition creation 2021-08-27 02:37:19 +04:00
l10n daemon script 4c32c38655 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"
2021-07-08 01:22:49 +00:00
l10n daemon script b3050dc894 GIT_SILENT made messages (after extraction) 2021-07-08 00:20:41 +00:00
l10n daemon script f0188249e8 GIT_SILENT made messages (after extraction) 2021-05-17 00:27:08 +00:00
l10n daemon script ce39e14904 GIT_SILENT made messages (after extraction) 2021-03-27 02:33:43 +01:00
Yaroslav Sidlovsky 8746ef72fd Fix smartctl exit status success check
According to the smartctl man page:
```
EXIT STATUS
The  exit  statuses of smartctl are defined by a bitmask.  If all is well with the disk, the exit status (return value) of smartctl is 0 (all bits turned off).  If a problem occurs, or an error, potential error, or fault is detected, then a non-zero status is
returned.  In this case, the eight different bits in the exit status have the following meanings for ATA disks; some of these values may also be returned for SCSI disks.

Bit 0: Command line did not parse.

Bit 1: Device open failed, device did not return an IDENTIFY DEVICE structure, or device is in a low-power mode (see '-n' option above).

Bit 2: Some SMART or other ATA command to the disk failed, or there was a checksum error in a SMART data structure (see '-b' option above).

Bit 3: SMART status check returned "DISK FAILING".

Bit 4: We found prefail Attributes <= threshold.

Bit 5: SMART status check returned "DISK OK" but we found that some (usage or prefail) Attributes have been <= threshold at some time in the past.

Bit 6: The device error log contains records of errors.

Bit 7: The device self-test log contains records of errors.  [ATA only] Failed self-tests outdated by a newer successful extended self-test are ignored.
```

BUG: 429028
2021-03-17 16:03:32 +03:00
l10n daemon script c06a188d0e GIT_SILENT made messages (after extraction) 2021-03-03 03:33:29 +01:00
Guillaume Girol 0094461f60 lvm without arguments has returncode 3 2021-02-27 12:00:00 +00:00
Andrius Štikonas ad888767bb Use QStringLiteral. 2021-02-23 21:39:41 +00:00
Oxalica -- eea84fb605 Fix out of bounds read when parsing fstab.
Some fstab files only have 3 fields and mount options are completely omitted.
2021-02-22 16:45:48 +00:00
Andrius Štikonas 36dfae351f Add initial support for dosfstools 4.2.
Empty labels are not allowed anymore.
One can reset them with -r flag but that is not supported in older
dosfstools. So for now we just manually set label to NO_LABEL.

BUG: 432941
2021-02-19 17:51:43 +00:00
Michael Weghorn 813e574001 Wipe existing signatures when creating partition table
As the sfdisk man page says on the option '--wipe' that
specifies whether or not to wipe signatures in order
to avoid collisions:

> When this option is not given, the default is auto,
> in which case signatures are wiped only when in interactive mode

but sfdisk is not run in interactive mode here, since
stdin does not refer to a terminal, and the sfdisk
man page says:

> It [i.e. sfdisk] runs in interactive mode if executed on terminal
> (stdin refers to a terminal).

Therefore, explicitly pass the '--wipe=always' option to
sfdisk so that old signatures are wiped when a new partition
table is created.

Bug: 431628
2021-01-15 09:53:20 +01:00
Andrius Štikonas 31706cffdc Fix out of bounds read when parsing fstab.
BUG: 429191
2021-01-07 01:25:12 +00:00
Andrius Štikonas 06f15334ec Add support for exfatprogs
Bug: 430907
2020-12-28 17:50:07 +00:00
l10n daemon script 338811601b GIT_SILENT made messages (after extraction) 2020-12-07 02:39:36 +01:00
Andrius Štikonas a06d4ba0f7 Return QByteArray instead of bool in readData. 2020-11-29 23:34:29 +00:00
Andrius Štikonas 73da1bc514 Only allow using ReadData on block devices. 2020-11-29 23:24:49 +00:00
Andrius Štikonas b0e5fa66c4 Add an explicit ReadData method to polkit helper instead of relying on copyblocks with empty target device. 2020-11-29 23:14:08 +00:00
Andrius Štikonas 502ebc0474 Remove declaration of non-existing method. 2020-11-29 22:42:19 +00:00
Andrius Štikonas 04a095a542 Simplify find syntax. 2020-11-29 13:49:50 +00:00
Andrius Štikonas 5da47c26e9 Replace array with unordered set for better performance. 2020-11-29 13:48:07 +00:00
Andrius Štikonas 551654de0d Also rename source/targetFirstByte ot offsets in function declarations. 2020-11-29 13:08:53 +00:00
Andrius Štikonas d34b617272 Rename source/targetFirstByte to source/targetOffset.
Add some diagrams explaining difference between
source/targetOffsets and read/writeOffset.
2020-11-29 01:54:48 +00:00
Andrius Štikonas ee0a1e1b41 Add a limit on the amount of data that can be passed back via DBus. 2020-11-29 01:08:43 +00:00
Andrius Štikonas c556f39064 Add a limit on blocksize to prevent out-of-memory situation. 2020-11-29 00:58:55 +00:00
Andrius Štikonas 9dd38744c5 Add a comment about auth_admin_keep. 2020-11-29 00:50:57 +00:00
Andrius Štikonas 4fa91d75f3 externalcommandhelper: Do not commit suicide when attempting to run non whitelisted command.
Simply returning failure should be sufficient.
2020-11-26 23:35:52 +00:00
Andrius Štikonas 32d146eed3 externalcommandhelper: Make copy direction an enum. 2020-11-26 23:26:31 +00:00
Andrius Štikonas d16d9e8019 Do not reuse QProcess object in externalcommandhelper for different invocations. 2020-11-26 22:05:25 +00:00
Andrius Štikonas fae9f83451 Fix division by zero. 2020-11-26 21:58:24 +00:00
Andrius Štikonas 4d3fcb7691 Merge branch 'release/20.12' 2020-11-17 11:25:44 +00:00
Friedrich W. H. Kossebau 6e8424bed6 Clean up include dirs
Move include of BLKID_INCLUDE_DIRS into scope it is used.
UUID_INCLUDE_DIRS is unused, left over from before partitionmanager
switched away from libuuid in 26e7f9d7ef306d61380e1c8965feb83bb6b07d18 .
Explicit Qt5Core_INCLUDE_DIRS no longer needed.
src/ is automatically available for kpmcore target, also exposed in
its build link interface.
2020-11-16 20:56:57 +00:00
Friedrich W. H. Kossebau 5413e696d3 Generate libpartitionmanagerexport.h 2020-11-16 20:56:57 +00:00
Andrius Štikonas 9d4ab0e6fd Merge branch 'release/20.12' 2020-11-16 16:18:14 +00:00
Friedrich W. H. Kossebau 07e5a3ac28 Make plugins compatible to latest KPluginFactory code
That one uses std::is_constructible<impl, QObject *, const QVariantList &>
which will fail for our current plugin constructors due to being private
and with only friend class KPluginFactory.
2020-11-16 17:14:52 +01:00
Andrius Štikonas 26acd7c10d Remove extra semicolon. 2020-11-14 01:09:23 +00:00
Andrius Štikonas 70d4819aae Merge branch 'release/20.12' 2020-11-14 01:04:31 +00:00
Andrius Štikonas 2e91730f7a Fix parsing fstab mountpoints when they contain spaces or tabs.
If the name of the mount point contains spaces or tabs these
can be escaped as `\040' and '\011' respectively.

BUG: 428932
2020-11-14 00:55:29 +00:00
Andrius Štikonas 2382b9e1c5 Rename d pointer to d_ptr to disambiguate from Device d. 2020-11-12 01:04:47 +00:00
Gaël PORTAY 82566e63e7 d-pointerize NewOperation class. 2020-11-11 16:41:14 -05:00
l10n daemon script 495b1d7c45 GIT_SILENT made messages (after extraction) 2020-11-07 02:39:27 +01:00
l10n daemon script 6f89a9886b GIT_SILENT made messages (after extraction) 2020-11-05 02:41:29 +01:00
l10n daemon script a42fbfa5e4 GIT_SILENT made messages (after extraction) 2020-11-01 02:40:41 +01:00
l10n daemon script 5b8b8d2228 GIT_SILENT made messages (after extraction) 2020-10-29 02:50:01 +01:00
Andrius Štikonas 3448815596 kpmcore does not ship .ui or .rc files. 2020-10-28 11:12:27 +00:00
l10n daemon script b59f34aeb5 GIT_SILENT made messages (after extraction) 2020-10-28 02:43:18 +01:00
Andrius Štikonas 2c8d081357 reuse: Add SPDX info to src/util/org.kde.kpmcore.externalcommand.policy. 2020-10-27 12:20:34 +00:00
l10n daemon script 14777483a1 GIT_SILENT made messages (after extraction) 2020-10-27 02:40:51 +01:00
Andrius Štikonas 68fdf2fcf2 Use XmlMessages.sh for translations of polkit policy files. 2020-10-25 23:45:28 +00:00
Andrius Štikonas 19f78ef76a Port away from qAsConst. 2020-10-24 22:01:45 +01:00
Andrius Štikonas 0c37cc54a6 Remove unnecessary semicolon (-Wpedantic). 2020-10-24 16:29:09 +01:00
Andrius Štikonas ec3479f302 Add overrides to destructors. 2020-10-24 01:33:52 +01:00
Andrius Štikonas 85396708f4 Use Qt::SplitBehavior
Old version QString::SplitBehavious is now deprecated.
2020-10-13 01:23:29 +01:00
Andrius Štikonas d3ebabb6cb Move find_package to top level CMakeLists.txt. 2020-10-13 00:10:03 +01:00
Andrius Štikonas cf5ff51832 Remove unused applicationinterface DBus interface. 2020-10-12 21:49:07 +01:00
Andrius Štikonas e085ba9ed9 Do not link to KAuth. But there is still a build time dependency on kauth-policy-gen. 2020-10-12 20:23:37 +01:00
Andrius Štikonas 6cff70567b Fix signals between helper and client. 2020-10-12 20:23:37 +01:00
Andrius Štikonas cd4d9b1985 Rename helper interfaces. 2020-10-12 20:23:37 +01:00
Andrius Štikonas a2ee82e021 Simplify createFile function, it was checking for authorization twice. 2020-10-12 20:23:37 +01:00
Andrius Štikonas 2dff59260c Remove exit call from the helper. It is no longer used.
BUG: 412887
2020-10-12 20:23:04 +01:00
Andrius Štikonas 89bd4eb6c7 Store successful polkit authentication requests.
We need this to avoid multiple authentication requests when applying
long operations.

Otherwise, the user will have to authenticate after each job,
which can mean up to 4 password dialogs for some longer operations.
2020-10-12 20:22:48 +01:00
Andrius Štikonas 424c8f0bf0 Update comment describing kpmcore_externalcommandhelper. 2020-10-12 20:18:55 +01:00
David Edmundson f646b507ae Fix a crash. 2020-10-12 20:18:55 +01:00
Andrius Štikonas 296f281ffb WIP: cleanup polkit port: licenses, dead code and kauth removal, add TODO about signals. 2020-10-12 20:18:55 +01:00
David Edmundson edfabb90dc WIP: port to polkit 2020-10-12 20:18:55 +01:00
Adriaan de Groot 08c1acb6b4 Missing include (clang/FreeBSD triggers this) 2020-10-10 21:59:57 +02:00
Andrius Štikonas 7ecdaf3ac8 Fix resizing of fat partitions.
Workaround a bug in fatresize (or libparted) where resizing to
partition length failed. Instead try to resize to length - 1.

BUG: 407834
2020-10-04 22:21:58 +01:00
Andrius Štikonas 4819eec59b Allow moving partitions with unknown file system.
BUG: 404398
2020-10-04 21:18:08 +01:00
Andrius Štikonas 924830ebbd When falling back to blkid for filesystem type detection, distinguish between FAT16/32.
CCBUG: 418253
2020-10-04 18:34:00 +01:00
Andrius Štikonas d396e56694 Add support for importing "PartitionTable" of whole device filesystems. 2020-10-04 15:20:58 +01:00
Andrius Štikonas 034311a7cc Add support for whole disk file systems.
BUG: 400652
2020-10-03 15:14:51 +01:00
Andrius Štikonas 0910875137 Do not delete partitions when we have no partition table. 2020-10-03 14:15:10 +01:00
Andrius Štikonas 9ca3a5740a Add information about PartitionTable::TableType::none. 2020-10-03 14:03:59 +01:00
Andrius Štikonas 779cc6cfb7 Split scanPartition function from scanDevicePartitions. 2020-10-03 13:25:05 +01:00
Andrius Štikonas de346177b5 Do not allow moving partitions without partition table. 2020-10-03 12:41:18 +01:00
Andrius Štikonas 81f8939cb1 Add a new type of partition table "none".
This would be useful for block devices without partition table.
2020-10-03 12:39:26 +01:00
Andrius Štikonas 26b352180b Reword a comment. 2020-10-03 12:38:40 +01:00