Commit Graph

1287 Commits

Author SHA1 Message Date
Andrius Štikonas 6d110ca6a5 Move GPL3 license to LICENSES folder. 2020-09-17 01:32:54 +01:00
Andrius Štikonas 37d373cfe0 Fix missing parenthesis in README. 2020-09-15 18:22:08 +01:00
Andrius Štikonas c5c21849b9 Compile kpmcore with QT_NO_KEYWORDS. 2020-09-15 02:36:46 +01:00
Andrius Štikonas fbe54e21f3 Merge branch 'fstab' 2020-09-15 01:09:38 +01:00
Andrius Štikonas ba46ea64ba defaults option in fstab is not necessary, e.g. defaults,ro is the same as defaults. 2020-09-14 02:25:36 +01:00
Andrius Štikonas a928c62a7d Make fstab parsing slightly more readable. 2020-09-14 02:19:14 +01:00
Andrius Štikonas 1d195b00da Prettier formatting of fstab file. 2020-09-14 02:15:20 +01:00
Andrius Štikonas 1782a9d4bb Port away from deprecated QTime::elapsed. 2020-09-13 17:25:51 +01:00
Andrius Štikonas 2ed9953694 Simplify some External Command functions. 2020-09-11 20:27:24 +01:00
Andrius Štikonas 5b80c6045c Fix fstab editing functionality.
In the old code QByteArray fstabContents was actually empty.
Also, writeData function was opening file in append mode,
thus nothing was actually written.

Split writeData function into two:
  * one for block devices
  * another for writing fstab file

BUG: 417205
2020-09-10 23:54:23 +01:00
Adriaan de Groot 45bd205e79 Typofix: the function was half-renamed before the merge 2020-09-01 13:44:22 +02:00
Andrius Štikonas 997e8df183 Add a note about json fixes in util-linux 2.37 2020-08-28 22:41:43 +01:00
Adriaan de Groot 6aa9d93728 Workaround bad JSON output from sfdisk.
The output of `sfdisk --json /dev/sdb` is not necessarily
valid JSON. Then, no partition information is stored,
no first-valid-lba in particular. This leads to new partitions
being made from sector 0, which is invalid on a GPT table.

The workaround is to manually fix the known-broken JSON
from sfdisk. This is amply documented in a standalone
static function.

FIXES #425097
2020-08-24 22:53:54 +02:00
l10n daemon script 394859444f 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"
2020-07-26 05:51:19 +02:00
l10n daemon script 73a1deb092 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"
2020-07-25 05:37:40 +02:00
Andrius Štikonas dc604c4d31 sfdisk: simplify scanDevice by moving out partition setup logic. 2020-06-19 01:52:16 +01:00
l10n daemon script ffb7147f01 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"
2020-06-18 05:48:51 +02:00
l10n daemon script 1843a99895 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"
2020-06-17 14:16:14 +02:00
Gaël PORTAY 6f4b883130 sfdisk: Move GPT Attributes functions to new sfdiskgptattributes
This centralizes the two get functions related to GPT Attributes.
2020-06-16 20:15:56 -04:00
Gaël PORTAY 547fa609fe sfdisk: Read GPT type and attributes at scanning
The GPT type and attributes can be set since the commits 0529ebf (Add
support for setting the specific GPT type) and 0ffec31 (Add new job to
set the GPT partition attributes).

But these two data from existing partitions are not read and are missing
though.

This reads the GPT type and attributes data at scanning from the json
output, after the GPT name/label and uuid are read.
2020-06-16 15:45:53 -04: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
Andrius Štikonas 9dd118c58b Merge branch 'partition-uuid' into 'master'
Partition uuid

See merge request kde/kpmcore!8
2020-05-15 16:52:23 +00: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
Andrius Štikonas df4e2332f4 Merge branch 'fix-typos' into 'master'
Fix typos

