|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibm.jsdt.common.Base
com.ibm.jsdt.support.deploymenthelper.DeploymentHelper
com.ibm.jsdt.support.deploymenthelper.LinuxDeploymentHelper
public class LinuxDeploymentHelper
Linux specific helper functionality.
Field Summary | |
---|---|
protected static java.lang.String |
filePath
File that indicates the current version of the Linux OS. |
protected static java.lang.String |
searchString
String that represents the version of Linux on the target computer. |
static java.lang.String |
sNEWLN
System-independent line separator. |
protected static int |
startIndex
Index where the file start to search. |
Fields inherited from class com.ibm.jsdt.support.deploymenthelper.DeploymentHelper |
---|
DEPLOYER_SPECIFICATION_VERSION_KEY, ENTRY_STAGE, EXIT_STAGE, FAILURE, ISMP_GLOBAL_PROPERTY, ISMP_PRODUCT_PROPERTY, ISMP_WIZARD_PROPERTY, MAIN_STAGE, PDC_CANCEL_INSTALL, PDC_DO_NOT_INSTALL, PDC_DOES_NOT_EXIST, PDC_EXISTS, resourceBundle, SELECTED_TASK_NAMES_KEY, SUCCESS, VERSIONCHECKER_STAGE, VPD_INSTALL_LOCATION_PIPE, VPD_VERSION_PIPE |
Fields inherited from class com.ibm.jsdt.common.Base |
---|
NEW_LINE, OS_NAME, SLASH |
Constructor Summary | |
---|---|
LinuxDeploymentHelper()
Sole constructor. |
Method Summary | |
---|---|
static boolean |
addUserToGroup(java.lang.String groupName,
java.lang.String userName)
Adds a user to a group. |
static void |
chmodDirPermissions(java.lang.String path,
java.lang.String chmodValue)
Changes the permissions on a folder. |
static void |
chmodFilePermissions(java.lang.String fileName,
java.lang.String chmodValue)
Changes the permissions on a file. |
static boolean |
createGroup(java.lang.String groupName)
Creates a new user ID group. |
static boolean |
createLinuxUser(java.lang.String userName,
java.lang.String password)
Creates a new user ID using the Linux system's native password hashing/encryption algorithm and creates the /home/ |
static boolean |
createUser(java.lang.String userName,
java.lang.String password,
java.lang.String groupName)
Creates a new user ID and assign it to the group. |
static boolean |
doesGroupExist(java.lang.String groupName)
Verifies the existence of a user group. |
static boolean |
doesUserExist(java.lang.String userName)
Verifies the existence of a user ID. |
static int |
doUserAdd(java.lang.String compareVersion,
java.lang.String userName,
java.lang.String password)
Deprecated. Use createLinuxUser instead Example command: useradd -m -d /home/db2inst2 -p encPwd db2inst2
This method can only be called with local deployments
or on remote computers running IBM Installation Agents
with a specification version of 2.1.1.0 or later.
If a down-level agent is encountered, a value of
|
static java.lang.String |
getDeviceNameFromMountPoint(java.lang.String path)
Gets the device name, given a mount point on Linux. |
static int |
isAllRPMsInstalled(java.lang.Object[] RPMArray)
Inclusively checks for a set of RPMs. |
static int |
isAnyRPMsInstalled(java.lang.Object[] RPMArray)
Noninclusively checks for a set of RPMs. |
static boolean |
isIntelBasedLinux()
Indicates whether the current architecture is Intel-based Linux. |
static boolean |
isPowerLinux()
Indicates whether the current architecture is Linux on POWER. |
static boolean |
isRHEL4()
Determines if the target computer is running Red Hat Enterprise Linux release 4. |
static boolean |
isRHEL5()
Determines if the target computer is running Red Hat Enterprise Linux release 5. |
static boolean |
isRootUser()
Verify that current user is the root user. |
static boolean |
isRpmInstalled(java.lang.String rpmPackage)
Checks to see if a specific RPM package is installed. |
static boolean |
isSLES10()
Determines if the target computer is running SUSE Linux Enterprise Server 10 |
static boolean |
isSLES9()
Determines if the target computer is running SUSE Linux Enterprise Server 9 |
static boolean |
isUserAndPasswordValid(java.lang.String userName,
java.lang.String password)
Verifies that the given user and password are valid. |
static boolean |
isZ_Linux()
Indicates whether or not this is a zLinux platform. |
static boolean |
isZ_Linux32()
Indicates whether or not this is a zLinux 32 bit platform. |
static boolean |
isZ_Linux64()
Indicates whether or not this is a zLinux 64 bit platform. |
static int |
runCommandAsUser(java.lang.String userId,
java.lang.String password,
java.lang.String command)
Runs the command on the local computer as the specified user. |
static int |
runCommandAsUser(java.lang.String userId,
java.lang.String password,
java.lang.String command,
boolean shouldLogOutput)
Runs the command on the local computer as the specified user. |
Methods inherited from class com.ibm.jsdt.common.Base |
---|
getBuildPropertiesAccessor, getFullVersion, getMainResources, getResourceString, getResourceString, getResourceString, getResourceString, getResourceString, getResourceStringArray, getResourceStringArray, showBuildProperties, showFullVersion |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String sNEWLN
protected static java.lang.String filePath
protected static java.lang.String searchString
For example: "SUSE LINUX Enterprise Server 10"
protected static int startIndex
Constructor Detail |
---|
public LinuxDeploymentHelper()
Method Detail |
---|
public static boolean doesUserExist(java.lang.String userName)
userName
- - user name to verify
Boolean
value oftrue
if username is found
false
if username is not foundpublic static boolean createUser(java.lang.String userName, java.lang.String password, java.lang.String groupName)
userName
- - a user namepassword
- - a passwordgroupName
- - a group name
Boolean
value oftrue
if user ID is successfully created
false
all elsepublic static boolean createLinuxUser(java.lang.String userName, java.lang.String password)
userName
- - a user namepassword
- - a password
Boolean
value oftrue
if user ID is successfully created
false
all elsepublic static boolean doesGroupExist(java.lang.String groupName)
groupName
- - a group name
Boolean
value oftrue
if group name is found
false
if group name is not foundpublic static boolean createGroup(java.lang.String groupName)
groupName
- - a group name
Boolean
value oftrue
if group is created
false
otherwisepublic static boolean addUserToGroup(java.lang.String groupName, java.lang.String userName)
groupName
- - a Linux group nameuserName
- - a user name
boolean
true
if user name is added to group successfully
false
otherwisepublic static int isAllRPMsInstalled(java.lang.Object[] RPMArray)
Do not use suffixes on the RPM name, such as ".i386.rpm".
For example, the RPM file db2rte71-7.1.0-0.i386.rpm would have the following valid names:
db2rte71 and db2rte71-7.1.0-0
The following names would not be valid:
db2rte71-7.1.0-0.i386 and db2rte71-7.1.0-0.i386.rpm
RPMArray
- - an Objects[]
array of RPM package names
int
as follows:public static int isAnyRPMsInstalled(java.lang.Object[] RPMArray)
Do not use suffixes on the RPM name, such as ".i386.rpm".
For example, the RPM file db2rte71-7.1.0-0.i386.rpm would have the following valid names:
db2rte71 and db2rte71-7.1.0-0
And the following names would not be valid:
db2rte71-7.1.0-0.i386 and db2rte71-7.1.0-0.i386.rpm
RPMArray
- - an array of RPM package names
int
as followspublic static boolean isRpmInstalled(java.lang.String rpmPackage)
rpmPackage
- - an RPM package name
Boolean
value oftrue
if the RPM is installed
false
otherwisepublic static void chmodDirPermissions(java.lang.String path, java.lang.String chmodValue)
path
- - directory on which to set the access permissionchmodValue
- - chmod value indicating the permission level to set on the folderpublic static void chmodFilePermissions(java.lang.String fileName, java.lang.String chmodValue)
fileName
- - a file name on which to set the access permissionchmodValue
- - chmod value indicating the permission level to set on the filepublic static boolean isRootUser()
Boolean
value oftrue
if the current user is a root user.
false
if the current user
is not a root user, or if an error occurred while detecting the current user level.public static boolean isUserAndPasswordValid(java.lang.String userName, java.lang.String password)
This will not work with releases prior to IR 2.1.0.0 and
IIA "agent version" prior to 3.1.0.0 . A value
of true
is returned when run
on a back level IIA.
This method works for shadow passwords and the older, less secure UNIX password storage mechanism. Note: If the target machine uses DES password encryption, it is possible that a password match could occur even if the passwords do not completely match. This is a limitation of DES encryption. DES only matches the first 8 characters. For examples, if the root password is "passw0rd", "passw0rd1" will be accepted because the first 8 characters match. A machine with DES password encryption would accept "password1" as a valid root password.
userName
- - a user namepassword
- - a user password
Boolean
value oftrue
if the user name and password are valid
false
if the user name and password are not validpublic static boolean isIntelBasedLinux()
Boolean
value of true
if architecture is Intel-based Linux
false
if architecture is not an Intel-based Linux public static boolean isPowerLinux()
boolean
true
if architecture is Linux on POWER
false
if architecture is Linux on POWERpublic static int doUserAdd(java.lang.String compareVersion, java.lang.String userName, java.lang.String password)
Example command: useradd -m -d /home/db2inst2 -p encPwd db2inst2
This method can only be called with local deployments
or on remote computers running IBM Installation Agents
with a specification version of 2.1.1.0 or later.
If a down-level agent is encountered, a value of
Integer.MIN_VALUE
(-2147483648) is returned.
compareVersion
- - version to be compared with the current Linux OSuserName
- - a user name to be verifiedpassword
- - a user password.
int
the return code from the useradd
call.public static java.lang.String getDeviceNameFromMountPoint(java.lang.String path)
path
- - a mount point path
String
public static boolean isRHEL4()
Boolean
value oftrue
if target computer is running Red Hat Enterprise Linux release 4
false
if target computer is not running Linux Red Hat Enterprise Linux release 4public static boolean isSLES9()
Boolean
value oftrue
if target computer is running SUSE Linux Enterprise Server 9
false
if target computer is not running SUSE Linux Enterprise Server 9public static boolean isSLES10()
boolean
value oftrue
if target computer is running SUSE Linux Enterprise Server 10
false
if target computer is not running SUSE Linux Enterprise Server 10public static boolean isRHEL5()
boolean
value oftrue
if target computer is running Red Hat Enterprise Linux release 5
false
if target computer is not running Red Hat Enterprise Linux release 5public static int runCommandAsUser(java.lang.String userId, java.lang.String password, java.lang.String command)
code
- String userIdcode
- String passwordcode
- String command
int
the return code of the command.public static int runCommandAsUser(java.lang.String userId, java.lang.String password, java.lang.String command, boolean shouldLogOutput)
code
- String userIdcode
- String passwordcode
- String commandcode
- boolean turn command output logging on/off
int
the return code of the command.public static boolean isZ_Linux()
true
if this is a zLinux platform.public static boolean isZ_Linux64()
true
if this is a zLinux 64 bit platform.public static boolean isZ_Linux32()
true
if this is a zLinux 32 bit platform.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |