Commit Graph

105 Commits

Author SHA1 Message Date
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 ec3479f302 Add overrides to destructors. 2020-10-24 01:33:52 +01:00
Andrius Štikonas 6cff70567b Fix signals between helper and client. 2020-10-12 20:23:37 +01:00
Andrius Štikonas d396e56694 Add support for importing "PartitionTable" of whole device filesystems. 2020-10-04 15:20:58 +01:00
Andrius Štikonas d68ffeadef REUSE: SPDX style license headers for src/util. 2020-10-01 00:33:19 +01:00
Andrius Štikonas f7eb6eec5d REUSE: SPDX license headers for src/jobs. 2020-09-29 23:55:11 +01:00
Andrius Štikonas fc826690b9 SPDX licenses for tests and CMakeLists.txt. 2020-09-17 02:15:16 +01:00
Andrius Štikonas c5c21849b9 Compile kpmcore with QT_NO_KEYWORDS. 2020-09-15 02:36:46 +01:00
Gaël PORTAY 0ffec31e2b Add new job to set the GPT partition attributes
The GPT partition layout supports partition attributes.

The CLI sfdisk sets the partition attributes using the option
--part-attrs. See the examples below:

	$ cat <<EOF | sfdisk disk.img
	label: gpt
	type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B, size=64M
	type=0FC63DAF-8483-4772-8E79-3D69D8477DE4
	EOF
	(...)

	$ sfdisk --part-attrs disk.img 1 RequiredPartition,NoBlockIOProtocol,LegacyBIOSBootable,48
	(...)

	$ sfdisk --part-attrs disk.img 2 60,61,62,63
	(...)

	$ sfdisk --dump disk.img
	(...)
	disk.img1 : start=        2048, size=      131072, type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B, uuid=BBE806BB-8567-A843-9FF5-9B6B35D2908E, attrs="RequiredPartition NoBlockIOProtocol LegacyBIOSBootable GUID:48"
	disk.img2 : start=      133120, size=     1963999, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=7DB39F08-C138-664B-B38E-ED2DEB549AA6, attrs="GUID:60,61,62,63"

This commit introduces the new job set-partition-attributes that is used
in the new-operation to set the attributes of the partition. The job
uses the newly introduced method setPartitionAttributes that is
implemented by the sfdisk and dummy backends.

Note: This is a copypaste of what was done for GPT partition label in
commit f585f6c (Add new job to set the GPT partition label) and GPT
partition UUID in commit 1dde035 (Add new job to set the GPT partition
UUID).

Note: RequiredPartition, NoBlockIOProtocol, LegacyBIOSBootable are
key words for 0, 1 and 2.
2020-06-15 17:51:42 -04:00
Gaël PORTAY e12f0ec391 Store the generated partitition UUID after creation
The GPT UUID are generated by the backends automatically once a
partition is created.

This reads the UUID that was generated after the creation of a partition
and stores it back to the object Partition.
2020-05-15 12:13:41 -04:00
Gaël PORTAY 1dde035705 Add new job to set the GPT partition UUID
The GPT partition layout supports unique GUID partitions.

The CLI sfdisk sets the partition UUID using the option --part-uuid.
See the examples below:

	$ cat <<EOF | sfdisk disk.img
	label: gpt
	type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B, size=64M
	type=0FC63DAF-8483-4772-8E79-3D69D8477DE4
	EOF
	(...)

	$ sfdisk --dump disk.img
	(...)
	disk.img1 : start=        2048, size=      131072, type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B, uuid=BBE806BB-8567-A843-9FF5-9B6B35D2908E
	disk.img2 : start=      133120, size=     1963999, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=7DB39F08-C138-664B-B38E-ED2DEB549AA6

	$ sfdisk --part-uuid disk.img 1 00000000^C000-0000-0000-000000000000
	(...)

	$ sfdisk --part-uuid disk.img 2 11111111-1111-1111-1111-111111111111
	(...)

	$ sfdisk --dump disk.img
	(...)
	disk.img1 : start=        2048, size=      131072, type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B, uuid=00000000-0000-0000-0000-000000000000
	disk.img2 : start=      133120, size=     1963999, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=11111111-1111-1111-1111-111111111111

