#!/usr/bin/env python import sys import os from common_utils import require_root_or_exit from efiutils import ( DiskDetails, show_available_disks, ) if __name__ == '__main__': require_root_or_exit() if len(sys.argv) < 2: print('Usage: %s dev_path' % (os.path.basename(sys.argv[0]), )) print('') print(' dev_path: full path to disk (e.g. /dev/sdh}') print('') print('Following are available disks') show_available_disks() exit(1) d = DiskDetails(sys.argv[1]) msg = ('Confirm disk to update grub config. ' 'Data will not be affected %s') % (d.devpath, ) if d.confirm_action(msg): d.multiboot_update_config()
show_available_disks, ) if __name__ == '__main__': require_root_or_exit() if len(sys.argv) < 3: print('Usage: %s dev_path root_partition [nombr]' % (os.path.basename(sys.argv[0]), )) print('') print(' dev_path: full path to disk (e.g. /dev/sdh}') print(' root_partition: root partition path (e.g. /dev/sdh3)') print('') print(' nombr: if third argument is nombr, then grub-mbr is NOT ') print(' installed to MBR EVEN if BIOS partition is present') print('') print('Following are available disks') show_available_disks() exit(1) boot_dev = sys.argv[1] root_partition = sys.argv[2] update_mbr = True if len(sys.argv) > 3: update_mbr = (sys.argv[3] != 'nombr') d = DiskDetails(boot_dev) partnum = d.partnum_by_path(root_partition) msg = 'Confirm disk. Data will not be affected %s' % (d.devpath, ) if d.confirm_action(msg, partnum): d.make_bootable(root_partition, update_mbr) update_fstab_boot_efi(boot_dev, root_partition)
if __name__ == '__main__': require_root_or_exit() if len(sys.argv) < 2: print('Usage: %s dev_path boot_dir' % ( os.path.basename(sys.argv[0]), )) print('') print('dev_path: path to disk (e.g. /dev/sdh}') print('boot_dir: path to copy boot files from') print('') print('Following are available disks') show_available_disks() exit(1) boot_dev = sys.argv[1] boot_dir = sys.argv[2] msg = 'Confirm destroying all partitions and data on %s' % (sys.argv[1],) try: d = DiskDetails(boot_dev) resp = d.confirm_action(msg) except: resp = erase_partition_table(boot_dev) if not resp: exit(0) d = DiskDetails(boot_dev) d.bootdisk_erase_create() boot_partition = d.partitions[-1].path d.bootdisk_populate_update_cfg( boot_partition=boot_partition, boot_dir=boot_dir)