Skip to main content

install_udev_rules

Function install_udev_rules 

Source
pub fn install_udev_rules(
    location: &Path,
    selection: UdevRuleSelection,
) -> Result<(), UdevInstallError>
Expand description

Installs selected rules and updates udev and the user’s device-access group.

location must be an existing directory. Selected files are created or overwritten with mode 0o644. The function then runs udevadm trigger, udevadm control --reload-rules, groupadd plugdev (accepting an existing group), and usermod -aG plugdev USER, even if no rule files were selected. The user name is the first nonempty value of SUDO_USER, USER, or LOGNAME. Installation generally requires elevated privileges.

§Errors

Returns an error if the user cannot be determined or a filesystem operation or system command fails. Earlier file writes and system changes are not rolled back, so installation can be partial.