See merge request kde/kpmcore!7
2020-05-15 15:51:06 +00:00
Gaël PORTAY e9992714a1 Fix typos 2020-05-15 11:39:55 -04:00
l10n daemon script 3c6ee043f6 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"
2020-05-09 06:34:55 +02:00
Adriaan de Groot 1d9b1161d4 On non-Linux, findBlkIdDevice() has unused parameters
Summary: Add Q_UNUSED() to mark the unused parameters

Test Plan: Builds with fewer warnings on FreeBSD

Differential Revision: https://phabricator.kde.org/D24155
2020-05-08 16:18:14 +02:00
Andrius Štikonas cacdb7b634 Fix some issues spotted by David Faure.
In particular, add a check for partition capacity to be positive.
2020-05-08 15:10:56 +01:00
l10n daemon script a2a9bb8301 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"
2020-04-04 06:23:31 +02: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
l10n daemon script a4379583b3 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"
2020-03-27 06:21:07 +01: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
l10n daemon script 52c29aaf10 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"
2020-03-25 06:42:28 +01:00
Andrius Štikonas 6921398ba3 Merge branch 'gportay/kpmcore-partition-type' 2020-03-22 01:49:35 +00:00
Andrius Štikonas 4fdaf6b1c8 Bump soversion of kpmcore. 2020-03-22 01:49:25 +00:00
Andrius Štikonas a810d0d2fd Merge branch 'gportay/kpmcore-update-filesystem-features-api' 2020-03-22 01:24:57 +00:00
Gaël PORTAY 9d6c98ff4a Replace FSFeature by QVariantMap
The object QVariant is a native object in the Qt world that represents
any type of value: boolean, integer, string, floating point, date,
UUID...

This change updates the API to use the object QVariant and provide a
more flexible API to represent the filesystem features.
2020-03-21 18:09:01 -04:00
Yuri Chornoivan 62aaa90a29
Fix minor EBN issues 2020-03-21 11:22:15 +00:00
Gaël PORTAY 0529ebfb01 Add support for setting the specific GPT type
The GPT partition layout defines the type of the partition using a
UUID[1]. The type of the partition is not related to the underlying
filesystem but to its functionality: rootfs, home, var, swap, esp...

The UUID 4f68bce3-e8cd-4db1-96e7-fbcaf984b709 defines the root partition
(/), the UUID 933ac7e1-2eb4-4f13-b844-0e14e2aef915 defines the home
partition (/home), the UUID 4d21b016-b534-45c2-a9fb-5c16e091fd2d defines
the variable partition (/var)... Also, the UUIDs may vary depending on
the architecture (x86, x86_64, arm or aarch64).

KPMcore guesses the type depending on the underlying filesystem.

This commit enables the setting of a more specific GPT type if it is
specified through the method Partition::setType(). It falls back to the
previous guess type if the type is left unset.

[1]: https://systemd.io/DISCOVERABLE_PARTITIONS/
2020-03-20 22:15:50 -04:00
l10n daemon script 59269f63df 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"
2020-03-11 06:00:21 +01:00
Andrius Štikonas efb970ba11 Add a missing features.h include. 2020-02-08 22:01:24 +00:00
Andrius Štikonas f47a83408b Bump kpmcore soversion to 9. 2020-02-08 20:47:23 +00:00
l10n daemon script b7306d2d19 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"
2020-02-07 05:43:45 +01:00
Andrius Štikonas aa34937185 Bump kpmcore version to 4.1.0. 2020-02-01 15:20:46 +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
l10n daemon script 50697be784 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"
2019-12-08 05:22:07 +01:00
Andrius Štikonas dfce039421 Only trigger udev events for block device subsystem.
Triggerring other subsystems is not necessary and occasionally
results in triggering unrelated bugs.

BUG: 413973
2019-12-02 22:01:10 +00:00
Yuri Chornoivan ca2180f526 Fix minor typo 2019-11-22 15:45:18 +02:00
Yuri Chornoivan 1a7b673792 Fix minor issues found by EBN 2019-11-22 15:45:12 +02:00