Thanks, Les -- I had this same problem, and you solved it for me. For other
readers, here is the command adapted for Gambas3:
Shell "sudo -S chmod 0777 ~/myfilename << EOF\nmypassword\nEOF"
Note: "chmod 0777" is just an example of a chmod code
The newline code "\n" should NOT have spaces be
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
sudo allows you to pass a password to the shell with -S
The following should do it.
sudo -S apt-get install PACKAGENAME << EOF
PASSWORD
EOF
Regards
Les Hardy
M. Cs. wrote:
> I'd like to make my app able to download and install packages via apt-get
> (or any other command-line package manager)
I've been writing the command I want to execute as root ("apt-get
install package") to a temporary file (e.g. /tmp/install.package),
making it executable (chmod +x) then using
SHELL "gksu sh /tmp/install.package"
which prompts the user for the password. Its probably not the best
way, but its quit
I'd like to make my app able to download and install packages via apt-get
(or any other command-line package manager). How can I do that? I know it
will need the user's password but how can I pass the command?
The simple SHELL "sudo apt-get install ..." won't do the thing!
Thanks!
-