services revision 245333
1246145Shselasky#!/bin/sh
2246145Shselasky#-
3246145Shselasky# Copyright (c) 2011 Nathan Whitehorn
4246145Shselasky# All rights reserved.
5246145Shselasky#
6246145Shselasky# Redistribution and use in source and binary forms, with or without
7246145Shselasky# modification, are permitted provided that the following conditions
8246145Shselasky# are met:
9246145Shselasky# 1. Redistributions of source code must retain the above copyright
10246145Shselasky#    notice, this list of conditions and the following disclaimer.
11246145Shselasky# 2. Redistributions in binary form must reproduce the above copyright
12246145Shselasky#    notice, this list of conditions and the following disclaimer in the
13246145Shselasky#    documentation and/or other materials provided with the distribution.
14246145Shselasky#
15246145Shselasky# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16246145Shselasky# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17246145Shselasky# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18246145Shselasky# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19246145Shselasky# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20246145Shselasky# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21246145Shselasky# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22246145Shselasky# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23246145Shselasky# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24246145Shselasky# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25246145Shselasky# SUCH DAMAGE.
26246145Shselasky#
27246145Shselasky# $FreeBSD: head/usr.sbin/bsdinstall/scripts/services 245333 2013-01-12 16:01:58Z nwhitehorn $
28246145Shselasky
29246145Shselasky: ${DIALOG_OK=0}
30246145Shselasky
31246145Shselaskyif [ -f $BSDINSTALL_TMPETC/rc.conf.services ]; then
32246145Shselasky	eval `sed -e s/YES/on/I -e s/NO/off/I $BSDINSTALL_TMPETC/rc.conf.services`
33246145Shselaskyelse
34246145Shselasky	# Default service states. Everything is off if not enabled.
35246145Shselasky	sshd_enable="on"
36246145Shselaskyfi
37246145Shselasky
38246145Shselaskyecho -n > $BSDINSTALL_TMPETC/rc.conf.services
39246145Shselasky
40246145Shselaskyexec 3>&1
41246145ShselaskyDAEMONS=$(dialog --backtitle "FreeBSD Installer" \
42246145Shselasky    --title "System Configuration" --nocancel --separate-output \
43246145Shselasky    --checklist "Choose the services you would like to be started at boot:" \
44246145Shselasky    0 0 0 \
45246145Shselasky	sshd	"Secure shell daemon" ${sshd_enable:-off} \
46246145Shselasky	moused	"PS/2 mouse pointer on console" ${moused_enable:-off} \
47246145Shselasky	ntpd	"Synchronize system and network time" ${ntpd_enable:-off} \
48246145Shselasky	powerd	"Adjust CPU frequency dynamically if supported" ${powerd_enable:-off} \
49246145Shselasky2>&1 1>&3)
50246145Shselaskyexec 3>&-
51246145Shselasky
52246145Shselaskyfor daemon in $DAEMONS; do
53246145Shselasky	echo ${daemon}_enable=\"YES\" >> $BSDINSTALL_TMPETC/rc.conf.services
54246145Shselaskydone
55246145Shselasky
56246145Shselaskyecho \# Set dumpdev to \"AUTO\" to enable crash dumps, \"NO\" to disable >> \
57246145Shselasky	$BSDINSTALL_TMPETC/rc.conf.services
58246571Shselasky
59246571Shselaskydialog --backtitle "FreeBSD Installer" --title "Dumpdev Configuration" \
60246145Shselasky	--nocancel --yesno \
61246145Shselasky	"Would you like to enable crash dumps?  If you start having problems with the system it can help the FreeBSD developers debug the problem.  But the crash dumps can take up a lot of disk space in /var." 0 0
62
63if [ $? -eq $DIALOG_OK ]; then
64	echo dumpdev=\"AUTO\" >> $BSDINSTALL_TMPETC/rc.conf.services
65else
66	echo dumpdev=\"NO\" >> $BSDINSTALL_TMPETC/rc.conf.services
67fi
68