Re: Adding lines to /etc/rc.conf during sysinstall wihout being REMOVED

2005-12-18 Thread Antony Mawer

On 17/12/2005 4:22 AM, Josh Endries wrote:

Does anyone know the correct way to add lines to rc.conf without
sysinstall commenting them out and prepending REMOVED to them,
during an automated install.cfg routine? Currently I have a pkg I
made that adds stuff like ntp.conf and rc.conf, but all the lines in
my custom rc.conf are removed after the script finishes.

I looked through the code for sysinstall but didn't see any way to
disable this behavior (my C isn't very good). What would be the
correct way to do this? I'm now having my pkg install a rc.d script
which cat's  /etc/rc.conf...


I hit this same problem in building a custom installation disc, and 
wound up extending sysinstall to have a shutdownNoRC that would function 
the same as the shutdown statement in an install.cfg, only without 
touching the rc.conf. This was useful for us, as we installed a custom 
rc.conf and did not want sysinstall to touch it.


I also added a poweroff and poweroffNoRC methods that function the 
same as the shutdown statement, only power off the machine instead. 
This can be quite handy in a production line environment, when used in 
conjunction with the cdcontrol(1) command to eject the CD, prior to 
powering off the completed system.


I've attached the patch if anyone is interested... perhaps if there is 
sufficient interest then someone could see about getting this committed. 
The attached patch is against 6.0-RELEASE.


Regards
Antony
Index: usr.sbin/sysinstall/dispatch.c
===
RCS file: /home/ncvs/src/usr.sbin/sysinstall/dispatch.c,v
retrieving revision 1.47
diff -u -r1.47 dispatch.c
--- usr.sbin/sysinstall/dispatch.c  30 Aug 2004 21:03:09 -  1.47
+++ usr.sbin/sysinstall/dispatch.c  18 Nov 2005 02:11:20 -
@@ -43,6 +43,9 @@
 #include list.h
 
 static int dispatch_shutdown(dialogMenuItem *unused);
+static int dispatch_shutdown_norc(dialogMenuItem *unused);
+static int dispatch_poweroff(dialogMenuItem *unused);
+static int dispatch_poweroff_norc(dialogMenuItem *unused);
 static int dispatch_systemExecute(dialogMenuItem *unused);
 static int dispatch_msgConfirm(dialogMenuItem *unused);
 static int dispatch_mediaClose(dialogMenuItem *unused);
@@ -111,6 +114,9 @@
 { addGroup,  userAddGroup},
 { addUser,   userAddUser },
 { shutdown,  dispatch_shutdown   },
+{ shutdownNoRC,  dispatch_shutdown_norc  },
+{ poweroff,  dispatch_poweroff   },
+{ poweroffNoRC,  dispatch_poweroff_norc  },
 { system,dispatch_systemExecute  },
 { dumpVariables, dump_variables  },
 { tcpMenuSelect, tcpMenuSelect   },
@@ -178,6 +184,27 @@
 }
 
 static int
+dispatch_shutdown_norc(dialogMenuItem *unused)
+{
+systemShutdownNow(0, SHUTDOWN_NO_RC_CONF);
+return DITEM_FAILURE;
+}
+
+static int
+dispatch_poweroff(dialogMenuItem *unused)
+{
+systemShutdownNow(0, SHUTDOWN_POWEROFF);
+return DITEM_FAILURE;
+}
+
+static int
+dispatch_poweroff_norc(dialogMenuItem *unused)
+{
+systemShutdownNow(0, SHUTDOWN_POWEROFF | SHUTDOWN_NO_RC_CONF);
+return DITEM_FAILURE;
+}
+
+static int
 dispatch_systemExecute(dialogMenuItem *unused)
 {
 char *cmd = variable_get(VAR_COMMAND);
Index: usr.sbin/sysinstall/sysinstall.8
===
RCS file: /home/ncvs/src/usr.sbin/sysinstall/sysinstall.8,v
retrieving revision 1.69.2.1
diff -u -r1.69.2.1 sysinstall.8
--- usr.sbin/sysinstall/sysinstall.89 Oct 2005 03:48:42 -   1.69.2.1
+++ usr.sbin/sysinstall/sysinstall.818 Nov 2005 01:55:58 -
@@ -813,6 +813,26 @@
 .Pp
 .Sy Variables :
 None
+.It shutdownNoRC
+Stop the script and terminate sysinstall, but do not touch
+.Pa /etc/rc.conf .
+.Pp
+.Sy Variables :
+None
+.It poweroff
+The same as
+.Pa shutdown ,
+only power off the system (if possible) rather than rebooting.
+.Pp
+.Sy Variables :
+None
+.It poweroffNoRC
+The same as
+.Pa shutdownNoRC ,
+only power off the system (if possible) rather than rebooting.
+.Pp
+.Sy Variables :
+None
 .It system
 Execute an arbitrary command with
 .Xr system 3
Index: usr.sbin/sysinstall/sysinstall.h
===
RCS file: /home/ncvs/src/usr.sbin/sysinstall/sysinstall.h,v
retrieving revision 1.264.2.1
diff -u -r1.264.2.1 sysinstall.h
--- usr.sbin/sysinstall/sysinstall.h7 Oct 2005 15:56:30 -   
1.264.2.1
+++ usr.sbin/sysinstall/sysinstall.h18 Nov 2005 02:09:31 -
@@ -395,6 +395,10 @@
 char extras[EXTRAS_FIELD_LEN];
 } DevInfo;
 
