Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall.py
diff options
context:
space:
mode:
authorAnton Hvornum <anton.feeds@gmail.com>2019-04-14 23:13:19 +0200
committerAnton Hvornum <anton.feeds@gmail.com>2019-04-14 23:13:19 +0200
commit620db3623ccf5328766656c89d023d89c4c056f6 (patch)
tree465e6bf4af822d316d86001eaafb034e81b224f3 /archinstall.py
parent65aed10fa2c56dcce38bfbd6059e64a67f7118e6 (diff)
Added support to select --drive=<UUID> and it now maps to a drive. To ensure /dev/sda haven't changed location and the wrong drive gets wiped
Diffstat (limited to 'archinstall.py')
-rw-r--r--archinstall.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/archinstall.py b/archinstall.py
index afb22d65..734bb6d0 100644
--- a/archinstall.py
+++ b/archinstall.py
@@ -218,6 +218,18 @@ def simple_command(cmd, opts=None, *args, **kwargs):
handle.stdout.close()
return output
+def get_drive_from_uuid(uuid):
+ if len(harddrives) <= 0: raise ValueError("No hard drives to iterate in order to find: {}".format(uuid))
+
+ for drive in harddrives:
+ #for partition in psutil.disk_partitions('/dev/{}'.format(name)):
+ # pass #blkid -s PARTUUID -o value /dev/sda2
+ o = simple_command('blkid -s PTUUID -o value /dev/sda')
+ if len(o):
+ return drive
+
+ return None
+
def update_git():
default_gw = get_default_gateway_linux()
if(default_gw):
@@ -387,6 +399,10 @@ if __name__ == '__main__':
if not 'profile' in args: args['profile'] = None
if not 'profiles-path' in args: args['profiles-path'] = profiles_path
+ if args['drive'][0] != '/':
+ ## Remap the selected UUID to the device to be formatted.
+ args['drive'] = get_drive_from_uuid(args['drive'])
+
## == If we got networking,
# Try fetching instructions for this box and execute them.
instructions = {}