services revision 273190
118962Ssos#!/bin/sh
218962Ssos#-
318962Ssos# Copyright (c) 2011 Nathan Whitehorn
418962Ssos# All rights reserved.
518962Ssos#
618962Ssos# Redistribution and use in source and binary forms, with or without
718962Ssos# modification, are permitted provided that the following conditions
818962Ssos# are met:
918962Ssos# 1. Redistributions of source code must retain the above copyright
1018962Ssos#    notice, this list of conditions and the following disclaimer.
1118962Ssos# 2. Redistributions in binary form must reproduce the above copyright
1218962Ssos#    notice, this list of conditions and the following disclaimer in the
1318962Ssos#    documentation and/or other materials provided with the distribution.
1418962Ssos#
1518962Ssos# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1618962Ssos# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1718962Ssos# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1818962Ssos# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1918962Ssos# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2018962Ssos# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2118962Ssos# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2218962Ssos# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2318962Ssos# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2418962Ssos# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2518962Ssos# SUCH DAMAGE.
2618962Ssos#
2718962Ssos# $FreeBSD: releng/10.1/usr.sbin/bsdinstall/scripts/services 273190 2014-10-16 22:07:43Z des $
2850477Speter
2918962Ssos: ${DIALOG_OK=0}
3018962Ssos
3125984Sjdpif [ -f $BSDINSTALL_TMPETC/rc.conf.services ]; then
3225984Sjdp	eval $( sed -e s/YES/on/i -e s/NO/off/i \
3325984Sjdp		$BSDINSTALL_TMPETC/rc.conf.services )
3418962Ssoselse
3522499Sjoerg	# Default service states. Everything is off if not enabled.
3622499Sjoerg	sshd_enable="on"
3759342Sobrienfi
3826837Scharnier
3918962Ssosecho -n > $BSDINSTALL_TMPETC/rc.conf.services
4059342Sobrien
4159342Sobrienexec 3>&1
4255377SwesDAEMONS=$( dialog --backtitle "FreeBSD Installer" \
4326837Scharnier    --title "System Configuration" --nocancel --separate-output \
4418962Ssos    --checklist "Choose the services you would like to be started at boot:" \
4559342Sobrien    0 0 0 \
4659342Sobrien	local_unbound "Local caching validating resolver" ${local_unbound:-off} \
4759342Sobrien	sshd	"Secure shell daemon" ${sshd_enable:-off} \
4859342Sobrien	moused	"PS/2 mouse pointer on console" ${moused_enable:-off} \
4959342Sobrien	ntpd	"Synchronize system and network time" ${ntpd_enable:-off} \
5059342Sobrien	powerd	"Adjust CPU frequency dynamically if supported" \
5159342Sobrien		${powerd_enable:-off} \
5262313Sgreen	dumpdev "Enable kernel crash dumps to /var/crash" ${dumpdev:-on} \
5362313Sgreen2>&1 1>&3 )
5462313Sgreenexec 3>&-
5559342Sobrien
5659342Sobrienhavedump=
5722499Sjoergfor daemon in $DAEMONS; do
5818962Ssos	[ "$daemon" = "dumpdev" ] && havedump=1 continue
5918962Ssos	echo ${daemon}_enable=\"YES\" >> $BSDINSTALL_TMPETC/rc.conf.services
6018962Ssosdone
6159342Sobrien
6259342Sobrienecho '# Set dumpdev to "AUTO" to enable crash dumps, "NO"' \
6322499Sjoerg     'to disable' >> $BSDINSTALL_TMPETC/rc.conf.services
6455377Swesif [ "$havedump" ]; then
6518962Ssos	echo dumpdev=\"AUTO\" >> $BSDINSTALL_TMPETC/rc.conf.services
6659342Sobrienelse
6718962Ssos	echo dumpdev=\"NO\" >> $BSDINSTALL_TMPETC/rc.conf.services
6835364Seivindfi
6959342Sobrien