![]() ![]() ![]() ![]() |
|
This module provides some utilities for common calls in the HiPi modules code.
You may find them useful in your own code.
use HiPi::Utils qw( get_groups create_system_group create_user_group group_add_user group_remove_user home_directory is_windows is_unix is_raspberry is_mac );
I like to be able to run my code on none-raspberry platforms during development. This gives me a quick and consistent way of checking if the code is running on a Raspberry Pi. For the same reason the following are implemented is_windows is_unix is_raspberry is_mac
In the same spirit as is_raspberry, is_windows etc., this gives me a correct home directory on any platform.
returns a hash reference where the keys are all the groups on the system and the values are a reference to a hash containing the gid and an array reference of member names. i.e. return { groupname1 => { gid => $gid1, members => \@members1 }, groupname2 => { gid => $gid2, members => \@members2 }, ....... };
A thin wrapper around groupadd -f -r -g $gid $groupname if $gid is undefined calls groupadd -f -r $groupname
A thin wrapper around groupadd -f -g $gid $groupname if $gid is undefined calls groupadd -f $groupname
A thin wrapper around gpasswd -a $username $groupname
A thin wrapper around gpasswd -d $username $groupname
Changes uid, effective uid, gid and effective gid of the running process to the $username and $groupname specified. This is very useful if you are using a module or methods ( such as HiPi::BCM2835 ) which require root level permissions during initialisation. Once you have initialised you can reduce to a less privileged user and group greatly enhancing the security of your process.