10SN/A#!/bin/sh
25747SN/A#-
30SN/A# Copyright (c) 2011 Nathan Whitehorn
40SN/A# All rights reserved.
50SN/A#
60SN/A# Redistribution and use in source and binary forms, with or without
72362SN/A# modification, are permitted provided that the following conditions
80SN/A# are met:
92362SN/A# 1. Redistributions of source code must retain the above copyright
100SN/A#    notice, this list of conditions and the following disclaimer.
110SN/A# 2. Redistributions in binary form must reproduce the above copyright
120SN/A#    notice, this list of conditions and the following disclaimer in the
130SN/A#    documentation and/or other materials provided with the distribution.
140SN/A#
150SN/A# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
160SN/A# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
170SN/A# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
180SN/A# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
190SN/A# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
200SN/A# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
212362SN/A# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
222362SN/A# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
232362SN/A# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
240SN/A# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
250SN/A# SUCH DAMAGE.
260SN/A#
270SN/A# $FreeBSD$
280SN/A
290SN/A: ${DIALOG_OK=0}
300SN/A
310SN/Aif [ -f $BSDINSTALL_TMPETC/rc.conf.services ]; then
320SN/A	eval $( sed -e s/YES/on/i -e s/NO/off/i \
330SN/A		$BSDINSTALL_TMPETC/rc.conf.services )
340SN/Aelse
350SN/A	# Default service states. Everything is off if not enabled.
360SN/A	sshd_enable="on"
370SN/Afi
380SN/A
390SN/Aecho -n > $BSDINSTALL_TMPETC/rc.conf.services
400SN/A
410SN/Aexec 3>&1
420SN/ADAEMONS=$( dialog --backtitle "FreeBSD Installer" \
430SN/A    --title "System Configuration" --nocancel --separate-output \
4413760Snaoto    --checklist "Choose the services you would like to be started at boot:" \
450SN/A    0 0 0 \
460SN/A	local_unbound "Local caching validating resolver" ${local_unbound:-off} \
470SN/A	sshd	"Secure shell daemon" ${sshd_enable:-off} \
480SN/A	moused	"PS/2 mouse pointer on console" ${moused_enable:-off} \
490SN/A	ntpd	"Synchronize system and network time" ${ntpd_enable:-off} \
500SN/A	powerd	"Adjust CPU frequency dynamically if supported" \
510SN/A		${powerd_enable:-off} \
520SN/A	dumpdev "Enable kernel crash dumps to /var/crash" ${dumpdev:-on} \
530SN/A2>&1 1>&3 )
540SN/Aexec 3>&-
550SN/A
560SN/Ahavedump=
570SN/Afor daemon in $DAEMONS; do
580SN/A	[ "$daemon" = "dumpdev" ] && havedump=1 continue
590SN/A	echo ${daemon}_enable=\"YES\" >> $BSDINSTALL_TMPETC/rc.conf.services
600SN/Adone
610SN/A
620SN/Aecho '# Set dumpdev to "AUTO" to enable crash dumps, "NO"' \
630SN/A     'to disable' >> $BSDINSTALL_TMPETC/rc.conf.services
640SN/Aif [ "$havedump" ]; then
650SN/A	echo dumpdev=\"AUTO\" >> $BSDINSTALL_TMPETC/rc.conf.services
660SN/Aelse
670SN/A	echo dumpdev=\"NO\" >> $BSDINSTALL_TMPETC/rc.conf.services
680SN/Afi
690SN/A