This commit introduces the new job set-partition-uuid that is used in
the new-operation to set the UUID of the partition. The job uses the
newly introduced method setPartitionUUID that is implemented by the
sfdisk and dummy backends.

Note: This is a copypaste of what was done for GTP partition label in
commit f585f6c (Add new job to set the GPT partition label).
2020-05-15 12:13:17 -04:00
Gaël PORTAY e9992714a1 Fix typos 2020-05-15 11:39:55 -04:00
Andrius Štikonas d6b2584d1b Merge branch 'partition-name' into 'master'
Add support for setting the GPT partition name.

See merge request kde/kpmcore!4
2020-03-28 00:42:09 +00:00
Gaël PORTAY f585f6c3ad Add new job to set the GPT partition label
The GPT partition layout supports naming partitions.

The support for the partition label was added in the backend libparted
since commit 28fa6ac (Add support for GTP partition labels).

The libparted was removed later by commit 8fa1814 (Remove libparted
backend) and no backend sets the partition label.

The CLI sfdisk sets the partition label using the option --part-label.
See the examples below:

	$ cat <<EOF | sfdisk disk.img
	label: gpt
	type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B, size=64M
	type=0FC63DAF-8483-4772-8E79-3D69D8477DE4
	EOF
	(...)

	$ sfdisk --part-label disk.img 1 efi
	(...)

	$ sfdisk --part-label disk.img 2 rootfs
	(...)

	$ sfdisk --dump disk.img
	(...)
	disk.img1 : start=        2048, size=      131072, type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B, uuid=D08E5B2A-4649-9F4A-AEA3-6C3048888EAA, name="efi"
	disk.img2 : start=      133120, size=     1963999, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=0BEEFE82-19EA-DC4C-BB6A-27B6DA0C3BD2, name="rootfs"

This commit introduces the new job set-partition-label that is used in
the new-operation to set the label of the partition. The job uses the
newly introduced method setPartitionLabel that is implemented by the
sfdisk and dummy backends.
2020-03-25 11:20:01 -04:00
Yuri Chornoivan 62aaa90a29
Fix minor EBN issues 2020-03-21 11:22:15 +00:00
Arnaud Ferraris d24191ebd8 Add support for filesystem-specific features
In some cases, it may be necessary to create a filesystem with specific features
enabled/disabled.

This PR makes it possible to create filesystems this way. It does so
by introducing a new m_Features member variable and the createWithFeatures()
function to the FileSystem base class. The latter function is implemented
for the btrfs, ext2/3/4 and FAT filesystems.

Additionnally, the CreateFileSystemJob has been modified to enable
creating/formatting filesystems with specific features enabled.

Differential Revision: https://phabricator.kde.org/D21903
CCBUG: 342178
2020-01-12 11:58:32 +00:00
Andrius Štikonas f260247422 Simplify return value logic. 2018-10-21 23:59:39 +01:00
Caio Carvalho a2d601d512 Checking for SoftwareRAID_Device type in partition table job. 2018-07-11 12:01:26 -03:00
Caio Carvalho a8b7222350 Check for SoftwareRAID devices in CreateFileSystemJob. 2018-07-10 23:04:55 -03:00
Caio Carvalho 6c27d99f2c Enabling to create and delete SoftwareRAID devices' partitions. 2018-07-10 20:03:59 -03:00
Andrius Štikonas ed59aac2c8 Show error when setting file system label fails. 2018-04-13 20:21:48 +03:00
Andrius Štikonas 07458efb91 Make sure system is informed about the change of file system label. 2018-04-13 15:54:51 +03:00
Andrius Štikonas 6b558f49d8 Use blockdev --rereadpt instead of partx --update. 2018-04-13 13:08:43 +03:00
Andrius Štikonas 527734e9e8 Switch JobStatus enum to scoped enum. 2018-04-12 15:18:50 +03:00
Andrius Štikonas 622def3b56 Convert more enums to scoped enums. 2018-04-09 15:14:34 +01:00
Andrius Štikonas ee2688d4d9 Merge branch 'master' into kauth 2018-04-09 12:44:14 +01:00
Andrius Štikonas b42b41bdea Add a shorter Partition::State enum names.
Will be converted to enum class later.
2018-04-09 03:46:05 +01:00
Andrius Štikonas 3ccd04e675 Switch Device::Type enum to enum class. 2018-04-09 02:57:45 +01:00
Andrius Štikonas 17c8772240 Explicitely specify the scope of enum. 2018-04-07 19:54:30 +01:00
Andrius Štikonas 279159ca6f Use smart pointers for CoreBackendPartitionTable. 2018-03-31 21:49:20 +01:00
Andrius Štikonas 1500eeb625 Use std::unique_ptr for CoreBackendDevices 2018-03-31 14:44:40 +01:00
Andrius Štikonas 2cef3f6ec6 Cleanup ExternalCommand interface:
* Remove a separate constructor for copyblocks.
 * Remove kauthThread and finished() signal.
