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# 28bfc3bab8SNathan Whitehorn# $FreeBSD$ 29bc4a673fSDevin Teske# 30bc4a673fSDevin Teske############################################################ INCLUDES 31bfc3bab8SNathan Whitehorn 32bc4a673fSDevin TeskeBSDCFG_SHARE="/usr/share/bsdconfig" 33bc4a673fSDevin Teske. $BSDCFG_SHARE/common.subr || exit 1 34bc4a673fSDevin Teskef_dprintf "%s: loading includes..." "$0" 35bc4a673fSDevin Teskef_include $BSDCFG_SHARE/dialog.subr 36bc4a673fSDevin Teskef_include $BSDCFG_SHARE/mustberoot.subr 37bc4a673fSDevin Teskef_include $BSDCFG_SHARE/packages/packages.subr 38bfc3bab8SNathan Whitehorn 39bc4a673fSDevin Teske############################################################ CONFIGURATION 40bfc3bab8SNathan Whitehorn 41bc4a673fSDevin Teske# 42bc4a673fSDevin Teske# List of languages to display (descriptions pulled from $msg_{lang}doc_desc) 43bc4a673fSDevin Teske# 44bc4a673fSDevin Teske: ${DOCSINSTALL_LANGS:=\ 45*45ef6b4bSMarc Fonvieille bn da de el en es fr hu id it ja ko mn nl pl pt ru tr zh_cn zh_tw \ 4605b56666SNathan Whitehorn} 4705b56666SNathan Whitehorn 48bc4a673fSDevin Teske############################################################ GLOBALS 4905b56666SNathan Whitehorn 50bc4a673fSDevin Teske# 51bc4a673fSDevin Teske# Strings that should be moved to an i18n file and loaded with f_include_lang() 52bc4a673fSDevin Teske# 53bc4a673fSDevin Teskehline_arrows_space_tab_enter="Use arrows, SPACE, TAB or ENTER" 54bc4a673fSDevin Teskemsg_bndoc_desc="Bengali Documentation" 55bc4a673fSDevin Teskemsg_cancel="Cancel" 56bc4a673fSDevin Teskemsg_dadoc_desc="Danish Documentation" 57bc4a673fSDevin Teskemsg_dedoc_desc="German Documentation" 58cc42ef53SBrad 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." 59bc4a673fSDevin Teskemsg_eldoc_desc="Greek Documentation" 60bc4a673fSDevin Teskemsg_endoc_desc="English Documentation (recommended)" 61bc4a673fSDevin Teskemsg_esdoc_desc="Spanish Documentation" 62bc4a673fSDevin Teskemsg_frdoc_desc="French Documentation" 63cc42ef53SBrad Davismsg_freebsd_documentation_installation="$OSNAME Documentation Installation" 64cc42ef53SBrad Davismsg_freebsd_installer="$OSNAME Installer" 65bc4a673fSDevin Teskemsg_hudoc_desc="Hungarian Documentation" 66*45ef6b4bSMarc Fonvieillemsg_iddoc_desc="Indonesian Documentation" 67bc4a673fSDevin Teskemsg_itdoc_desc="Italian Documentation" 68bc4a673fSDevin Teskemsg_jadoc_desc="Japanese Documentation" 69633963a3SMarc Fonvieillemsg_kodoc_desc="Korean Documentation" 70bc4a673fSDevin Teskemsg_mndoc_desc="Mongolian Documentation" 71bc4a673fSDevin Teskemsg_nldoc_desc="Dutch Documentation" 72bc4a673fSDevin Teskemsg_ok="OK" 73bc4a673fSDevin Teskemsg_pldoc_desc="Polish Documentation" 74bc4a673fSDevin Teskemsg_ptdoc_desc="Portuguese Documentation" 75bc4a673fSDevin Teskemsg_rudoc_desc="Russian Documentation" 76bc4a673fSDevin Teskemsg_trdoc_desc="Turkish Documentation" 77bc4a673fSDevin Teskemsg_zh_cndoc_desc="Simplified Chinese Documentation" 78bc4a673fSDevin Teskemsg_zh_twdoc_desc="Traditional Chinese Documentation" 79bfc3bab8SNathan Whitehorn 80bc4a673fSDevin Teske############################################################ FUNCTIONS 814ae21ddcSGlen Barber 82bc4a673fSDevin Teske# dialog_menu_main 83bc4a673fSDevin Teske# 84bc4a673fSDevin Teske# Display the dialog(1)-based application main menu. 85bc4a673fSDevin Teske# 86bc4a673fSDevin Teskedialog_menu_main() 87bc4a673fSDevin Teske{ 88bc4a673fSDevin Teske local title="$DIALOG_TITLE" 89bc4a673fSDevin Teske local btitle="$DIALOG_BACKTITLE" 90bc4a673fSDevin Teske local prompt="$msg_docsinstall_menu_text" 91bc4a673fSDevin Teske local check_list= # Calculated below 92bc4a673fSDevin Teske local hline="$hline_arrows_space_tab_enter" 934ae21ddcSGlen Barber 94bc4a673fSDevin Teske local lang desc upper status 95bc4a673fSDevin Teske for lang in $DOCSINSTALL_LANGS; do 96bc4a673fSDevin Teske # Fetch the i18n description to display 97bc4a673fSDevin Teske f_getvar msg_${lang}doc_desc desc 98bc4a673fSDevin Teske f_shell_escape "$desc" desc 99bc4a673fSDevin Teske 100bc4a673fSDevin Teske # Get default status for each language 101bc4a673fSDevin Teske upper=$( echo "$lang" | awk '{print toupper($0)}' ) 102bc4a673fSDevin Teske case "$lang" in 103bc4a673fSDevin Teske en) f_getvar DIST_DOC_$upper:-on status ;; 104bc4a673fSDevin Teske *) f_getvar DIST_DOC_$upper:-off status 105bc4a673fSDevin Teske esac 106bc4a673fSDevin Teske 107bc4a673fSDevin Teske check_list="$check_list 108bc4a673fSDevin Teske '$lang' '$desc' '$status' 109bc4a673fSDevin Teske " # END-QUOTE 110bfc3bab8SNathan Whitehorn done 111bc4a673fSDevin Teske 112bc4a673fSDevin Teske local height width rows 113bc4a673fSDevin Teske eval f_dialog_checklist_size height width rows \ 114bc4a673fSDevin Teske \"\$title\" \ 115bc4a673fSDevin Teske \"\$btitle\" \ 116bc4a673fSDevin Teske \"\$prompt\" \ 117bc4a673fSDevin Teske \"\$hline\" \ 118bc4a673fSDevin Teske $check_list 119bc4a673fSDevin Teske local selected 120bc4a673fSDevin Teske selected=$( eval $DIALOG \ 121bc4a673fSDevin Teske --title \"\$title\" \ 122bc4a673fSDevin Teske --backtitle \"\$btitle\" \ 123751952aeSDevin Teske --separate-output \ 124bc4a673fSDevin Teske --hline \"\$hline\" \ 125bc4a673fSDevin Teske --ok-label \"\$msg_ok\" \ 126bc4a673fSDevin Teske --cancel-label \"\$msg_cancel\" \ 127bc4a673fSDevin Teske --checklist \"\$prompt\" \ 128bc4a673fSDevin Teske $height $width $rows \ 129bc4a673fSDevin Teske $check_list \ 130bc4a673fSDevin Teske 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD 131bc4a673fSDevin Teske ) 132bc4a673fSDevin Teske local retval=$? 133bc4a673fSDevin Teske f_dialog_menutag_store -s "$selected" 134bc4a673fSDevin Teske return $retval 135bc4a673fSDevin Teske} 136bc4a673fSDevin Teske 137bc4a673fSDevin Teske############################################################ MAIN 138bc4a673fSDevin Teske 139bc4a673fSDevin Teske# 140bc4a673fSDevin Teske# Initialize 141bc4a673fSDevin Teske# 142bc4a673fSDevin Teskef_dialog_title "$msg_freebsd_documentation_installation" 143bc4a673fSDevin Teskef_dialog_backtitle "$msg_freebsd_installer" 144bc4a673fSDevin Teskef_mustberoot_init 145bc4a673fSDevin Teske 146bc4a673fSDevin Teske# 147bc4a673fSDevin Teske# Launch application main menu 148bc4a673fSDevin Teske# 149bc4a673fSDevin Teskedialog_menu_main || f_die 150bc4a673fSDevin Teskef_dialog_menutag_fetch selected 151bc4a673fSDevin Teske 152bc4a673fSDevin Teske# Let pkg_add be able to use name servers 153bc4a673fSDevin Teskef_quietly cp -f $BSDINSTALL_TMPETC/resolv.conf $BSDINSTALL_CHROOT/etc/ 154bc4a673fSDevin Teske 155bc4a673fSDevin Teske# 156bc4a673fSDevin Teske# Install each of the selected packages 157bc4a673fSDevin Teske# 158d4218709SAllan Judedocsets="" 159bc4a673fSDevin Teskefor lang in $selected; do 160d4218709SAllan Jude docsets="$docsets $lang-freebsd-doc" 161bc4a673fSDevin Teskedone 162bc4a673fSDevin Teske 163527a9f3aSDevin TeskeASSUME_ALWAYS_YES=YES chroot $BSDINSTALL_CHROOT pkg install $docsets 164d4218709SAllan Jude 165bc4a673fSDevin Teske################################################################################ 166bc4a673fSDevin Teske# END 167bc4a673fSDevin Teske################################################################################ 168