1bfc3bab8SNathan Whitehorn#!/bin/sh 2bfc3bab8SNathan Whitehorn#- 3bfc3bab8SNathan Whitehorn# Copyright (c) 2011 Marc Fonvieille 4fef95330SDevin Teske# Copyright (c) 2013-2015 Devin Teske 5bfc3bab8SNathan Whitehorn# All rights reserved. 6bfc3bab8SNathan Whitehorn# 7bfc3bab8SNathan Whitehorn# Redistribution and use in source and binary forms, with or without 8bfc3bab8SNathan Whitehorn# modification, are permitted provided that the following conditions 9bfc3bab8SNathan Whitehorn# are met: 10bfc3bab8SNathan Whitehorn# 1. Redistributions of source code must retain the above copyright 11bfc3bab8SNathan Whitehorn# notice, this list of conditions and the following disclaimer. 12bfc3bab8SNathan Whitehorn# 2. Redistributions in binary form must reproduce the above copyright 13bfc3bab8SNathan Whitehorn# notice, this list of conditions and the following disclaimer in the 14bfc3bab8SNathan Whitehorn# documentation and/or other materials provided with the distribution. 15bfc3bab8SNathan Whitehorn# 16bfc3bab8SNathan Whitehorn# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17bfc3bab8SNathan Whitehorn# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18bfc3bab8SNathan Whitehorn# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19bfc3bab8SNathan Whitehorn# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20bfc3bab8SNathan Whitehorn# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21bfc3bab8SNathan Whitehorn# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22bfc3bab8SNathan Whitehorn# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23bfc3bab8SNathan Whitehorn# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24bfc3bab8SNathan Whitehorn# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25bfc3bab8SNathan Whitehorn# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26bfc3bab8SNathan Whitehorn# SUCH DAMAGE. 27bfc3bab8SNathan Whitehorn# 28bc4a673fSDevin Teske# 29bc4a673fSDevin Teske############################################################ INCLUDES 30bfc3bab8SNathan Whitehorn 31bc4a673fSDevin TeskeBSDCFG_SHARE="/usr/share/bsdconfig" 32bc4a673fSDevin Teske. $BSDCFG_SHARE/common.subr || exit 1 33bc4a673fSDevin Teskef_dprintf "%s: loading includes..." "$0" 34bc4a673fSDevin Teskef_include $BSDCFG_SHARE/dialog.subr 35bc4a673fSDevin Teskef_include $BSDCFG_SHARE/mustberoot.subr 36bc4a673fSDevin Teskef_include $BSDCFG_SHARE/packages/packages.subr 37bfc3bab8SNathan Whitehorn 38bc4a673fSDevin Teske############################################################ CONFIGURATION 39bfc3bab8SNathan Whitehorn 40bc4a673fSDevin Teske# 41bc4a673fSDevin Teske# List of languages to display (descriptions pulled from $msg_{lang}doc_desc) 42bc4a673fSDevin Teske# 43bc4a673fSDevin Teske: ${DOCSINSTALL_LANGS:=\ 4445ef6b4bSMarc Fonvieille bn da de el en es fr hu id it ja ko mn nl pl pt ru tr zh_cn zh_tw \ 4505b56666SNathan Whitehorn} 4605b56666SNathan Whitehorn 47bc4a673fSDevin Teske############################################################ GLOBALS 4805b56666SNathan Whitehorn 49bc4a673fSDevin Teske# 50bc4a673fSDevin Teske# Strings that should be moved to an i18n file and loaded with f_include_lang() 51bc4a673fSDevin Teske# 52bc4a673fSDevin Teskehline_arrows_space_tab_enter="Use arrows, SPACE, TAB or ENTER" 53bc4a673fSDevin Teskemsg_bndoc_desc="Bengali Documentation" 54bc4a673fSDevin Teskemsg_cancel="Cancel" 55bc4a673fSDevin Teskemsg_dadoc_desc="Danish Documentation" 56bc4a673fSDevin Teskemsg_dedoc_desc="German Documentation" 57cc42ef53SBrad Davismsg_docsinstall_menu_text="This menu allows you to install the whole documentation set from\nthe $OSNAME Documentation Project: Handbook, FAQ, and articles.\n\nPlease select the language versions you wish to install. At\nminimum, you should install the English version, the original\nversion of the documentation." 58bc4a673fSDevin Teskemsg_eldoc_desc="Greek Documentation" 59bc4a673fSDevin Teskemsg_endoc_desc="English Documentation (recommended)" 60bc4a673fSDevin Teskemsg_esdoc_desc="Spanish Documentation" 61bc4a673fSDevin Teskemsg_frdoc_desc="French Documentation" 62cc42ef53SBrad Davismsg_freebsd_documentation_installation="$OSNAME Documentation Installation" 63cc42ef53SBrad Davismsg_freebsd_installer="$OSNAME Installer" 64bc4a673fSDevin Teskemsg_hudoc_desc="Hungarian Documentation" 6545ef6b4bSMarc Fonvieillemsg_iddoc_desc="Indonesian Documentation" 66bc4a673fSDevin Teskemsg_itdoc_desc="Italian Documentation" 67bc4a673fSDevin Teskemsg_jadoc_desc="Japanese Documentation" 68633963a3SMarc Fonvieillemsg_kodoc_desc="Korean Documentation" 69bc4a673fSDevin Teskemsg_mndoc_desc="Mongolian Documentation" 70bc4a673fSDevin Teskemsg_nldoc_desc="Dutch Documentation" 71bc4a673fSDevin Teskemsg_ok="OK" 72bc4a673fSDevin Teskemsg_pldoc_desc="Polish Documentation" 73bc4a673fSDevin Teskemsg_ptdoc_desc="Portuguese Documentation" 74bc4a673fSDevin Teskemsg_rudoc_desc="Russian Documentation" 75bc4a673fSDevin Teskemsg_trdoc_desc="Turkish Documentation" 76bc4a673fSDevin Teskemsg_zh_cndoc_desc="Simplified Chinese Documentation" 77bc4a673fSDevin Teskemsg_zh_twdoc_desc="Traditional Chinese Documentation" 78bfc3bab8SNathan Whitehorn 79bc4a673fSDevin Teske############################################################ FUNCTIONS 804ae21ddcSGlen Barber 81bc4a673fSDevin Teske# dialog_menu_main 82bc4a673fSDevin Teske# 83bc4a673fSDevin Teske# Display the dialog(1)-based application main menu. 84bc4a673fSDevin Teske# 85bc4a673fSDevin Teskedialog_menu_main() 86bc4a673fSDevin Teske{ 87bc4a673fSDevin Teske local title="$DIALOG_TITLE" 88bc4a673fSDevin Teske local btitle="$DIALOG_BACKTITLE" 89bc4a673fSDevin Teske local prompt="$msg_docsinstall_menu_text" 90bc4a673fSDevin Teske local check_list= # Calculated below 91bc4a673fSDevin Teske local hline="$hline_arrows_space_tab_enter" 924ae21ddcSGlen Barber 93bc4a673fSDevin Teske local lang desc upper status 94bc4a673fSDevin Teske for lang in $DOCSINSTALL_LANGS; do 95bc4a673fSDevin Teske # Fetch the i18n description to display 96bc4a673fSDevin Teske f_getvar msg_${lang}doc_desc desc 97bc4a673fSDevin Teske f_shell_escape "$desc" desc 98bc4a673fSDevin Teske 99bc4a673fSDevin Teske # Get default status for each language 100bc4a673fSDevin Teske upper=$( echo "$lang" | awk '{print toupper($0)}' ) 101bc4a673fSDevin Teske case "$lang" in 102bc4a673fSDevin Teske en) f_getvar DIST_DOC_$upper:-on status ;; 103bc4a673fSDevin Teske *) f_getvar DIST_DOC_$upper:-off status 104bc4a673fSDevin Teske esac 105bc4a673fSDevin Teske 106bc4a673fSDevin Teske check_list="$check_list 107bc4a673fSDevin Teske '$lang' '$desc' '$status' 108bc4a673fSDevin Teske " # END-QUOTE 109bfc3bab8SNathan Whitehorn done 110bc4a673fSDevin Teske 111bc4a673fSDevin Teske local height width rows 112bc4a673fSDevin Teske eval f_dialog_checklist_size height width rows \ 113bc4a673fSDevin Teske \"\$title\" \ 114bc4a673fSDevin Teske \"\$btitle\" \ 115bc4a673fSDevin Teske \"\$prompt\" \ 116bc4a673fSDevin Teske \"\$hline\" \ 117bc4a673fSDevin Teske $check_list 118bc4a673fSDevin Teske local selected 119bc4a673fSDevin Teske selected=$( eval $DIALOG \ 120bc4a673fSDevin Teske --title \"\$title\" \ 121bc4a673fSDevin Teske --backtitle \"\$btitle\" \ 122751952aeSDevin Teske --separate-output \ 123bc4a673fSDevin Teske --hline \"\$hline\" \ 124bc4a673fSDevin Teske --ok-label \"\$msg_ok\" \ 125bc4a673fSDevin Teske --cancel-label \"\$msg_cancel\" \ 126bc4a673fSDevin Teske --checklist \"\$prompt\" \ 127bc4a673fSDevin Teske $height $width $rows \ 128bc4a673fSDevin Teske $check_list \ 129bc4a673fSDevin Teske 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD 130bc4a673fSDevin Teske ) 131bc4a673fSDevin Teske local retval=$? 132bc4a673fSDevin Teske f_dialog_menutag_store -s "$selected" 133bc4a673fSDevin Teske return $retval 134bc4a673fSDevin Teske} 135bc4a673fSDevin Teske 136bc4a673fSDevin Teske############################################################ MAIN 137bc4a673fSDevin Teske 138bc4a673fSDevin Teske# 139bc4a673fSDevin Teske# Initialize 140bc4a673fSDevin Teske# 141bc4a673fSDevin Teskef_dialog_title "$msg_freebsd_documentation_installation" 142bc4a673fSDevin Teskef_dialog_backtitle "$msg_freebsd_installer" 143bc4a673fSDevin Teskef_mustberoot_init 144bc4a673fSDevin Teske 145bc4a673fSDevin Teske# 146bc4a673fSDevin Teske# Launch application main menu 147bc4a673fSDevin Teske# 148bc4a673fSDevin Teskedialog_menu_main || f_die 149bc4a673fSDevin Teskef_dialog_menutag_fetch selected 150bc4a673fSDevin Teske 151*ad31d476SBjoern A. Zeeb# Let pkg(8) be able to use name servers 152bc4a673fSDevin Teskef_quietly cp -f $BSDINSTALL_TMPETC/resolv.conf $BSDINSTALL_CHROOT/etc/ 153bc4a673fSDevin Teske 154bc4a673fSDevin Teske# 155bc4a673fSDevin Teske# Install each of the selected packages 156bc4a673fSDevin Teske# 157d4218709SAllan Judedocsets="" 158bc4a673fSDevin Teskefor lang in $selected; do 159d4218709SAllan Jude docsets="$docsets $lang-freebsd-doc" 160bc4a673fSDevin Teskedone 161bc4a673fSDevin Teske 162527a9f3aSDevin TeskeASSUME_ALWAYS_YES=YES chroot $BSDINSTALL_CHROOT pkg install $docsets 163d4218709SAllan Jude 164bc4a673fSDevin Teske################################################################################ 165bc4a673fSDevin Teske# END 166bc4a673fSDevin Teske################################################################################ 167