2018-03-22 17:29:40 +00:00
Huzaifa Faruqui 72da110996 Fix copyblocks exit status check 2018-02-06 22:32:26 +05:30
Andrius Štikonas 06139c85ac Remove unused function argument in startCopyBlocks. 2018-02-06 16:24:32 +00:00
Huzaifa Faruqui b143c139e5 Fix Report in copyBlocks 2018-01-29 16:45:21 +05:30
Andrius Štikonas bf2a23dada Use copyjobs KAuth helper for other copying jobs too. 2018-01-24 15:45:19 +00:00
Andrius Štikonas 61fed73a5d Remove some debug output. 2018-01-24 15:35:11 +00:00
Huzaifa Faruqui e42a5c9289 Implement copyblocks function in KAuth helper.
Switch BackupFileSystemJob to thenew copyblocks function.

Reviewed and cleaned up by: Andrius Štikonas
2018-01-24 15:22:42 +00:00
Andrius Štikonas 790553aa0b Merge branch 'smart' into kauth 2018-01-11 11:31:18 +01:00
Andrius Štikonas 4773f49edc Initial support for resizing LUKS2 volumes.
Does not yet work when LUKS2 is used with dm-integrity.
2017-12-29 20:01:06 +00:00
Andrius Štikonas fdf6e19de0 Remove another workaround which hopefully is no longer necessary. 2017-12-10 19:56:04 +00:00
Andrius Štikonas 41473119b1 backend: provide more information about backend device.
Pass Device object, not just deviceNode string when opening Core Backend Device
2017-12-06 21:33:31 +00:00
Andrius Štikonas 0bfb7094df Merge branch 'master' into sfdisk 2017-12-06 00:41:19 +00:00
Andrius Štikonas e66fb4b95e Do not attempt to set partition flags that were not changed. 2017-12-06 00:27:02 +00:00
Andrius Štikonas 80de99fc73 Move setFlags function from CoreBackendPartition to CoreBackendPartitionTable.
setFlags function now takes additional argument const Partition& partition.
This allows us to completely remove CoreBackendPartition class.
Remove getPartitionBySector and getExtendedPartitions.
These functions were designed around libparted API and are not very convenient
with other backends.
2017-11-07 22:55:28 +00:00
Andrius Štikonas a6415561ae SetPartFlagsJob should return error when it is unable to find partition. 2017-11-07 03:07:51 +00:00
Andrius Štikonas 87e210432d Merge branch '3.2' 2017-10-31 16:16:36 +00:00
Andrius Štikonas 8909dd87d0 Add a workaround for device not ready error.
In rare cases after moving file system to a new location file system check
fails on the first try. As a temporary workaround, wait a bit and try again.
2017-10-30 15:59:05 +00:00
Andrius Štikonas 55e445b069 More user friendly copying direction message in the log. 2017-10-30 14:24:55 +00:00