1252995Sdteske#!/bin/sh
2252995Sdteske#-
3252995Sdteske# Copyright (c) 2012-2013 Devin Teske
4252995Sdteske# All rights reserved.
5252995Sdteske#
6252995Sdteske# Redistribution and use in source and binary forms, with or without
7252995Sdteske# modification, are permitted provided that the following conditions
8252995Sdteske# are met:
9252995Sdteske# 1. Redistributions of source code must retain the above copyright
10252995Sdteske#    notice, this list of conditions and the following disclaimer.
11252995Sdteske# 2. Redistributions in binary form must reproduce the above copyright
12252995Sdteske#    notice, this list of conditions and the following disclaimer in the
13252995Sdteske#    documentation and/or other materials provided with the distribution.
14252995Sdteske#
15252995Sdteske# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16252995Sdteske# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17252995Sdteske# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18252995Sdteske# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19252995Sdteske# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20252995Sdteske# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21252995Sdteske# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22252995Sdteske# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23252995Sdteske# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24252995Sdteske# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25252995Sdteske# SUCH DAMAGE.
26252995Sdteske#
27252995Sdteske# $FreeBSD$
28252995Sdteske#
29252995Sdteske############################################################ INCLUDES
30252995Sdteske
31252995SdteskeBSDCFG_SHARE="/usr/share/bsdconfig"
32252995Sdteske. $BSDCFG_SHARE/common.subr || exit 1
33252995Sdteskef_dprintf "%s: loading includes..." "$0"
34252995Sdteskef_include $BSDCFG_SHARE/dialog.subr
35252995Sdteskef_include $BSDCFG_SHARE/mustberoot.subr
36252995Sdteske
37252995SdteskeBSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="020.docsinstall"
38252995Sdteskef_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
39252995Sdteske
40263791Sdteskef_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" ipgm &&
41263791Sdteske	pgm="${ipgm:-$pgm}"
42252995Sdteske
43252995Sdteske############################################################ CONFIGURATION
44252995Sdteske
45252995Sdteske#
46252995Sdteske# If X11 is requested, which terminal and what options should we use?
47252995Sdteske#
48252995SdteskeX11TERM=xterm
49252995SdteskeX11TERM_OPTS=
50252995Sdteske
51252995Sdteske############################################################ MAIN
52252995Sdteske
53252995Sdteske# Incorporate rc-file if it exists
54252995Sdteske[ -f "$HOME/.bsdconfigrc" ] && f_include "$HOME/.bsdconfigrc"
55252995Sdteske
56252995Sdteske#
57252995Sdteske# Process command-line arguments
58252995Sdteske#
59252995Sdteskewhile getopts h$GETOPTS_STDARGS flag; do
60252995Sdteske	case "$flag" in
61252995Sdteske	h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm" ;;
62252995Sdteske	esac
63252995Sdteskedone
64252995Sdteskeshift $(( $OPTIND - 1 ))
65252995Sdteske
66252995Sdteske#
67252995Sdteske# Initialize
68252995Sdteske#
69252995Sdteskef_mustberoot_init
70252995Sdteske
71252995Sdteske#
72252995Sdteske# If Xdialog(1) is requested, we'll need to wrap bsdinstall(8) into xterm(1)
73252995Sdteske#
74252995Sdteskeif [ "$USE_XDIALOG" ]; then
75252995Sdteske	#
76252995Sdteske	# Make sure $X11TERM exists and is executable
77252995Sdteske	#
78252995Sdteske	case "$X11TERM" in
79252995Sdteske	*/*)
80252995Sdteske		[ -e "$X11TERM" ] || f_die 1 \
81252995Sdteske			"$msg_no_such_file_or_directory" "$pgm" "$X11TERM"
82252995Sdteske		[ -x "$X11TERM" ] || f_die 1 \
83252995Sdteske			"$msg_permission_denied" "$pgm" "$X11TERM"
84252995Sdteske		;;
85252995Sdteske	*)
86252995Sdteske		f_have "$X11TERM" || f_die 1 \
87252995Sdteske			"$msg_no_such_file_or_directory" "$pgm" "$X11TERM"
88252995Sdteske	esac
89252995Sdteske
90252995Sdteske	exec $X11TERM $X11TERM_OPTS -e /usr/sbin/bsdinstall docsinstall
91252995Sdteskeelse
92252995Sdteske	exec /usr/sbin/bsdinstall docsinstall
93252995Sdteskefi
94252995Sdteske
95252995Sdteske################################################################################
96252995Sdteske# END
97252995Sdteske################################################################################
98