upvar 0 ::cf::[set ::curcfg]::oper_mode oper_mode
upvar 0 ::cf::[set ::curcfg]::eid eid
+ global gui_freebsd gui_linux
+
set node [lindex [$c gettags {node && current}] 1]
if { $node == "" } {
set node [lindex [$c gettags {nodelabel && current}] 1]
.button3menu add cascade -label "Shell window" \
-menu .button3menu.shell
set cmd [[typemodel $node].shellcmd $node]
- if { $cmd != "/bin/sh" && $cmd != "" } {
+
+ # OpenVZ radi na principu ulaska u VE, nema pokretanja shell-a
+ if { $cmd != "/bin/sh" && $cmd != "" && $gui_freebsd } {
.button3menu.shell add command -label "$cmd" \
-command "spawnShell $node $cmd"
}
- .button3menu.shell add command -label "/bin/sh" \
- -command "spawnShell $node /bin/sh"
+
+ # namjestanje labele da lijepo izgleda
+ if { $gui_linux } {
+ set label "Enter VE (bash)"
+ set shellCommand "enter"
+ } else {
+ set label "/bin/sh"
+ set shellCommand "/bin/sh"
+ }
+
+ #kljucna rijec enter oznacava ulazak u OpenVZ VE
+ .button3menu.shell add command -label $label \
+ -command "spawnShell $node $shellCommand"
} else {
.button3menu add cascade -label "Shell window" \
-menu .button3menu.shell -state disabled
if { $gui_freebsd } {
set shellcommand "vimage $node_id $cmd"
} elseif { $gui_linux } {
- if { $cmd == "/bin/sh" } {
+ if { $cmd == "enter" } {
set shellcommand "vzctl enter $node"
} else {
set shellcommand "vzctl exec $node $cmd"
proc $MODULE.shellcmd { node } {
set ret [nexec whereis -b bash]
- if { [llength $ret] == 2 } {
+ # OpenVZ, $ret ce biti bash: /bin/bash /etc/bash.bashrc
+ # duljina je uvijek 3
+
+ if { [llength $ret] == 3 } {
+ puts " >>>>>> nasao sam [lindex $ret 1]"
return [lindex $ret 1]
} else {
set ret [nexec whereis -b tcsh]
if { [llength $ret] == 2 } {
+ puts " >>>>>> nasao sam [lindex $ret 1]"
return [lindex $ret 1]
} else {
+ puts " >>>>>> nasao sam /bin/sh"
return "/bin/sh"
}
}