home *** CD-ROM | disk | FTP | other *** search
- # host rpcprofile setup tcl script
- # must be logged in as cell_admin to execute
- # example: dcecp setprofile.tcl hostname
- #
-
- if {($argc != 2) && ($argc != 1)} {
- puts stdout " "
- puts stdout "Usage: <fullhostname> slim (if host is a slim client)"
- exit
- }
- set hostname [lindex $argv 0]
-
- # ********** setup slim client profile directory ***********************
-
- if {$argc == 2 } {
- set slimarg [lindex $argv 1]
- if ![string match slim $slimarg] {
- puts stdout " "
- puts stdout "Invalid usage of second argument"
- puts stdout "Usage: <fullhostname> slim (if host is a slim client)"
- exit
- }
- puts stdout " "
- puts stdout "Enter the LAN profile for slim client $hostname"
- set profilename [gets stdin]
- set profilename /.:/$profilename
- set status [catch {directory list /.:/slim.hosts} dirlist]
- if {$status == 0} {
- if {[string match "*$hostname*" "$dirlist"]} {
- puts stdout "The directory structure /.:/slim.hosts/$hostname already exists"
- } else {
- puts stdout " "
- puts stdout "Creating directory structure for slim.hosts $hostname"
- directory create /.:/slim.hosts/$hostname
- }
- } else {
- puts stdout " "
- puts stdout "Creating directory structure for slim client $hostname"
- directory create /.:/slim.hosts
- directory create /.:/slim.hosts/$hostname
- }
- set status [catch {rpcprofile show /.:/slim.hosts/$hostname/profile -i 6f264242-b9f8-11c9-ad31-08002b0dc035,1.0} profile]
- if {$status == 0} {
- puts stdout " "
- puts stdout "Slim client $hostname already has a pointer to the following LAN profile(s)"
- puts stdout "$profile"
- puts stdout " "
- puts stdout "Do you want to overright it, y or n"
- set overright [gets stdin]
- while {(($overright != "y") && ($overright != "n"))} {
- puts stdout " "
- puts stdout "ERROR invalid entry type y or n"
- set overright [gets stdin]
- }
- if {$overright == "y"} {
- catch {rpcprofile list /.:/slim.hosts/$hostname/profile} profiles
- foreach e [lrange $profiles 0 end] {
- catch {rpcprofile remove \
- -i 6f264242-b9f8-11c9-ad31-08002b0dc035,1.0 \
- -m $e \
- /.:/slim.hosts/$hostname/profile }
- }
- }
- }
- if {($status != 0) || ($overright == "y")} {
- puts stdout " "
- puts stdout "Creating a pointer to $profilename for slim client $hostname"
- set status [catch {rpcprofile add -a LAN \
- -i 6f264242-b9f8-11c9-ad31-08002b0dc035,1.0 \
- -m $profilename \
- -p 0 \
- /.:/slim.hosts/$hostname/profile \
- } msg]
- if {$status == 0} {
- puts stdout " "
- puts stdout "A pointer to $profilename for slim client $hostname was added"
- } else {
- puts stdout "ERROR: $msg"
- }
- }
- } else {
- # **************** Gets Host Profile Name *****************************
- set hostfound ""
- foreach i [directory list /.:/hosts] {
- if {[string match "*$hostname*" "$i"]} {
- set hostfound "true"
- set proflist [rpcprofile list $i/profile]
- }
- }
- if {$hostfound != "true"} {
- puts stdout " "
- puts stdout "ERROR bad host name"
- puts stdout "Usage: <fullhostname> slim (if host is a slim client)"
- exit
- }
- foreach p [lrange $proflist 0 end ] {
- if !([regexp "cell-profile" $p]) {
- set profilename $p
- }
- }
- if {$profilename == ""} {
- puts stdout " "
- puts stdout "ERROR no host profile for $hostname"
- exit
- }
- puts stdout " "
- puts stdout "LAN profile for $hostname is $profilename"
- }
- # *************** Get List of Security Servers ***********************
- set svrlist [rpcgroup list /.:/sec]
- set master [rpcgroup list /.:/sec-v1]
- puts stdout " "
- puts stdout "The master security server is $master"
- puts stdout " "
- puts stdout "The avaliable security servers are:"
- puts stdout "$svrlist"
- puts stdout " "
- set i 0
- set proplist ""
- foreach s [lrange $svrlist 0 end] {
- puts stdout "Enter priority for $s (0-7)"
- set priority [gets stdin]
- while {(($priority < "0") || ($priority > "7"))} {
- puts stdout " "
- puts stdout "ERROR priority out of range Enter (0-7)"
- set priority [gets stdin]
- }
- # *************** add rpcprofile to host profile *********************
- puts stdout " "
- puts stdout "Enter y to add priority $priority for $s "
- puts stdout "to your $profilename or enter q to quit"
- set responce [gets stdin]
- while {(($responce != "y") && ($responce != "q"))} {
- puts stdout " "
- puts stdout "ERROR invalid entry type y or q"
- set responce [gets stdin]
- }
- if {$responce == "y"} {
- set status [catch {rpcprofile add -a rs_bind -i d46113d0-a848-11cb-b863-08001e046aa5,2.0 -m $s -p $priority $profilename} msg]
- if {$status == 1} {
- puts stdout "ERROR: $msg"
- }
-
- } else {
- puts stdout "You have asked to quit, so long"
- exit
- }
- }
- set st [rpcprofile show "$profilename"]
- puts stdout " "
- puts stdout "The current profile for $profilename is"
- puts stdout "$st"
- exit
-