projects
/
grml2usb.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Release new version 0.18.3
[grml2usb.git]
/
grml2usb
diff --git
a/grml2usb
b/grml2usb
index
867bea0
..
d206f1d
100755
(executable)
--- a/
grml2usb
+++ b/
grml2usb
@@
-503,6
+503,12
@@
def get_partition_for_path(path):
def check_boot_flag(device):
def check_boot_flag(device):
+ if os.path.isdir(device):
+ logging.debug(
+ "Device %s is a directory, skipping check for boot flag." % device
+ )
+ return
+
boot_dev, x = get_device_from_partition(device)
logging.info("Checking for boot flag")
boot_dev, x = get_device_from_partition(device)
logging.info("Checking for boot flag")
@@
-912,7
+918,7
@@
def mount(source, target, mount_options):
if x.startswith(source):
raise CriticalException(
(
if x.startswith(source):
raise CriticalException(
(
- "Error executing mount:
%s
already mounted - "
+ "Error executing mount:
{0}
already mounted - "
"please unmount before invoking grml2usb"
).format(source)
)
"please unmount before invoking grml2usb"
).format(source)
)
@@
-1308,6
+1314,9
@@
def copy_bootloader_files(iso_mount, target, grml_flavour):
exec_rsync(efi_img, target + "/boot/efi.img")
handle_secure_boot(target, efi_img)
exec_rsync(efi_img, target + "/boot/efi.img")
handle_secure_boot(target, efi_img)
+ execute(mkdir, target + "/conf/")
+ glob_and_copy(iso_mount + "/conf/bootfile_*", target + "/conf/")
+
for ffile in ["f%d" % number for number in range(1, 11)]:
search_and_copy(ffile, iso_mount, syslinux_target + ffile)
for ffile in ["f%d" % number for number in range(1, 11)]:
search_and_copy(ffile, iso_mount, syslinux_target + ffile)
@@
-1487,7
+1496,6
@@
def handle_grub_config(grml_flavour, device, target):
logging.debug("Updating grub configuration")
grub_target = target + "/boot/grub/"
logging.debug("Updating grub configuration")
grub_target = target + "/boot/grub/"
- secureboot_target = target + "/EFI/ubuntu/"
bootid_re = re.compile(r"bootid=[\w_-]+")
live_media_path_re = re.compile(r"live-media-path=[\w_/-]+")
bootid_re = re.compile(r"bootid=[\w_-]+")
live_media_path_re = re.compile(r"live-media-path=[\w_/-]+")
@@
-1502,9
+1510,7
@@
def handle_grub_config(grml_flavour, device, target):
remove_regexes.append(re.compile(regex))
shortname = get_shortname(grml_flavour)
remove_regexes.append(re.compile(regex))
shortname = get_shortname(grml_flavour)
- for filename in glob.glob(grub_target + "*.cfg") + glob.glob(
- secureboot_target + "*.cfg"
- ):
+ for filename in glob.glob(grub_target + "*.cfg"):
for line in fileinput.input(filename, inplace=1):
line = line.rstrip("\r\n")
if option_re.search(line):
for line in fileinput.input(filename, inplace=1):
line = line.rstrip("\r\n")
if option_re.search(line):
@@
-1754,18
+1760,18
@@
def handle_secure_boot(target, efi_img):
logging.critical("Fatal: %s", error)
sys.exit(1)
logging.critical("Fatal: %s", error)
sys.exit(1)
-
ubuntu_cfg = search_file("grub.cfg", efi_mountpoint + "/EFI/ubuntu
")
- logging.debug("
ubuntu_cfg = %s" % ubuntu
_cfg)
- if not
ubuntu
_cfg:
+
grub_cfg = search_file("grub.cfg", efi_mountpoint + "/boot/grub/
")
+ logging.debug("
grub_cfg = %s" % grub
_cfg)
+ if not
grub
_cfg:
logging.info(
logging.info(
- "No /
EFI/ubuntu
/grub.cfg found inside EFI image, looks like Secure Boot support is missing."
+ "No /
boot/grub
/grub.cfg found inside EFI image, looks like Secure Boot support is missing."
)
else:
)
else:
- mkdir(target + "/
efi/ubuntu
")
+ mkdir(target + "/
boot/grub/x86_64-efi/
")
logging.debug(
logging.debug(
- "exec_rsync(%s, %s + '/
efi/ubuntu/grub.cfg')" % (ubuntu
_cfg, target)
+ "exec_rsync(%s, %s + '/
boot/grub/x86_64-efi/grub.cfg')" % (grub
_cfg, target)
)
)
- exec_rsync(
ubuntu_cfg, target + "/efi/ubuntu
/grub.cfg")
+ exec_rsync(
grub_cfg, target + "/boot/grub/x86_64-efi
/grub.cfg")
logging.debug(
"exec_rsync(%s + '/EFI/BOOT/grubx64.efi', %s + '/efi/boot/grubx64.efi')'"
logging.debug(
"exec_rsync(%s + '/EFI/BOOT/grubx64.efi', %s + '/efi/boot/grubx64.efi')'"
@@
-1881,10
+1887,6
@@
def install_grml(mountpoint, device):
register_tmpfile(device_mountpoint)
remove_device_mountpoint = True
try:
register_tmpfile(device_mountpoint)
remove_device_mountpoint = True
try:
- check_for_fat(device)
- if not options.skipbootflag:
- check_boot_flag(device)
-
set_rw(device)
mount(device, device_mountpoint, ["-o", "utf8,iocharset=iso8859-1"])
except CriticalException:
set_rw(device)
mount(device, device_mountpoint, ["-o", "utf8,iocharset=iso8859-1"])
except CriticalException:
@@
-1951,7
+1953,7
@@
def handle_mbr(device):
break
if not mbrcode:
break
if not mbrcode:
- str_locations = " or ".join(['"%s"' %
l for l
in mbr_locations])
+ str_locations = " or ".join(['"%s"' %
x for x
in mbr_locations])
logging.error("Cannot find syslinux MBR, install it at %s)", str_locations)
raise CriticalException(
"syslinux MBR can not be found at %s." % str_locations
logging.error("Cannot find syslinux MBR, install it at %s)", str_locations)
raise CriticalException(
"syslinux MBR can not be found at %s." % str_locations
@@
-2169,6
+2171,9
@@
def main():
# provide upgrade path
handle_compat_warning(device)
# provide upgrade path
handle_compat_warning(device)
+ if not options.skipbootflag:
+ check_boot_flag(device)
+
# check for vfat partition
handle_vfat(device)
# check for vfat partition
handle_vfat(device)