]> git.entuzijast.net Git - imunes.git/commitdiff
prilagodjen popup meni za otvaranje terminala OpenVZ logici i
authorKosta Pribić <kosta.pribic@gmail.com>
Fri, 4 Sep 2009 22:51:33 +0000 (00:51 +0200)
committerKosta Pribić <kosta.pribic@gmail.com>
Fri, 4 Sep 2009 22:51:33 +0000 (00:51 +0200)
popravljena detekcija shell-a za hostove

editor.tcl
linux/host.tcl

index f69d112e148ef69ef9a42a297e061a349d88002d..60a6dc76e0143453ec98af2e6afe73a5b0e5164e 100755 (executable)
@@ -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"
index 9cf1813ef70f64ea25fe08047abffb03a0da570b..e1aa36ca8c81f24aa9d3933d635e34a434747de6 100755 (executable)
@@ -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"
        }
     }