On CentOS-based VM appliance I'm building, I would like to create a script that runs upon login that asks the user a series of questions that does (among other things) ask them to input their networking information (IP, mask, gate, DNS, etc). I'm hoping you guys might point me in the right direction. Here are some of the specific things I'm looking to accomplish with such a script. (1) Where might I look to for creating these types of scripts (e.g. I'm assuming Bash is the way to go here?) (2) Are there any templates out there that I might use as a starting place? (3) Once I write something, where/how do I call it in /etc/rc.d/ (4) And once it starts, what is the best way to make sure that it doesn't run again upon the second (and subsequent) reboots? Ideally, someone could show me a model of something like this that's already done, and I could just mod that. Otherwise, I'll grind through something manually, if I so have to.... -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.centos.org/pipermail/centos/attachments/20070807/aca7d349/attachment-0001.html>
> -----Original Message----- > From: centos-bounces at centos.org > [mailto:centos-bounces at centos.org] On Behalf Of Rogelio Bastardo > Sent: Tuesday, August 07, 2007 6:02 PM > To: CentOS mailing list > Subject: [CentOS] startup config scripts for CentOS > > On CentOS-based VM appliance I'm building, I would like to > create a script that runs upon login that asks the user a > series of questions that does (among other things) ask them > to input their networking information (IP, mask, gate, DNS, etc). > > I'm hoping you guys might point me in the right direction. > Here are some of the specific things I'm looking to > accomplish with such a script. > > (1) Where might I look to for creating these types of scripts > (e.g. I'm assuming Bash is the way to go here?) > (2) Are there any templates out there that I might use as a > starting place? > (3) Once I write something, where/how do I call it in /etc/rc.d/ > (4) And once it starts, what is the best way to make sure > that it doesn't run again upon the second (and subsequent) reboots? > > Ideally, someone could show me a model of something like this > that's already done, and I could just mod that. Otherwise, > I'll grind through something manually, if I so have to....Kinda like the 'firstboot' app that runs the first time the machine is installed after the reboot and doesn't run again? -Ross ______________________________________________________________________ This e-mail, and any attachments thereto, is intended only for use by the addressee(s) named herein and may contain legally privileged and/or confidential information. If you are not the intended recipient of this e-mail, you are hereby notified that any dissemination, distribution or copying of this e-mail, and any attachments thereto, is strictly prohibited. If you have received this e-mail in error, please immediately notify the sender and permanently delete the original and any copy or printout thereof.
On 8/7/07, Rogelio Bastardo <scubacuda at gmail.com> wrote:> On CentOS-based VM appliance I'm building, I would like to create a script > that runs upon login that asks the user a series of questions that does > (among other things) ask them to input their networking information (IP, > mask, gate, DNS, etc).Depending on what information is needed, this might already be done for you. dropping a file called .unconfigured in / will result in the system running through the various setup programs like system-config-keyboard, setting root's password, netconfig, timeconfig, authconfig, ntsysv, etc. Excerpted from /etc/rc.sysinit <SNIP> # Configure machine if necessary. if [ -f /.unconfigured ]; then if [ -x /usr/bin/rhgb-client ] && /usr/bin/rhgb-client --ping ; then chvt 1 fi if [ -x /usr/bin/system-config-keyboard ]; then /usr/bin/system-config-keyboard fi if [ -x /usr/bin/passwd ]; then /usr/bin/passwd root fi if [ -x /usr/sbin/netconfig ]; then /usr/sbin/netconfig fi if [ -x /usr/sbin/timeconfig ]; then /usr/sbin/timeconfig fi if [ -x /usr/sbin/authconfig ]; then /usr/sbin/authconfig --nostart fi if [ -x /usr/sbin/ntsysv ]; then /usr/sbin/ntsysv --level 35 fi # Reread in network configuration data. if [ -f /etc/sysconfig/network ]; then . /etc/sysconfig/network # Reset the hostname. action $"Resetting hostname ${HOSTNAME}: " hostname ${HOSTNAME} fi rm -f /.unconfigured if [ -x /usr/bin/rhgb-client ] && /usr/bin/rhgb-client --ping ; then chvt 8 fi fi <END SNIP> -- During times of universal deceit, telling the truth becomes a revolutionary act. George Orwell