Previous Contents Index Next |
Setup Util Programmer's Guide |
Chapter 22 Ux-util.h Library Reference
This chapter describes ux-util.h, the library containing various UNIX utility functions used during installation. It contains the following sections:
extern const char *INSTALL_TYPE;
extern const char *EXPRESS_TYPE;
extern const char *TYPICAL_TYPE;
extern const char *CUSTOM_TYPE;
Package Type
typedef enum {Normal=0, Update=1, Patch=2} PackageType;
Install Log Error Levels
extern const char *FATAL;
These are for those who use C as well as C++.
getDefaultLdapInfo
Given a server root, get the default LDAP information.
extern void getDefaultLdapInfo (const char *sroot, char **ldapURL,
char **ldapUser, char **installDN);
Refer to the C++ sections for more explanations
extern Bool portAvailable(int port);
extern int availUser(const char *user);
extern int availGroup(const char *user, const char *group);
extern char *getDefaultHostName(const char *sroot);
extern char *getDefaultUser(const char *sroot);
extern char *getDefaultGroup(const char *sroot);
extern char *getCurrentDir(void);
extern Bool dirWritable(const char *dirName);
extern int createDirectory(const char *dirName, int mode);
extern Bool fileExists(const char *fileName);
extern Bool dirExists(const char *dirName);
extern Bool isServerRoot(const char *directoryName);
extern Bool isLegacyServerRoot (const char *dirName);
extern int execProgram(const char *program, const char *where);
InstallLog Definition
typedef void * InstallLog;
createInstallLog
Creates a silent installation logfile.
InstallLog *createInstallLog(const char *fileName);
logMessage
Logs a string to the logfile.
void logMessage(InstallLog *, const char *level, const char *who,
const char *msg, ...);
InstUtil
Class definition for C++ installation utilities.
InstUtil::guessHostname
Try to guess the fully qualified domain name (FQDN) of this host.
static NSString guessHostname();
InstUtil::guessDomain
Try to guess the domain name portion of this host.
static NSString guessDomain();
InstUtil::guessPort
Randomly select an available port.
InstUtil::portAvailable
Determine whether the given port is available
static Bool portAvailable(int port);
InstUtil::availUser
Given a UNIX user ID, determine whether the user is available. Takes the following input:
UNIX user ID Returns one of the following:
static int availUser(const char *user);
InstUtil::availGroup
Given a user ID and a group, determine whether the combination is OK.
0: group is OK static int availGroup (const char *user, const char *group);
InstUtil::getSysVersion
Gets the version of the current OS, in the form of OSversion.release For example, SunOS5.5.
static NSString getSysVersion();
InstUtil::getDefaultHostName
Given a server root, gets the configured FQDN of this machine.
static NSString getDefaultHostName(const char *sroot);
InstUtil::getHostIpAddress
Given a host name, gets the associated IP address.
static NSString getHostIpAddress(const char *hostName);
InstUtil::getDefaultUser
Given a server root, gets the configured UNIX user ID. This ID is used to run servers.
static NSString getDefaultUser(const char *sroot);
InstUtil::getDefaultGroup
Given a server root, gets the configured UNIX group. This group is used to run servers.
static NSString getDefaultGroup (const char *sroot);
InstUtil::getAdmPwd
Given a server root, gets the Administrator's password. This password is used to authenticate to the Directory Server. Takes the following inputs:
server root Has the following outputs:
Administrator's password Returns the following:
Administrator's password (allocated) static NSString getAdmPwd(const char *sroot);
InstUtil::isSelfRootUser()
Checks if current login ID is root of the running process.
InstUtil::getSelfUserID()
Gets the (effective) login ID of the running process.
static NSString getSelfUserID();
InstUtil::getSelfGroupID()
Gets the (effective) group ID of the running process.
static NSString getSelfGroupID();
InstUtil::getCurrentDir
Gets the current working directory.
static NSString getCurrentDir(void);
InstUtil::dirWritable
Given a full path of a directory, check that the directory exists and is writable.
static Bool dirWritable(const char *dirName);
InstUtil::dirName
Gets the directory portion of a filename.
static NSString dirName(const char *path);
InstUtil::fileName
Gets the file portion of a filename.
static NSString fileName(const char *path);
InstUtil::createDirectory
Given a full path of a directory, creates it.
static int createDirectory(const char *dirName, int mode);
InstUtil::fileExists
Determines if the given filename exists. If only a directory is given, fileExists determines whether it exists.
static Bool fileExists(const char *fileName);
InstUtil::dirExists
Determines if the given directory exists. If a filename is also given, dirExists only determines whether the directory exists.
static Bool dirExists(const char *dirName);
InstUtil::copyFile
Copies a file.
static int copyFile(const char *dest, const char *src);
InstUtil::dirEmpty
Determines whether a directory is empty.
static Bool dirEmpty(const char *dirName);
InstUtil::isServerRoot
Tries to guess whether the given directory is a 4.0 server root.
static Bool isServerRoot(const char *directory);
InstUtil::isLegacyServerRoot
Detects whether the directory is a pre-4.0 server root.
static Bool isLegacyServerRoot(const char *directory);
InstUtil::execProgram
Executes the given program. Takes the following inputs:
execProgram will return to the current directory after execution.
static int execProgram(const char *program, const char *where = 0);
Previous Contents Index Next
Copyright (C) 2005 Red Hat, Inc. All rights reserved.
This material may be distributed only subject to the terms and conditions set forth in the Open Publication License, v1.0 or later (the latest version is presently available at http://www.opencontent.org/openpub/
Last Updated September 21, 2001