Commandline improvements

1. Reframe wordings when displaying messages under CLI
2. Corrected systemrescuecd subdir path
3. Corrected CLI usage example for windows
pull/149/head
mbusb 7 years ago
parent 160e1a75d2
commit 762e644022

@ -29,8 +29,6 @@ except:
import scripts
gui = True
iso_link = None
usb_disk = None
uninstall = False
@ -41,15 +39,15 @@ def usage():
print(' -h or --help : Print this help message and exit')
print(' -i or --iso : Path to ISO file')
print(' -t or --target : Path to target USB device partition (example /dev/sdb1)')
print(' -c or --command : This option is must for invoking multibootusb from command line')
print(' -u or --uninstall : List and uninstall distro from USB disk')
print(' -c or --command : Invoke command line usage. This option is must')
print(' -u or --uninstall : List and uninstall distro from an USB disk')
print(' -d or --debug : Enable debug messages (very verbose!)\n')
print(' Command line example for making a bootable USB from command line should look like this:\n')
print(' Eexample for making a bootable USB from command line should look like this:\n')
print('\tpython3 multibootusb -c -i ../../favourite.iso -t /dev/sdb1 on Linux and \n')
print('\tpython3 multibootusb -c -i ../../favourite.iso -t /dev/sdb1 on Windows\n')
print(' Command line example for uninstalling distro from USB should look like this:\n')
print('\tpython3 multibootusb -c -i ../../favourite.iso -t G: on Windows\n')
print(' Example for uninstalling distro from an USB should look like this:\n')
print('\tpython3 multibootusb -c -u -t /dev/sdb1 on Linux and \n')
print('\tpython3 multibootusb -c -u -t /dev/sdb1 on Windows\n')
print('\tpython3 multibootusb -c -u -t G: on Windows\n')
exit(2)
@ -102,16 +100,21 @@ if __name__ == '__main__':
if config.debug is True:
from scripts.debug import colors
print(colors.HEADER + "=== DEBUG ENABLED ===")
log(colors.HEADER + "=== DEBUG ENABLED ===")
if gui is False:
if uninstall is True and config.usb_disk is not None:
if uninstall is True and config.usb_disk is not '':
cli_uninstall_distro()
elif config.iso_link is None and config.usb_disk is None:
elif uninstall is True and config.usb_disk is '':
log('\nYou must provide \'-t\' option to point to your USB disk for uninstalling a distro.\n'
'See the usage example below.')
usage()
elif config.iso_link is None or config.usb_disk is None:
print('\nOptions \'-i\' and \'t\' must be supplied together. See the usage below.')
elif config.image_path is '' and config.usb_disk is '':
log('\nNo option provided. See the usage below.')
usage()
elif config.image_path is '' or config.usb_disk is '':
log('\nOptions \'-i\' and \'-t\' must be supplied together. See the usage below.')
usage()
else:
cli_install_distro()

@ -28,7 +28,6 @@ def install_distro():
:return:
"""
usb_mount = config.usb_mount
print('------------------>' + config.usb_mount)
install_dir = os.path.join(config.usb_mount, "multibootusb", iso_basename(config.image_path))
_iso_file_list = iso.iso_file_list(config.image_path)

@ -134,7 +134,7 @@ def update_distro_cfg_files(iso_link, usb_disk, distro, persistence=0):
iso_basename(iso_link) + '/ ', string, flags=re.I)
elif distro == "systemrescuecd":
rows = []
subdir = '/multibootusb/' + iso_basename(iso_link) + '/'
subdir = '/multibootusb/' + iso_basename(iso_link)
for line in string.splitlines(True):
addline = True
if re.match(r'append.*--.*', line, flags=re.I):

Loading…
Cancel
Save