aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorPapoteur <papoteur@mageia.org>2023-08-01 15:48:46 +0200
committerPapoteur <papoteur@mageia.org>2023-08-01 15:49:11 +0200
commit67f456e3cf9a802111ce0158f140ffc302b459e2 (patch)
tree850a06e7941361c22d037af9f6713e7d89f33021 /lib
parent9d8775f70069e22fed33bfa9e6397394494b6db5 (diff)
downloadisodumper-67f456e3cf9a802111ce0158f140ffc302b459e2.tar
isodumper-67f456e3cf9a802111ce0158f140ffc302b459e2.tar.gz
isodumper-67f456e3cf9a802111ce0158f140ffc302b459e2.tar.bz2
isodumper-67f456e3cf9a802111ce0158f140ffc302b459e2.tar.xz
isodumper-67f456e3cf9a802111ce0158f140ffc302b459e2.zip
Add the code for creating any type of partition after writing ISO image
Diffstat (limited to 'lib')
-rwxr-xr-xlib/isodumper.py36
1 files changed, 27 insertions, 9 deletions
diff --git a/lib/isodumper.py b/lib/isodumper.py
index 94f0484..48353be 100755
--- a/lib/isodumper.py
+++ b/lib/isodumper.py
@@ -6,7 +6,7 @@
#
# Author: Oliver Grawert <ogra@ubuntu.com>
#
-# Modifications 2013 from papoteur <papoteur@mageialinux-online.org>
+# Modifications 2013-2023 from papoteur <papoteur@mageialinux-online.org>
# and Geiger David <david.david@mageialinux-online.org>
#
# This program is free software; you can redistribute it and/or
@@ -260,6 +260,12 @@ class Logging():
class IsoDumper(basedialog.BaseDialog):
+ # Maximal length for partition label
+ label_length = { "fat32": 11,
+ "ext4": 16,
+ "ntfs": 32,
+ "exfat": 11
+ }
def get_devices(self, selected=None):
self.list = self.u.find_devices()
while len(self.list) == 0:
@@ -467,9 +473,9 @@ class IsoDumper(basedialog.BaseDialog):
)
if self.ask_YesOrNo(info):
name = self.partition_label.value()
- if format_type == "fat32":
+ if format_type == "fat32" or format_type == "exfat":
name = name.upper()[:11]
- elif format_type == "exfat" or format_type == "ntfs":
+ elif format_type == "ntfs":
name = name[:32]
rc = self.raw_format(target, format_type, name)
self.operation = False
@@ -675,13 +681,10 @@ class IsoDumper(basedialog.BaseDialog):
nowarning, message = self.iface.end()
self.progress.setEnabled()
# Add persistent partition if asked, persistent or not
- if (
- self.partition_cbox.isChecked()
- and self.partition_cb.value() == "ext4"
- ):
+ if (self.partition_cbox.isChecked()):
self.progress.setLabel(_("Adding partition"))
self.progress.setValue(0)
- if self.cryptcb.isChecked():
+ if self.cryptcb.isChecked() and (self.partition_cb.value() == "ext4"):
if self.cryptkey.value() == "":
message = _(
"No key for encrypted partition provided. Adding the partition aborted."
@@ -692,6 +695,7 @@ class IsoDumper(basedialog.BaseDialog):
target,
self.partition_label.value(),
self.cryptkey.value(),
+ self.partition_cb.value()
)
while not self.iface.done:
progress = self.iface.progress
@@ -714,7 +718,7 @@ class IsoDumper(basedialog.BaseDialog):
nowarning = False
else:
self.iface.do_persistence(
- target, self.partition_label.value(), ""
+ target, self.partition_label.value(), "", self.partition_cb.value()
)
while not self.iface.done:
progress = self.iface.progress
@@ -1281,6 +1285,20 @@ exFAT, NTFS or ext. You can specify a volume name and the format in a new dialog
info = Info(_("Error"), True, _("No image to write is selected."))
self.ask_OK(info)
return
+ if self.partition_cbox.isChecked():
+ format_type = list(self.format_type.keys())[
+ list(self.format_type.values()).index(self.partition_cb.value())
+ ]
+ if len(self.partition_label.value()) > self.label_length[format_type]:
+ info = Info(
+ _("Warning"),
+ True,
+ _(
+ "Label length will be shorten to {} characters. Do you want to continue?".format(self.label_length[format_type])
+ ),
+ )
+ if not self.ask_YesOrNo(info):
+ return
if self.backup_cbox.isChecked() and self.backup_is_selected:
backup_success, message = self.backup_go()
if not backup_success: