Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/disk.py
diff options
context:
space:
mode:
authorAnton Hvornum <anton.feeds+github@gmail.com>2020-07-07 21:59:09 +0000
committerAnton Hvornum <anton.feeds+github@gmail.com>2020-07-07 21:59:09 +0000
commit0bc24699c1aba583b1d98809321e2f726425f3fe (patch)
tree730d9ceb73673a2a04869053dca1a58b0fc382d8 /archinstall/lib/disk.py
parent78d4fe4fa1f6d38a6aebe26a26218de39d565990 (diff)
Added colored output. Also tested non-encrypted installations and added ext4 support.
Diffstat (limited to 'archinstall/lib/disk.py')
-rw-r--r--archinstall/lib/disk.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/archinstall/lib/disk.py b/archinstall/lib/disk.py
index 1bdff8e2..30a7c44e 100644
--- a/archinstall/lib/disk.py
+++ b/archinstall/lib/disk.py
@@ -1,7 +1,7 @@
import glob, re, os, json
from collections import OrderedDict
from .exceptions import *
-from .general import sys_command
+from .general import *
ROOT_DIR_PATTERN = re.compile('^.*?/devices')
GPT = 0b00000001
@@ -90,7 +90,7 @@ class Partition():
return f'Partition({self.path}, fs={self.filesystem}, mounted={self.mountpoint})'
def format(self, filesystem):
- print(f'Formatting {self} -> {filesystem}')
+ log(f'Formatting {self} -> {filesystem}')
if filesystem == 'btrfs':
o = b''.join(sys_command(f'/usr/bin/mkfs.btrfs -f {self.path}'))
if not b'UUID' in o:
@@ -101,13 +101,17 @@ class Partition():
if (b'mkfs.fat' not in o and b'mkfs.vfat' not in o) or b'command not found' in o:
raise DiskError(f'Could not format {self.path} with {filesystem} because: {o}')
self.filesystem = 'fat32'
+ elif filesystem == 'ext4':
+ if (handle := sys_command(f'/usr/bin/mkfs.ext4 -F {self.path}')).exit_code != 0:
+ raise DiskError(f'Could not format {self.path} with {filesystem} because: {b"".join(handle)}')
+ self.filesystem = 'fat32'
else:
raise DiskError(f'Fileformat {filesystem} is not yet implemented.')
return True
def mount(self, target, fs=None, options=''):
if not self.mountpoint:
- print(f'Mounting {self} to {target}')
+ log(f'Mounting {self} to {target}')
if not fs:
if not self.filesystem: raise DiskError(f'Need to format (or define) the filesystem on {self} before mounting.')
fs = self.filesystem
@@ -166,10 +170,10 @@ class Filesystem():
if prep_mode == 'luks2':
self.add_partition('primary', start='513MiB', end='100%')
else:
- self.add_partition('primary', start='513MiB', end='513MiB', format='ext4')
+ self.add_partition('primary', start='513MiB', end='100%', format='ext4')
def add_partition(self, type, start, end, format=None):
- print(f'Adding partition to {self.blockdevice}')
+ log(f'Adding partition to {self.blockdevice}')
if format:
return self.parted(f'{self.blockdevice.device} mkpart {type} {format} {start} {end}') == 0
else: