From 414b71beb169b6a031ade0c378efd029ce915242 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kosta=20Pribi=C4=87?= Date: Sat, 5 Sep 2009 00:51:33 +0200 Subject: [PATCH] prilagodjen popup meni za otvaranje terminala OpenVZ logici i popravljena detekcija shell-a za hostove --- editor.tcl | 23 +++++++++++++++++++---- linux/host.tcl | 8 +++++++- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/editor.tcl b/editor.tcl index f69d112..60a6dc7 100755 --- a/editor.tcl +++ b/editor.tcl @@ -1053,6 +1053,8 @@ proc button3node { c x y } { 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] @@ -1205,12 +1207,25 @@ proc button3node { c x y } { .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 @@ -1292,7 +1307,7 @@ proc spawnShell { node cmd } { 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" diff --git a/linux/host.tcl b/linux/host.tcl index 9cf1813..e1aa36c 100755 --- a/linux/host.tcl +++ b/linux/host.tcl @@ -161,13 +161,19 @@ proc $MODULE.bootcmd { node } { 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" } } -- 2.39.5