Debian Utils¶
Useful debian commands for other blueprints to use.
-
add_apt_key
(url)¶
-
add_apt_ppa
(name, accept=True, src=False)¶
-
add_apt_repository
(repository, accept=True, src=False)¶
-
add_fstab
(filesystem=None, mount_point=None, type='auto', options='rw', dump='0', pazz='0')¶ Add mount point configuration to /etc/fstab. If mount point already mounted on different file system then unmount.
Parameters: - filesystem (str) – The partition or storage device to be mounted
- mount_point (str) – The mount point where <filesystem> is mounted to
- type (str) – The file system type (Default: auto)
- options (str) – Mount options of the filesystem (Default: rw)
- dump (str) – Used by the dump utility to decide when to make a backup, 0|1 (Default: 0)
- pazz (str) – Used by fsck to decide which order filesystems are to be checked (Default: 0)
-
add_rc_service
(name, priorities='defaults')¶
-
apt_get
(command, *options)¶
-
chgrp
(location, group, recursive=False)¶
-
chmod
(location, mode=None, owner=None, group=None, recursive=False)¶
-
chown
(location, owner, group=None, recursive=False)¶
-
chpasswd
(name, password, encrypted_passwd=False)¶
-
command_exists
(*command)¶
-
cp
(source, destination, force=True, mode=None, owner=None, group=None)¶
-
debconf_communicate
(command, package)¶
-
debconf_set_selections
(*selections)¶
-
dpkg_query
(package)¶
-
get_group
(name)¶
-
get_mount
(mount_point)¶ Resolve a mount point to mounted file system. If not mounted, return None.
Parameters: mount_point (str) – Name of mount point to reslve Return str: Mounted file system
-
get_user
(name)¶
-
groupadd
(name, gid=None, gid_min=None, gid_max=None, system=False)¶
-
groupmod
(name, gid)¶
-
hostname
()¶
-
is_mounted
(mount_point)¶ Check if mount point is mounted.
Parameters: mount_point – Name of mount point Return bool:
-
kill
(sig, process, use_pkill=False)¶
-
lbs_codename
()¶
-
lbs_release
()¶
-
ln
(source, destination, symbolic=True, force=True, mode=None, owner=None, group=None)¶
-
locale_gen
(locale, utf8=True)¶
-
mkdir
(location, recursive=True, mode=None, owner=None, group=None)¶
-
mktemp
(directory=False, mode=None)¶
-
mount
(mount_point, owner=None, group=None, **fstab)¶ Mount and optionally add configuration to fstab.
Parameters: - mount_point (str) – Name of mount point
- owner (str) – Name of mount point owner
- group (str) – Name of mount point group
- fstab (dict) – Optional kwargs passed to add_fstab()
-
mv
(source, destination, force=True)¶
-
nproc
()¶ Get the number of CPU cores.
-
page_size
()¶ Get PAGE_SIZE
-
phys_pages
()¶ Get _PHYS_PAGES
-
pwd
()¶
-
remove_rc_service
(name)¶
-
rm
(location, recursive=False, force=True)¶
-
service
(name, action, check_status=True)¶
-
service_task
(name, action, check_status=False)¶
-
set_timezone
(timezone)¶ Set OS timezone
Parameters: timezone – Europe/Stockholm
-
sighup
¶ Send SIGHUP signal to process
Parameters: process – PID of process
-
temporary_dir
(*args, **kwds)¶
-
total_memory
()¶ Get total memory in bytes
-
unmount
(mount_point)¶ Unmount mount point.
Parameters: mount_point (str) – Name of mount point to unmount
-
update_rc
(basename, priorities, force=False)¶
-
useradd
(name, home=None, create_home=False, shell=None, uid=None, uid_min=None, uid_max=None, user_group=False, gid=None, groups=None, system=False, password=None)¶ Create a new user or update default new user information
Parameters: - name – The username
- home – Home directory of the new account. Will not create dir. (Optional)
- create_home – Create the user’s home directory (Default: False)
- shell – Login shell of the new account (Optional)
- user_group – Create a group with the same name as the user (Default: False)
- uid – User ID of the new account (Optional)
- uid_min – Min value for automatic user/group ID selection (Optional)
- uid_max – Max value for automatic user/group ID selection (Optional)
- gid – Name or ID of the primary group of the new account (Optional)
- groups – List of supplementary groups of the new account (Optional)
- system – Create a system account (Optional)
- password – Encrypted password of the new account (Optional)
-
usermod
(user, password=None, home=None, uid=None, gid=None, groups=None, shell=None)¶