Home About BC DR HA Support Training Download
You are here: Home/ GlobalSysAdmin/ AIX/ Please Login or Register

-
Current Location
-

js
  GlobalSysAdmin
    AIX
-
AIX Admin Methodology
Global Consolidation Project
All AIX admins should join
www.aixexpert.com


Join our LinkedIn Group
AIX Advanced Technical Experts
Contract Opportunities

www.LinkedIn.com

-
digg Digg this page
del.icio.us Post to del.icio.us
Slashdot Slashdot it!


LPAR Leasing
Lease an AIX / i5 LPAR
Reduce your costs

www.mtxia.com

Server Leasing
Lease a Server off-site
Reduce your costs

www.mtxia.com

Data Center Automation
Business Continuity and DR
Virtualization/Consolidation

www.mtxia.com

HMC Service
Hardware Management Console
Manage Remote AIX / i5 LPARs

www.siteox.com

Business Web Site Hosting
$3.99 / month includes Tools,
Shopping Cart, Site Builder

www.siteox.com

Disaster Recovery
Small Business Oriented
Off-Site Facilities

www.mtxia.com

IBM pSeries / iSeries
Reduce your Costs
Off-Site Server Hosting

www.mtxia.com



Program: mkuue

This script retrieves a list of files from a remote
host, uuencodes them, and builds a self extracting and
configuring script around the uuencoded file.

Usage: mkuue srcFile destFile fileAttributes

   srcFile = The name of the source file to uuencode

   destFile = The name of the destination file after
              it is uudecoded

   fileAttributes = This is "ls -l" output for the
             destination file after it is uudecoded. 
             This information is used to set attributes
             such as permissions, owner, group.

Author: Dana French (dfrench@mtxia.com)

"AutoContent" enabled


Description:

This utility creates a self extracting archive for a specified file. The self extracting archive contains a shell script that that knows how to test and reconfigure various attributes of the file, and the archive also contains a "uuencoded" copy of the file itself. The attributes tested and reconfigured by the self extracting archive include cksum, owner, group and permissions. This utility generates the shell script necessary to perform these tests and reconfigurations, uuencodes the specified file, and saves all of this to a single archive. This archive may be executed which causes the file to be extracted, installed, tested, and configured as the original file in its original location.

Assumptions:

It is assumed the source file exists and is not the same name as the destination file. The "uuencode" command is accessible in the PATH variable. The "cksum" command calculates a 32-bit Cyclic Redundancy Check (CRC) which is POSIX 1003.2 compliant. The execute permission bit for the archive files generated by this utility will be set.

Dependencies:

The self extracting archives generated by this utility will require the directories containing the "uudecode" and "cksum" commands to be in the PATH variable.

Documentation for this script is maintaned using the "AutoContent" utilities and requires the script be maintained according to those standards.

Products:

This utility generates a self extracting archive for any file. The archive will contain all the information necessary to install and configure the file to its original location. The file can be extracted, tested, installed and configured simply by executing the archive file.

Configured Usage:

This utility requires three command line arguments.

srcFile = The file to be archived

destFile = The name of the file after it is extracted from the archive.

fileAttributes = The file attributes of the destination file after it is extracted from the archive. The attributes should be in the form of "ls -l" output and should be enclosed in quotes on the command line so that they all appear as the 3rd command line argument.

Details:

When the "mkuue" script begins, the first thing it does is process the 3rd command line argument and extract the various file attributes for the destination file. The file owner and group can be easily extracted from the "ls -l" output, however the permissions require some processing.

The permission settings are contained within the first 10 characters of the "ls -l" output and are processed in 3 steps. The first character is the file type and is ignored, the next 3 characters are associated with the "user" or file owner permissions. The permissions are checked to see if the tacky bit or SUID bit is set. If so the appropriate permission setting is added to the permission string which will be used when the file is extracted.

The next set of 3 characters are associated with the "group" category of permissions. The permissions are checked to see if the tacky bit or SUID bit is set. If so the appropriate permission setting is added to the permission string which will be used when the file is extracted.

The last set of 3 characters are associated with the "other" category of permissions. Again, the permissions are checked to see if the tacky bit or SUID bit is set. If so the appropriate permission setting is added to the permission string which will be used when the file is extracted.

With the permission setting strings for each user category now known and extracted from the "ls -l" output, a mnemonic "exact setting" string is constructed for use with the "chmod" command during the archive extraction.

The checksum of the source file is obtained and saved so that it may be compared with the checksum of the destination file when the archive is extracted. The checksum is assumed to be a POSIX 1003.2 compliant 32-bit checksum Cyclic Redundancy Check (CRC).

A korn shell script is now created by "mkuue" which will contain the commands necessary to extract, test the cksum, and configure the file attributes of the destination file. This script is what has been referred to previously as the "self extracting archive". Each archive always checks to see if it is being executed by "root" as this is necessary to perform the "chown" commmand.

Within the script generated by mkuue, the script uudecodes itself, which will extract the uuencoded portion of the script to a temporary file location. The temporary file is then copied to the original source file name in preparation for the checksum.

During the execution of the self extracting archive, the original checksum is compared with the checksum of the newly extracted file. If they do not match, an error message is displayed and the script exits.

The script "mkuue" will now generate commands to cause the self extracting archive to copy the newly created and tested source file to the destination file name. If during the execution of the self extracting archive, the environment variable 'ALT_ROOT' is set, its value will be prepended to the destination file name. This allows self extracting archives to be extracted to alternate locations such as an 'alt_rootvg'. If the copy fails, an error message is displayed and the script exits.

Commands are generated to cause the self extracting archive to change the owner of the file to match the owner specified in the file attributes when the archive was created.

Similarly, commands are generated to cause the group setting of the file to be changed to match the group specified in the file attributes when the archive was created.

Finally, commands will be generated to cause the the self extracting archive to reset the permissions of the destination file according to permissions specified on the command line when the archive was created.

The commands necessary to extract the destination file from the archive are complete.

The source file will now be uuencoded and appended to the end of the self extracting archive script. The file name to which the archive will be initially extracted is a temporary file name, rather than the actual destination file name. This is so the "cksum"s can be compared and evaluated before replacing the existing file. If the cksums do not match, the existing file is NOT replaced, and an error message is issued.

The creation of the self extracting archive is now complete. The archive can be stored and saved for later use. It contains all the information it needs to extract, test, install, and configure the destination file it contains.

This file last modified 11/02/10

-
Self Extracting Archive
-
 

Self Extracting Archive


LPAR Leasing
Lease an AIX / i5 LPAR
Reduce your costs

www.mtxia.com

Server Leasing
Lease a Server off-site
Reduce your costs

www.mtxia.com

Data Center Automation
Business Continuity and DR
Virtualization/Consolidation

www.mtxia.com

HMC Service
Hardware Management Console
Manage Remote AIX / i5 LPARs

www.siteox.com

Business Web Site Hosting
$3.99 / month includes Tools,
Shopping Cart, Site Builder

www.siteox.com

FREE Domain Registration
included with Web Site Hosting
Tools, Social Networking, Blog

www.siteox.com

Disaster Recovery
Small Business Oriented
Off-Site Facilities

www.mtxia.com

IBM pSeries / iSeries
Reduce your Costs
Off-Site Server Hosting

www.mtxia.com