services revision 285830
1238438Sdteske#!/bin/sh
2238438Sdteske#-
3238438Sdteske# Copyright (c) 2011 Nathan Whitehorn
4238438Sdteske# All rights reserved.
5238438Sdteske#
6238438Sdteske# Redistribution and use in source and binary forms, with or without
7238438Sdteske# modification, are permitted provided that the following conditions
8238438Sdteske# are met:
9238438Sdteske# 1. Redistributions of source code must retain the above copyright
10238438Sdteske#    notice, this list of conditions and the following disclaimer.
11238438Sdteske# 2. Redistributions in binary form must reproduce the above copyright
12238438Sdteske#    notice, this list of conditions and the following disclaimer in the
13238438Sdteske#    documentation and/or other materials provided with the distribution.
14238438Sdteske#
15238438Sdteske# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16238438Sdteske# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17238438Sdteske# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18238438Sdteske# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19238438Sdteske# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20238438Sdteske# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21238438Sdteske# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22238438Sdteske# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23238438Sdteske# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24238438Sdteske# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25238438Sdteske# SUCH DAMAGE.
26238438Sdteske#
27238438Sdteske# $FreeBSD: releng/10.2/usr.sbin/bsdinstall/scripts/services 273042 2014-10-13 15:53:01Z des $
28238438Sdteske
29238438Sdteske: ${DIALOG_OK=0}
30238438Sdteske
31238438Sdteskeif [ -f $BSDINSTALL_TMPETC/rc.conf.services ]; then
32238438Sdteske	eval $( sed -e s/YES/on/i -e s/NO/off/i \
33238438Sdteske		$BSDINSTALL_TMPETC/rc.conf.services )
34238438Sdteskeelse
35238438Sdteske	# Default service states. Everything is off if not enabled.
36238438Sdteske	sshd_enable="on"
37238438Sdteskefi
38238438Sdteske
39251541Sdteskeecho -n > $BSDINSTALL_TMPETC/rc.conf.services
40238438Sdteske
41238438Sdteskeexec 3>&1
42238438SdteskeDAEMONS=$( dialog --backtitle "FreeBSD Installer" \
43238438Sdteske    --title "System Configuration" --nocancel --separate-output \
44238438Sdteske    --checklist "Choose the services you would like to be started at boot:" \
45238438Sdteske    0 0 0 \
46238438Sdteske	local_unbound "Local caching validating resolver" ${local_unbound:-off} \
47238438Sdteske	sshd	"Secure shell daemon" ${sshd_enable:-off} \
48238438Sdteske	moused	"PS/2 mouse pointer on console" ${moused_enable:-off} \
49238438Sdteske	ntpd	"Synchronize system and network time" ${ntpd_enable:-off} \
50238438Sdteske	powerd	"Adjust CPU frequency dynamically if supported" \
51238438Sdteske		${powerd_enable:-off} \
52238438Sdteske	dumpdev "Enable kernel crash dumps to /var/crash" ${dumpdev:-on} \
53238438Sdteske2>&1 1>&3 )
54258592Sdteskeexec 3>&-
55238438Sdteske
56238438Sdteskehavedump=
57238438Sdteskefor daemon in $DAEMONS; do
58238438Sdteske	[ "$daemon" = "dumpdev" ] && havedump=1 continue
59238438Sdteske	echo ${daemon}_enable=\"YES\" >> $BSDINSTALL_TMPETC/rc.conf.services
60238438Sdteskedone
61238438Sdteske
62238438Sdteskeecho '# Set dumpdev to "AUTO" to enable crash dumps, "NO"' \
63238438Sdteske     'to disable' >> $BSDINSTALL_TMPETC/rc.conf.services
64238438Sdteskeif [ "$havedump" ]; then
65238438Sdteske	echo dumpdev=\"AUTO\" >> $BSDINSTALL_TMPETC/rc.conf.services
66238438Sdteskeelse
67238438Sdteske	echo dumpdev=\"NO\" >> $BSDINSTALL_TMPETC/rc.conf.services
68238438Sdteskefi
69238438Sdteske