docsinstall revision 249746
1118611Snjl#!/bin/sh 2118611Snjl#- 3118611Snjl# Copyright (c) 2012-2013 Devin Teske 4118611Snjl# All Rights Reserved. 5118611Snjl# 6118611Snjl# Redistribution and use in source and binary forms, with or without 7217365Sjkim# modification, are permitted provided that the following conditions 8217365Sjkim# are met: 9118611Snjl# 1. Redistributions of source code must retain the above copyright 10118611Snjl# notice, this list of conditions and the following disclaimer. 11217365Sjkim# 2. Redistributions in binary form must reproduce the above copyright 12217365Sjkim# notice, this list of conditions and the following disclaimer in the 13217365Sjkim# documentation and/or other materials provided with the distribution. 14217365Sjkim# 15217365Sjkim# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16217365Sjkim# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, THE 17217365Sjkim# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18217365Sjkim# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19217365Sjkim# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20217365Sjkim# DAMAGES (INLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21217365Sjkim# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22217365Sjkim# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23217365Sjkim# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24217365Sjkim# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25118611Snjl# SUCH DAMAGE. 26217365Sjkim# 27217365Sjkim# $FreeBSD: head/usr.sbin/bsdconfig/docsinstall/docsinstall 249746 2013-04-22 05:02:34Z dteske $ 28217365Sjkim# 29118611Snjl############################################################ INCLUDES 30217365Sjkim 31217365SjkimBSDCFG_SHARE="/usr/share/bsdconfig" 32217365Sjkim. $BSDCFG_SHARE/common.subr || exit 1 33217365Sjkimf_dprintf "%s: loading includes..." "$0" 34217365Sjkimf_include $BSDCFG_SHARE/dialog.subr 35217365Sjkimf_include $BSDCFG_SHARE/mustberoot.subr 36217365Sjkim 37217365SjkimBSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="020.docsinstall" 38217365Sjkimf_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr 39217365Sjkim 40217365Sjkimipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" ) 41217365Sjkim[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm" 42217365Sjkim 43118611Snjl############################################################ CONFIGURATION 44118611Snjl 45118611Snjl# 46151937Sjkim# If X11 is requested, which terminal and what options should we use? 47193529Sjkim# 48193529SjkimX11TERM=xterm 49193529SjkimX11TERM_OPTS= 50118611Snjl 51118611Snjl############################################################ MAIN 52118611Snjl 53118611Snjl# Incorporate rc-file if it exists 54118611Snjl[ -f "$HOME/.bsdconfigrc" ] && f_include "$HOME/.bsdconfigrc" 55118611Snjl 56151937Sjkim# 57118611Snjl# Process command-line arguments 58151937Sjkim# 59151937Sjkimwhile getopts dD:hSX flag; do 60151937Sjkim case "$flag" in 61151937Sjkim h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";; 62151937Sjkim esac 63151937Sjkimdone 64151937Sjkimshift $(( $OPTIND - 1 )) 65151937Sjkim 66151937Sjkim# 67151937Sjkim# Initialize 68151937Sjkim# 69151937Sjkimf_mustberoot_init 70151937Sjkim 71151937Sjkim# 72151937Sjkim# If Xdialog(1) is requested, we'll need to wrap bsdinstall(8) into xterm(1) 73151937Sjkim# 74151937Sjkimif [ "$USE_XDIALOG" ]; then 75193529Sjkim # 76151937Sjkim # Make sure $X11TERM exists and is executable 77151937Sjkim # 78151937Sjkim case "$X11TERM" in 79151937Sjkim */*) 80193529Sjkim [ -e "$X11TERM" ] || f_die 1 \ 81193529Sjkim "$msg_no_such_file_or_directory" "$pgm" "$X11TERM" 82193529Sjkim [ -x "$X11TERM" ] || f_die 1 \ 83193529Sjkim "$msg_permission_denied" "$pgm" "$X11TERM" 84193529Sjkim ;; 85151937Sjkim *) 86193529Sjkim f_have "$X11TERM" || f_die 1 \ 87118611Snjl "$msg_no_such_file_or_directory" "$pgm" "$X11TERM" 88118611Snjl esac 89118611Snjl 90118611Snjl exec $X11TERM $X11TERM_OPTS -e /usr/sbin/bsdinstall docsinstall 91151937Sjkimelse 92118611Snjl exec /usr/sbin/bsdinstall docsinstall 93118611Snjlfi 94118611Snjl 95118611Snjl################################################################################ 96193529Sjkim# END 97118611Snjl################################################################################ 98118611Snjl