Ejemplo n.º 1
0
def add_mount(device, fs_type, options):

    log = logger.get_logger('systemctl')

    config = PlatformConfig()
    mount_template_file = join(config.config_dir(), 'mount', 'mount.template')
    mount_definition = Template(open(mount_template_file,
                                     'r').read()).substitute({
                                         'what':
                                         device,
                                         'where':
                                         config.get_external_disk_dir(),
                                         # 'type': fs_type,
                                         'type':
                                         'auto',
                                         'options':
                                         options
                                     })

    config = PlatformConfig()
    mount_filename = __dir_to_systemd_mount_filename(
        config.get_external_disk_dir())
    with open(__systemd_file(mount_filename), 'w') as f:
        f.write(mount_definition)

    log.info('enabling {0}'.format(mount_filename))
    check_output('systemctl enable {0} 2>&1'.format(mount_filename),
                 shell=True)
    __start(mount_filename)
Ejemplo n.º 2
0
def add_mount(device, fs_type, options):

    log = logger.get_logger('systemctl')

    config = PlatformConfig()
    mount_template_file = join(config.config_dir(), 'mount', 'mount.template')
    mount_definition = Template(open(mount_template_file, 'r').read()).substitute({
        'what': device,
        'where': config.get_external_disk_dir(),
        # 'type': fs_type,
        'type': 'auto',
        'options': options})

    config = PlatformConfig()
    mount_filename = __dir_to_systemd_mount_filename(config.get_external_disk_dir())
    with open(__systemd_file(mount_filename), 'w') as f:
        f.write(mount_definition)

    log.info('enabling {0}'.format(mount_filename))
    check_output('systemctl enable {0} 2>&1'.format(mount_filename), shell=True)
    __start(mount_filename)
Ejemplo n.º 3
0
def remove_mount():
    config = PlatformConfig()
    __remove(__dir_to_systemd_mount_filename(config.get_external_disk_dir()))
Ejemplo n.º 4
0
def remove_mount():
    config = PlatformConfig()
    __remove(__dir_to_systemd_mount_filename(config.get_external_disk_dir()))