Advertisement

Possible to make shell script to enter passwords, fdisk values etc for me?

Started by February 15, 2006 08:55 AM
4 comments, last by nagromo 18 years, 8 months ago
Hi, I want to make a shell script to install Gentoo for me. And I was wondering if it was possible to use it to fill out things like passwords, fdisk options etc, eg: passwd mypass mypass fdisk /dev/sda n p 1 a (return) +32M etc Thanks
clicky
I dont think you can make it work with the default shell language though =(
You probably need to install something like empty to create the pseudo-terminal for you.

You can use the expect utility if it is installed on your system.

If not, perl is often installed as part of the base system on most distros, so you can try the perl expect module.
Advertisement
I found autoexpect to be very useful this past month. I had to configure almost 700 machines recently, and having to type in the passwords by hand, running a configuration menu, getting to the menu entries in question, and finally editing the value would have been tedious. I used autoexpect to watch what I did for one machine, then I just edited the resulting script so that it wouldn't choke on slight differences in output from each machine.

Managed to get through the 700 machines by running the command on a list of machine names and then getting myself something to eat. B-)
-------------------------GBGames' Blog: An Indie Game Developer's Somewhat Interesting ThoughtsStaff Reviewer for Game Tunnel
Thanks i'm trying them both now,

GBGames, did you just install autoexpect on each machine before you ran the script, or did you do it from the network?

Also is there a straight forward way of doing this with c++?

Thanks
Quote: Original post by johnnyBravo
Also is there a straight forward way of doing this with c++?

Thanks


You can download the source code to empty (linked above) and see how they did it. That site claims the code is fairly small and simple.

This topic is closed to new replies.

Advertisement