Commit Graph

28 Commits

Author SHA1 Message Date
Anton Hvornum 7f01747efc
Torxed fix sys command calls (#932)
* Fixed exceptions in is_vm() and virtualization()

* Added exception handling for parted in BlockDevice.free_space
2022-02-02 08:18:12 +01:00
Anton Hvornum 1aa738691e
Fixing the 'device_instance' being None in some partition places (#902)
* Added a new return value from add_partition. Also added an exception to make sure `add_partition` can't continue silently

* Added a log of debugging to add_partition

* Removed a blank line (flake8)

* Misconfigured variable

* Added some more debugging information to partprobe

* FIX: disk layout: partprobe should be called and checked only for target device (#896)

* disk layout: partprobe should be called and checked only for target device

* disk layout: partprobe: removed unnecessary bash subprocess

* Properly defined BlockDevice() on Partition() creation. Also made sure mount-checks got some rrro handling and non-block devices should no longer attempt to return a size

Co-authored-by: Anton Hvornum <anton.feeds@gmail.com>
Co-authored-by: Victor Gavro <vgavro@gmail.com>
2022-01-25 16:09:34 +01:00
Anton Hvornum e32cf71ae7
Added type annotations to all functions (#845)
* Added type annotations for 1/5 of the files.

There's bound to be some issues with type miss-match, will sort that out later.

* Added type hints for 4/5 of the code

* Added type hints for 4.7/5 of the code

* Added type hints for 5/5 of the code base

* Split the linters into individual files

This should help with more clearly show which runner is breaking since they don't share a single common name any longer. Also moved mypy settings into pyproject.toml

* Fixed some of the last flake8 issues

* Missing parameter

* Fixed invalid lookahead types

* __future__ had to be at the top

* Fixed last flake8 issues
2022-01-06 22:01:15 +01:00
Anton Hvornum 7a01841586
Changed lsblk to blkid where possible (#802)
* Swapped lsblk for blkid
* Added a hefty sleep on partprobe()

And added a TODO for the future
2021-12-16 09:00:10 +00:00
Anton Hvornum e729457b6c
Support encrypting multiple partitions (#759)
* Added support for storing disk encryption keyfiles and add them to a keyslot.
* Added a luks2().add_key() function in order to inject a keyfile into a keyslot on a encrypted volume.
* Simplified 'missing encryption password' logic in Filesystem(). Added a call to luks2().add_key() after the root-password is set on the volume, to add the keyfile in slot 2
* Adding in password handling in luks2().add_key(). It's required to enter a previous passphrase to unlock the volume and add a new keyslot. Also simplified the handling of partition in Installer().mount_ordered_layout()
* Adding in encryption on all partitions except /boot when encryption is opted in
* Removed setting size on Partition() as it's a read only value. No idea how Partition().size = size hasn't caused an issue before. Removed size=X argument to Partition()
* Added a uniqueness to the loopdevice name. This should ensure that multiple encrypted volumes can be opened at the same time, except for Partition().detect_inner_filesystem() operations which can only happen one at a time since they share namespace. This should never be an issue since archinstall is single threaded and no concurrent operations can/should happen.
* Added partprobe() as part of disk/helpers.py, added a /dev/ -> UUID mapper function called convert_device_to_uuid(path). Added a luks2().crypttab() function that sets up a /etc/crypttab entry.
* Moved the responsability for telling archinstall to generate a keyfile from Filesystem() to user_interaction.py. This should in the future be a user-input based value, and not something the Filesystem() automatically dictates.
* Added a retry mechanism to luks2().encrypt() to avoid having to re-start the installation when a device simply wasn't up yet.
* Swapping UUID= lookup from loopdev to physdev.
2021-11-24 00:09:33 +01:00
Dylan M. Taylor 72d02a391d
Add accessibility packages to installed system if using the on the live ISO (#760)
* Add group of accesibility tools
* Conditionally extend base packages
* Enable it if accessibility in use in guided
* Fix circular import
2021-11-23 21:10:21 +01:00
Anton Hvornum 6b6c9c84be
Adding a warning when /boot is reasonably too small (#738)
* Moved convert_size_to_gb() into disk/helpers.py, Added a Partition().size property meta function. Using the .size value to check if /boot is too small which will raise an exception. The only drawback is that it's done post-formatting. This in order to catch scenarios where formatting isn't used.
* Changed /boot warning from 0.15GB to 0.25GB
* Changed the wording in the warning when /boot is too small.
2021-11-23 11:37:51 +00:00
Anton Hvornum c264fd466a
Fix #746 - Can't create a filesystem on a new partition during the manual partitioning (#751)
* Changed default value of info in largest_free_space()
* Fixing bad assumption that a disk always contain a minimum of two partitions.
2021-11-22 09:33:00 +00:00
Anton Hvornum c0bf44e0ae Converted partprobe call into a function. 2021-11-11 18:40:41 +01:00
Anton Hvornum e0782f234b Tweaked partitions usage in blockdevice 2021-11-11 14:30:52 +00:00
Anton Hvornum c2bfc4e340 Tweaked partitions usage in blockdevice 2021-11-11 14:29:41 +00:00
Anton Hvornum 4ea7feb04e Added more debugging (some duplicate, but that's fine) 2021-11-11 14:16:14 +00:00
Anton Hvornum faadc2b968
Fixed linting issue 2021-11-10 11:40:47 +00:00
Werner Llácer 671c7b3854 Solves issue #689. Attribute Error.'None type' has no attribute 'format' ...
It seems the system does not syncronus update its internal information after a partitioning.
Two places are affected. Directly on filesystem.add_partition (the uuid of the new partition isn't available after the parted command)
and blockdevice.get_partition, where the list of partitions for the iterator might not be available in the query.
The patch places both sections under controlled loops, giving the system the chance to update the information.
Should be more controlled via application parameters
2021-11-10 11:20:38 +01:00
Anton Hvornum c9a4e38497 Linting fix 2021-11-09 11:10:19 +00:00
Werner Llácer 80a406c930 Followup to the previous one. Output of size function is rounded to the first decimal so output doesn't look too cluttered 2021-11-08 19:58:11 +01:00
Werner Llácer 6d0c55e5d6 Solves issue #674
We turned the size query of the devices to byte mode in lsblk (lsblk -b)
It avoids problems with the localized output of the lsblk utility.
2021-11-08 14:32:47 +01:00
Anton Hvornum 93fcc4cb54
Fixed a broken import 2021-11-05 21:50:56 +01:00
Anton Hvornum 5259549466
Fixed some import errors that snuk in master 2021-11-05 21:47:30 +01:00
Anton Hvornum 0071a06908
Merged PR #650 - flake8 fixes and tightening
Tighten up flake8 tests used by GitHub Action lint_python
2021-11-05 15:48:03 +00:00
Anton Hvornum b6ab678631
Ignoring flake8 on blockdevice.py. 2021-11-05 16:44:51 +01:00
Anton Hvornum 2fcd8198b2
Cleaned up all flake8 issues/warnings. Did some code cleaning as well, mostly how we called things in guided.py but also some SysCommand calls 2021-11-05 16:27:01 +01:00
Didr a868bc095d
Add import for all_disks 2021-11-01 13:05:09 +01:00
Anton Hvornum 62f5bf4c83 Merging in parts of Master related to disk.py 2021-10-30 20:26:54 +02:00
Anton Hvornum 7149b76f3b
Forgot some imports that didn't show up on a static run without going through a few of the menu's 2021-10-22 21:54:16 +02:00
Anton Hvornum 8b96080ec8
Forgot some imports that didn't show up on a static run without going through a few of the menu's 2021-10-22 21:02:39 +02:00
Anton Hvornum 2ef793b76a
Forgot some imports that didn't show up on a static run without going through a few of the menu's 2021-10-22 20:55:00 +02:00
Anton Hvornum 7ac06d75d0
Restructured disk.py into lib/disk/<splits>.py instead. Shouldn't be any broken links as we expose all the functions through __init__.py - but you never know so I'll keep an eye for issues with this. 2021-10-22 20:43:01 +02:00