ExtLib - common functions for use by Extensions.



add_line_to_file ($file, $line)

Append a line to a text file.

check_bool ($bool)

Check if a string is a true value such as 1, true or yes. The match is not case sensitive. check_bool() is useful for checking true values from the configuration file.

chown_ug ($user, $group, @files)

Change ownership of a list of files using symbolic user and group names.

del_line_from_file ($file, $line)

Delete a given line from a text file.

edit_warning ($comment_char)

Returns a warning message that can be put in generated config file. It takes an optional string so that you can change the comment string. If not defined, it will use '#' by default.

generate_password ([$length [, @valid]])

Generate a random password of given length (or 10 if not supplied). The password will use the characters from @valid or, if not supplied, the characters from the following list:

 (0..9, 'a'..'z', 'A'..'Z', '@', '#', '%', '^', '*')

mkdir_p ($dir, $mode, $uid, $gid)

Make a directory and any missing parents. Similar to 'mkdir -p'.

repl_line_in_file ($file, $old_line, $new_line)

Replace a given line in a text file with another line.

rm_r ($dir)

Recursively delete all files in a given directory, including the directory.

run_scripts_in_dir ($dir[, @args])

Run all executable files in a given dir with the given command line arguments. Does not recurse into sub directories.

strip_ws ($string)

Remove leading and trailing white space.

touch ($file, $time)

Change the atime and mtime of file to $time or the current time if $time is not defined.


Randy Smith <>


 This file is part of vuser.
 vuser is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or
 (at your option) any later version.
 vuser is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with vuser; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA