[Gambas-user] Shell sudo
M. Cs.
mohareve at ...626...
Fri Dec 25 11:01:15 CET 2009
I've found a better solution: I've created a module file with a process.
This can be triggered from within the main program.
' Gambas module file
PUBLIC hProcess AS Process
PUBLIC wins AS Form
PUBLIC szoveg1 AS TextBox
PUBLIC SUB ReadPassword()
DIM black AS Button
wins = NEW Form
wins.Width = 150
wins.Height = 300
black = NEW Button(wins)
black.Width = 100
black.Height = 25
black.X = 25
black.Y = 150
Object.Attach(black, ME, "runty")
szoveg1 = NEW TextBox(wins)
szoveg1.Width = 100
szoveg1.Height = 25
szoveg1.X = 25
szoveg1.Y = 120
szoveg1.Password = TRUE
wins.Center
wins.Show()
hProcess = SHELL "sudo 'apt-get install PACKAGE'" FOR INPUT OUTPUT
END
PUBLIC SUB runty_Click()
PRINT #hProcess, szoveg1.Text
wins.Delete()
END
'
PUBLIC SUB Process_read()
DIM sOutput AS String
LINE INPUT #LAST, sOutput
PRINT sOutput
END
The only problem is, that I'm trying to create an universal solution, which
is distro independent. But it seems nearly impossible to do, since there are
a conflict between su and sudo commands, or their acceptance by the
different distributions.
More information about the User
mailing list