(imported topic written by SystemAdmin)
I am using the code from AIX Site to install software from an NFS Mount
I have added the code below. I have questions and hope that someone can help me with this. I have put my questions at the top and added comment lines with the question to help you get to the part of the script I have questions with.
I will be installing lsof from a mount point as an exercise. I would like to mount up server:/lsof and install below
lsof> ls
.toc lsof.base lsof.license lsof.man.en_US
Q1: What is download AIXProtocol://6100-00/6100-08.list used for in the TL update? Do I need to create a list for my lsof files? If yes I would need to know how to use it as well.
Q2: If I enter my repo info as server1:/lsof what will the mount point be? I wrote what I think below.
FixDir: pathname of parent folder of client folder of current site & "/__AIX_TEMP_lsof
NFSDir: pathname of parent folder of client folder of current site & "/__AIX_TEMP_lsof_NFS
Q3: Is the NFSDir my mount point?
mount -o ro {parameter “NFSSource” of action} “{parameter “NFSDir” of action}” => mount -o ro server1:/lsof pathname of parent folder of client folder of current site & "/__AIX_TEMP_lsof_NFS
Q4: I have a valid .toc file so I should pass the check for that
Q5: I don’t think I need this block of code since or if I do Q1 should help me with it
// Copying from windows to AIX can sometimes cause problems with new line / carriage return characters. Here we attempt to head off those issues and also remove any blank lines.
wait sh -c “sed -e 's/{”%0D"}//g’ “{(pathname of client folder of current site & “/__Download/” & (parameter “FixPack” of action) & “.list”)}” > “{(parameter “FixDir” of action & “/” & parameter “FixPack” of action)}”"
wait sh -c “sed -e /^$/d “{(parameter “FixDir” of action & “/” & parameter “FixPack” of action)}” > “{(parameter “FixDir” of action & “/” & parameter “FixPack” of action & “.tmp”)}””
delete “{(parameter “FixDir” of action & “/” & parameter “FixPack” of action)}”
move “{(parameter “FixDir” of action & “/” & parameter “FixPack” of action & “.tmp”)}” “{(parameter “FixDir” of action & “/” & parameter “FixPack” of action)}”
Q6: I won’t need the following since the OS level will not change:
// Update oslevel.txt
wait rm -rf “{pathname of (parent folder of client folder of current site) as string & “/__OSLevel”}”
wait mkdir “{pathname of (parent folder of (client folder of current site)) & “/__OSLevel”}”
wait sh “oslevel -r > ‘{pathname of (parent folder of client folder of current site) as string & “/__OSLevel/oslevel.txt”}’”
wait sh “oslevel -s >> ‘{pathname of (parent folder of client folder of current site) as string & “/__OSLevel/oslevel.txt”}’”
action requires restart
download AIXProtocol://6100-00/6100-08.list
parameter “FixPack”=“lsof”
parameter “FixDir”="{pathname of parent folder of client folder of current site & “/_AIX_TEMP” & parameter “FixPack” of action}"
parameter “NFSDir”="{pathname of parent folder of client folder of current site & “/_AIX_TEMP” & parameter “FixPack” of action & “_NFS”}"
action parameter query “NFSSource” with description “Full path to NFS repository (e.g. myServer:%22/AIX/fileset repo%22 myServer:/Local/Repo)”
// Setup Directories
wait rm -rf “{parameter “FixDir” of action}”
wait mkdir -p “{parameter “FixDir” of action}”
wait rm -rf “{parameter “NFSDir” of action}”
wait mkdir -p “{parameter “NFSDir” of action}”
// Save original NFS settings
wait sh -c “nfso -o nfs_use_reserved_ports | awk ‘{{print $NF}’ > “{(parameter “FixDir” of action) & “/nfs_use_reserved_ports”}””
wait sh -c “nfso -o portcheck | awk ‘{{print $NF}’ > “{(parameter “FixDir” of action) & “/portcheck”}””
// Set portcheck and nfs_use_reserved_ports to 1
wait nfso -o nfs_use_reserved_ports=1
wait nfso -o portcheck=1
// Mount NFS Source
createfile until __EOF
mount -o ro {parameter “NFSSource” of action} “{parameter “NFSDir” of action}”
__EOF
delete “{parameter “FixDir” of action & “/mountNFS.sh”}”
move __createfile “{parameter “FixDir” of action & “/mountNFS.sh”}”
wait chmod +x “{parameter “FixDir” of action & “/mountNFS.sh”}”
wait sh “{parameter “FixDir” of action & “/mountNFS.sh”}”
delete “{parameter “FixDir” of action & “/mountNFS.sh”}”
// If the mount failed or no .toc file is found, perform cleanup tasks and quit action Q4
if { (NOT (exists filesystem whose (name of it is (parameter “NFSDir” of action)))) OR (NOT (exists file “.toc” of folder (parameter “NFSDir” of action))) }
wait umount “{parameter “NFSDir” of action}”
wait sh -c “nfso -o nfs_use_reserved_ports={line 1 of file (parameter “FixDir” of action & “/nfs_use_reserved_ports”)}”
wait sh -c “nfso -o portcheck={line 1 of file (parameter “FixDir” of action & “/portcheck”)}”
wait rm -rf “{parameter “FixDir” of action}”
wait rm -rf “{parameter “NFSDir” of action}”
continue if {false}
endif
// Extract list of files from .toc file in NFS source
delete “{(parameter “FixDir” of action & “/_tocFile.list”)}”
wait sh -c “awk '{{ if (/{{$/) {{ printf(”\n%s:", $1) >> “{ (parameter “FixDir” of action & “/_tocFile.list”) }” } else if (/^(
http://A-z.0-9_+
|-)+[
:space:]
0-9
{{2}.
0-9
{{2}.
0-9
{{4}.
0-9
{{4}[
:space:]
/) {{ printf(" %s %s", $1, $2) >> “{(parameter “FixDir” of action & “/_tocFile.list”)}” } }’ “{(pathname of file “.toc” of folder (parameter “NFSDir” of action))}”"
// Q5 Copying from windows to AIX can sometimes cause problems with new line / carriage return characters. Here we attempt to head off those issues and also remove any blank lines.
wait sh -c “sed -e 's/{”%0D"}//g’ “{(pathname of client folder of current site & “/__Download/” & (parameter “FixPack” of action) & “.list”)}” > “{(parameter “FixDir” of action & “/” & parameter “FixPack” of action)}”"
wait sh -c “sed -e /^$/d “{(parameter “FixDir” of action & “/” & parameter “FixPack” of action)}” > “{(parameter “FixDir” of action & “/” & parameter “FixPack” of action & “.tmp”)}””
delete “{(parameter “FixDir” of action & “/” & parameter “FixPack” of action)}”
move “{(parameter “FixDir” of action & “/” & parameter “FixPack” of action & “.tmp”)}” “{(parameter “FixDir” of action & “/” & parameter “FixPack” of action)}”
// Create symbolic links to fileset packages
createfile until __EOF
for srcFile in fgrep -f "{(parameter "FixDir" of action & "/" & parameter "FixPack" of action)}" "{(parameter "FixDir" of action & "/_tocFile.list")}" | cut -d: -f1
; do
ln -s “{parameter “NFSDir” of action}/$srcFile” “{parameter “FixDir” of action}/”
done
__EOF
delete “{parameter “FixDir” of action & “/mklinks.sh”}”
move __createfile “{parameter “FixDir” of action & “/mklinks.sh”}”
wait chmod +x “{parameter “FixDir” of action & “/mklinks.sh”}”
wait sh “{parameter “FixDir” of action & “/mklinks.sh”}”
delete “{parameter “FixDir” of action & “/mklinks.sh”}”
// Build toc file
wait inutoc “{parameter “FixDir” of action}”
// Create current fileset list
wait sh -c “lslpp -lJq > “{parameter “FixDir” of action & “/_currentFileset.list”}””
// Perform install
delete /var/adm/ras/install_all_updates.log
wait sh -c “LANG=C geninstall -e “/var/adm/ras/install_all_updates_{parameter “FixPack” of action}.log” -Z -I “agqXY” -d “{parameter “FixDir” of action}/” -f “{parameter “FixDir” of action & “/_currentFileset.list”}””
// Sometimes, when skipping Technology Levels, new filesets are installed (eg: Java6.sdk). When this happens, the updated / patched
// version may not be installed on the first pass. Here we try to catch those instances and take care of them.
delete “{parameter “FixDir” of action & “/missing.list”}”
createfile until __EOF
for LEVEL in instfix -i | grep "Not all filesets for 61" | awk '{{print $5}'
; do
instfix -ciqk $LEVEL | grep :-: | cut -d: -f2
done >> “{parameter “FixDir” of action & “/missing.list”}”
__EOF
delete “{parameter “FixDir” of action & “/chk_missing.sh”}”
move __createfile “{parameter “FixDir” of action & “/chk_missing.sh”}”
wait chmod +x “{parameter “FixDir” of action & “/chk_missing.sh”}”
wait sh “{parameter “FixDir” of action & “/chk_missing.sh”}”
delete “{parameter “FixDir” of action & “/chk_missing.sh”}”
if { exists file (parameter “FixDir” of action & “/missing.list”) whose (exists line 1 of it) }
wait sh -c “cat “{parameter “FixDir” of action & “/missing.list”}” | uniq > “{parameter “FixDir” of action & “/unique_missing.list”}””
wait sh -c “LANG=C geninstall -e “/var/adm/ras/install_all_updates_missing_{parameter “FixPack” of action}.log” -Z -I “agqXY” -d “{parameter “FixDir” of action}/” -f “{parameter “FixDir” of action & “/unique_missing.list”}””
endif
// Clean up
wait umount “{parameter “NFSDir” of action}”
wait sh -c “nfso -o nfs_use_reserved_ports={line 1 of file (parameter “FixDir” of action & “/nfs_use_reserved_ports”)}”
wait sh -c “nfso -o portcheck={line 1 of file (parameter “FixDir” of action & “/portcheck”)}”
wait rm -rf “{parameter “FixDir” of action}”
wait rm -rf “{parameter “NFSDir” of action}”
// copy log file for result analysis
// Create __MLPkgInstall directory if necessary
wait mkdir “{if (exists folder ((pathname of (parent folder of client folder of current site) as string) & “/__MLPkgInstall”)) then “” else ((pathname of (parent folder of client folder of current site) as string) & “/__MLPkgInstall”)}”
delete “{(pathname of (parent folder of client folder of current site) as string) & “/__MLPkgInstall/TL_SP_CSP.result”}”
copy “/var/adm/ras/install_all_updates_{parameter “FixPack” of action}.log” “{(pathname of (parent folder of client folder of current site) as string) & “/__MLPkgInstall/TL_SP_CSP.result”}”
// Update oslevel.txt
wait rm -rf “{pathname of (parent folder of client folder of current site) as string & “/__OSLevel”}”
wait mkdir “{pathname of (parent folder of (client folder of current site)) & “/__OSLevel”}”
wait sh “oslevel -r > ‘{pathname of (parent folder of client folder of current site) as string & “/__OSLevel/oslevel.txt”}’”
wait sh “oslevel -s >> ‘{pathname of (parent folder of client folder of current site) as string & “/__OSLevel/oslevel.txt”}’”
action requires restart