backend Package

keyboard Module

Keyboard utilities

vinstall.backend.keyboard.set_kb_layout(layout)[source]

Set the keyboard layout. #TODO: add variants and options

vinstall.backend.keyboard.xkb()[source]

Get available keyboard settings

media Module

Media handling. Implements a Partition class providing methods formounting,umounting, formating and querying partitions.

class vinstall.backend.media.Partition(device_path)[source]

Bases: object

A class representing a partition in a hard disk.

device_path: the path to the device node.

format(filesystem)[source]

Create a filesystem in this partition.

is_mounted()[source]

Returns True if the media is mounted, False otherwise.

mount(mountpoint, mount_opt='auto')[source]

Mount the media in the specified mountpoint.

query_filesystem()[source]

Retrieve the current filesystem type from the system.

umount()[source]

Umount the media.

vinstall.backend.media.list_cdroms(proc_info='/proc/sys/dev/cdrom/info')[source]

Find CDROM devices based in the information stored in the proc tree.

vinstall.backend.media.list_disks()[source]

List the disks present in the system by parsing fdisk -l. Returns a tuple with path in the first position, and the string representation of the size in the second. #TODO: we shouldnt rely in the fdisk formatting. Use pyparted or similar.

vinstall.backend.media.list_partitions(proc_partitions_info='/proc/partitions')[source]

List the partitions present in the system by parsing /proc/partitions.

vinstall.backend.media.list_swap()[source]

Returns a list of swap devices.

utils Module

Collection of small utilities.

vinstall.backend.utils.exec_chroot(root, command)[source]

Change the root dir for current shell and run the given command.

Arguments:

dir: The directory to for chrooting to. command: The command to be executed under the new root.
>>> exec_chroot('/', 'pwd')
0
vinstall.backend.utils.format_partition(path, filesystem)[source]

Create a filesystem in a partition using mkfs.

vinstall.backend.utils.get_mem_size()[source]

Get the amount of RAM availablein the system in mB.

vinstall.backend.utils.is_mounted(device)[source]

Returns true if device is mounted.

vinstall.backend.utils.mount(src, mountpoint, extra=None, filesystem='auto')[source]

Mount a filesystem.

Arguments:

src: the filesystem or device to be mounted. extra: extra options to be passed to the mount command, for example:

“-o loop”. Default is None.
filesystem: filesystem type passed to the mount command, for example:
“ext3”. Default is auto.
vinstall.backend.utils.supported_filesystems()[source]

Returns a list of filesystems supported by the system.

vinstall.backend.utils.umount(mounted)[source]

Unmount a filesystem.

Arguments:

A mounted filesystem or device.
>>> umount('/mnt/loop')
0

Table Of Contents

This Page