+/* systemShutdownNow bitfield flags */
+#define SHUTDOWN_POWEROFF  0x1 /* Power off after shutdown */
+#define SHUTDOWN_NO_RC_CONF0x2 /* Don't attempt to update rc.conf */
+
 
 /*** Externs ***/
 extern jmp_buf BailOut;/* Used to get the heck out 

Re: Adding lines to /etc/rc.conf during sysinstall wihout being REMOVED

2005-12-17 Thread legalois

Josh Endries wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Does anyone know the correct way to add lines to rc.conf without
sysinstall commenting them out and prepending REMOVED to them,
during an automated install.cfg routine? Currently I have a pkg I
made that adds stuff like ntp.conf and rc.conf, but all the lines in
my custom rc.conf are removed after the script finishes.

I looked through the code for sysinstall but didn't see any way to
disable this behavior (my C isn't very good). What would be the
correct way to do this? I'm now having my pkg install a rc.d script
which cat's  /etc/rc.conf...

Thanks,
Josh
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.2 (FreeBSD)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDovfOV/+PyAj2L+IRAjzcAJ4lJm+8vIP3QLy/DmuxTB0b4APp1gCfbhI1
waoWrsCORg3CiQMVToAFEaI=
=RlT3
-END PGP SIGNATURE-
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]






Put the settings you do not want changed in /etc./rc.conf.local
Settings in /etc/rc.conf.local override those in /etc/rc.conf

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Adding lines to /etc/rc.conf during sysinstall wihout being REMOVED

2005-12-16 Thread Josh Endries
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Does anyone know the correct way to add lines to rc.conf without
sysinstall commenting them out and prepending REMOVED to them,
during an automated install.cfg routine? Currently I have a pkg I
made that adds stuff like ntp.conf and rc.conf, but all the lines in
my custom rc.conf are removed after the script finishes.

I looked through the code for sysinstall but didn't see any way to
disable this behavior (my C isn't very good). What would be the
correct way to do this? I'm now having my pkg install a rc.d script
which cat's  /etc/rc.conf...

Thanks,
Josh
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.2 (FreeBSD)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDovfOV/+PyAj2L+IRAjzcAJ4lJm+8vIP3QLy/DmuxTB0b4APp1gCfbhI1
waoWrsCORg3CiQMVToAFEaI=
=RlT3
-END PGP SIGNATURE-
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Adding lines to /etc/rc.conf during sysinstall wihout being REMOVED

2005-12-16 Thread Erik Nørgaard

Josh Endries wrote:


Does anyone know the correct way to add lines to rc.conf without
sysinstall commenting them out and prepending REMOVED to them,
during an automated install.cfg routine? Currently I have a pkg I
made that adds stuff like ntp.conf and rc.conf, but all the lines in
my custom rc.conf are removed after the script finishes.

I looked through the code for sysinstall but didn't see any way to
disable this behavior (my C isn't very good). What would be the
correct way to do this? I'm now having my pkg install a rc.d script
which cat's  /etc/rc.conf...


could you post your install.cfg?

Cheers, Erik

--
Ph: +34.666334818   web: http://www.locolomo.org
S/MIME Certificate: http://www.locolomo.org/crt/2004071206.crt
Subject ID:  A9:76:7A:ED:06:95:2B:8D:48:97:CE:F2:3F:42:C8:F2:22:DE:4C:B9
Fingerprint: 4A:E8:63:38:46:F6:9A:5D:B4:DC:29:41:3F:62:D3:0A:73:25:67:C2
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Adding lines to /etc/rc.conf during sysinstall wihout being REMOVED

2005-12-16 Thread Josh Endries
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Erik Nørgaard wrote:
 Josh Endries wrote:
 
 Does anyone know the correct way to add lines to rc.conf without
 sysinstall commenting them out and prepending REMOVED to them,
 during an automated install.cfg routine? Currently I have a pkg I
 made that adds stuff like ntp.conf and rc.conf, but all the lines in
 my custom rc.conf are removed after the script finishes.

 could you post your install.cfg?

Here is my install.cfg:

debug=YES
#nonInteractive=YES
#noWarn=YES

disk=ad0
partition=all
bootManager=standard
diskPartitionEditor
#diskPartitionWrite

ad0s1-2=swap 4194304 none
ad0s1-1=ufs 524288 /
ad0s1-3=ufs 19531250 /home 1
ad0s1-4=ufs 2097152 /tmp 1
ad0s1-5=ufs 19531250 /usr 1
ad0s1-6=ufs 0 /var 1
diskLabelEditor
diskLabelCommit

hostname=test
netDev=vr0
nfs=192.168.0.3:/var/export/6.0-RELEASE/
tryDHCP=YES
mediaSetNFS

#nameserver=192.168.0.7

dists=base
distSetCustom

installCommit

package=portupgrade
packageAdd
package=sudo
packageAdd
package=stunnel
packageAdd
package=syslog-ng
packageAdd

command=cp /dist/pkgtools.conf /usr/local/etc
system
command=sed -i '' 's/md5/blf/' /etc/login.conf
system
command=cap_mkdb /etc/login.conf
system
command=pkg_add /dist/packages/All/my_base.tgz
system

shutdown

This is the plist for my_base.tgz (warning, it's my first package
attempt :)):

@name my_base
@cwd /etc
@srcdir /tmp/my_base
ntp.conf
rc.conf
@cwd /usr/local
@srcdir /tmp/my_base
etc/syslog-ng/syslog-ng.conf
etc/stunnel/stunnel.conf
@exec ln /usr/local/etc/rc.d/syslog-ng.sh.sample
/usr/local/etc/rc.d/syslog-ng.sh

/tmp/my_base/etc/rc.conf:

sshd_enable=YES
sshd_flags=-p 
ntpd_enable=YES
stunnel_enable=YES
syslogd_enable=NO

After sysinstall's shutdown and reboot, it comments out these
lines (using #REMOVED: %s). Converting them to something like this
in install.cfg didn't help, regardless of quotes:

command=echo sshd_enable=YES  /etc/rc.conf
system

Thanks,
Josh
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.2 (FreeBSD)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDow6wV/+PyAj2L+IRAt/xAKCLUjw7cn9CXjyo23aOsVewSQoc5QCgquKL
UCf3w0TzJx115E4f2aCKve0=
=biMR
-END PGP SIGNATURE-
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Adding lines to /etc/rc.conf during sysinstall wihout being REMOVED

2005-12-16 Thread Erik Nørgaard

Josh Endries wrote:


Here is my install.cfg:

debug=YES
#nonInteractive=YES
#noWarn=YES

disk=ad0
partition=all
bootManager=standard
diskPartitionEditor
#diskPartitionWrite

ad0s1-2=swap 4194304 none
ad0s1-1=ufs 524288 /
ad0s1-3=ufs 19531250 /home 1
ad0s1-4=ufs 2097152 /tmp 1
ad0s1-5=ufs 19531250 /usr 1
ad0s1-6=ufs 0 /var 1
diskLabelEditor
diskLabelCommit

hostname=test
netDev=vr0
nfs=192.168.0.3:/var/export/6.0-RELEASE/
tryDHCP=YES
mediaSetNFS

#nameserver=192.168.0.7

dists=base
distSetCustom

installCommit


...

command=cp /dist/pkgtools.conf /usr/local/etc
system
command=sed -i '' 's/md5/blf/' /etc/login.conf
system
command=cap_mkdb /etc/login.conf
system
command=pkg_add /dist/packages/All/my_base.tgz
system

shutdown


have you considered

command=shutdown
system

? it may not be the nicest way to do things though.


After sysinstall's shutdown and reboot, it comments out these
lines (using #REMOVED: %s). Converting them to something like this
in install.cfg didn't help, regardless of quotes:

command=echo sshd_enable=YES  /etc/rc.conf
system


two things:

try this before shutdown:

command=cp /etc/rc.conf /tmp/rc.conf
system

and also try to echo like this:

command=echo 'sshd_enable=YES'  /etc/rc.conf

I don't know how sysinstall treats quotes.

Well, honestly, I don't _know_ the answer to your question, but I hope 
this helps.


Cheers, Erik

--
Ph: +34.666334818   web: http://www.locolomo.org
S/MIME Certificate: http://www.locolomo.org/crt/2004071206.crt
Subject ID:  A9:76:7A:ED:06:95:2B:8D:48:97:CE:F2:3F:42:C8:F2:22:DE:4C:B9
Fingerprint: 4A:E8:63:38:46:F6:9A:5D:B4:DC:29:41:3F:62:D3:0A:73:25:67:C2
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]