1223897Snwhitehorn#!/bin/sh 2223897Snwhitehorn#- 3223897Snwhitehorn# Copyright (c) 2011 Marc Fonvieille 4263956Sdteske# Copyright (c) 2013 Devin Teske 5223897Snwhitehorn# All rights reserved. 6223897Snwhitehorn# 7223897Snwhitehorn# Redistribution and use in source and binary forms, with or without 8223897Snwhitehorn# modification, are permitted provided that the following conditions 9223897Snwhitehorn# are met: 10223897Snwhitehorn# 1. Redistributions of source code must retain the above copyright 11223897Snwhitehorn# notice, this list of conditions and the following disclaimer. 12223897Snwhitehorn# 2. Redistributions in binary form must reproduce the above copyright 13223897Snwhitehorn# notice, this list of conditions and the following disclaimer in the 14223897Snwhitehorn# documentation and/or other materials provided with the distribution. 15223897Snwhitehorn# 16223897Snwhitehorn# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17223897Snwhitehorn# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18223897Snwhitehorn# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19223897Snwhitehorn# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20223897Snwhitehorn# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21223897Snwhitehorn# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22223897Snwhitehorn# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23223897Snwhitehorn# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24223897Snwhitehorn# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25223897Snwhitehorn# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26223897Snwhitehorn# SUCH DAMAGE. 27223897Snwhitehorn# 28223897Snwhitehorn# $FreeBSD$ 29263956Sdteske# 30263956Sdteske############################################################ INCLUDES 31223897Snwhitehorn 32263956SdteskeBSDCFG_SHARE="/usr/share/bsdconfig" 33263956Sdteske. $BSDCFG_SHARE/common.subr || exit 1 34263956Sdteskef_dprintf "%s: loading includes..." "$0" 35263956Sdteskef_include $BSDCFG_SHARE/dialog.subr 36263956Sdteskef_include $BSDCFG_SHARE/mustberoot.subr 37263956Sdteskef_include $BSDCFG_SHARE/packages/packages.subr 38223897Snwhitehorn 39263956Sdteske############################################################ CONFIGURATION 40223897Snwhitehorn 41263956Sdteske# 42263956Sdteske# List of languages to display (descriptions pulled from $msg_{lang}doc_desc) 43263956Sdteske# 44263956Sdteske: ${DOCSINSTALL_LANGS:=\ 45263956Sdteske bn da de el en es fr hu it ja mn nl pl pt ru sr tr zh_cn zh_tw \ 46263956Sdteske} 47224972Snwhitehorn 48263956Sdteske############################################################ GLOBALS 49263956Sdteske 50263956Sdteske# 51263956Sdteske# Strings that should be moved to an i18n file and loaded with f_include_lang() 52263956Sdteske# 53263956Sdteskehline_arrows_space_tab_enter="Use arrows, SPACE, TAB or ENTER" 54263956Sdteskemsg_bndoc_desc="Bengali Documentation" 55263956Sdteskemsg_cancel="Cancel" 56263956Sdteskemsg_dadoc_desc="Danish Documentation" 57263956Sdteskemsg_dedoc_desc="German Documentation" 58263956Sdteskemsg_docsinstall_menu_text="This menu allows you to install the whole documentation set from\nthe FreeBSD 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." 59263956Sdteskemsg_eldoc_desc="Greek Documentation" 60263956Sdteskemsg_endoc_desc="English Documentation (recommended)" 61263956Sdteskemsg_esdoc_desc="Spanish Documentation" 62263956Sdteskemsg_frdoc_desc="French Documentation" 63263956Sdteskemsg_freebsd_documentation_installation="FreeBSD Documentation Installation" 64263956Sdteskemsg_freebsd_installer="FreeBSD Installer" 65263956Sdteskemsg_hudoc_desc="Hungarian Documentation" 66263956Sdteskemsg_itdoc_desc="Italian Documentation" 67263956Sdteskemsg_jadoc_desc="Japanese Documentation" 68263956Sdteskemsg_mndoc_desc="Mongolian Documentation" 69263956Sdteskemsg_nldoc_desc="Dutch Documentation" 70263956Sdteskemsg_ok="OK" 71263956Sdteskemsg_pldoc_desc="Polish Documentation" 72263956Sdteskemsg_ptdoc_desc="Portuguese Documentation" 73263956Sdteskemsg_rudoc_desc="Russian Documentation" 74263956Sdteskemsg_srdoc_desc="Serbian Documentation" 75263956Sdteskemsg_trdoc_desc="Turkish Documentation" 76263956Sdteskemsg_zh_cndoc_desc="Simplified Chinese Documentation" 77263956Sdteskemsg_zh_twdoc_desc="Traditional Chinese Documentation" 78263956Sdteske 79263956Sdteske############################################################ FUNCTIONS 80263956Sdteske 81263956Sdteske# dialog_menu_main 82263956Sdteske# 83263956Sdteske# Display the dialog(1)-based application main menu. 84263956Sdteske# 85263956Sdteskedialog_menu_main() 86263956Sdteske{ 87263956Sdteske local title="$DIALOG_TITLE" 88263956Sdteske local btitle="$DIALOG_BACKTITLE" 89263956Sdteske local prompt="$msg_docsinstall_menu_text" 90263956Sdteske local check_list= # Calculated below 91263956Sdteske local hline="$hline_arrows_space_tab_enter" 92263956Sdteske 93263956Sdteske local lang desc upper status 94263956Sdteske for lang in $DOCSINSTALL_LANGS; do 95263956Sdteske # Fetch the i18n description to display 96263956Sdteske f_getvar msg_${lang}doc_desc desc 97263956Sdteske f_shell_escape "$desc" desc 98263956Sdteske 99263956Sdteske # Get default status for each language 100263956Sdteske upper=$( echo "$lang" | awk '{print toupper($0)}' ) 101263956Sdteske case "$lang" in 102263956Sdteske en) f_getvar DIST_DOC_$upper:-on status ;; 103263956Sdteske *) f_getvar DIST_DOC_$upper:-off status 104263956Sdteske esac 105263956Sdteske 106263956Sdteske check_list="$check_list 107263956Sdteske '$lang' '$desc' '$status' 108263956Sdteske " # END-QUOTE 109263956Sdteske done 110263956Sdteske 111263956Sdteske local height width rows 112263956Sdteske eval f_dialog_checklist_size height width rows \ 113263956Sdteske \"\$title\" \ 114263956Sdteske \"\$btitle\" \ 115263956Sdteske \"\$prompt\" \ 116263956Sdteske \"\$hline\" \ 117263956Sdteske $check_list 118263956Sdteske local selected 119263956Sdteske selected=$( eval $DIALOG \ 120263956Sdteske --title \"\$title\" \ 121263956Sdteske --backtitle \"\$btitle\" \ 122264633Sdteske --separate-output \ 123263956Sdteske --hline \"\$hline\" \ 124263956Sdteske --ok-label \"\$msg_ok\" \ 125263956Sdteske --cancel-label \"\$msg_cancel\" \ 126263956Sdteske --checklist \"\$prompt\" \ 127263956Sdteske $height $width $rows \ 128263956Sdteske $check_list \ 129263956Sdteske 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD 130263956Sdteske ) 131263956Sdteske local retval=$? 132263956Sdteske f_dialog_menutag_store -s "$selected" 133263956Sdteske return $retval 134224972Snwhitehorn} 135224972Snwhitehorn 136263956Sdteske############################################################ MAIN 137224972Snwhitehorn 138263956Sdteske# 139263956Sdteske# Initialize 140263956Sdteske# 141263956Sdteskef_dialog_title "$msg_freebsd_documentation_installation" 142263956Sdteskef_dialog_backtitle "$msg_freebsd_installer" 143263956Sdteskef_mustberoot_init 144223897Snwhitehorn 145263956Sdteske# 146263956Sdteske# Launch application main menu 147263956Sdteske# 148263956Sdteskedialog_menu_main || f_die 149263956Sdteskef_dialog_menutag_fetch selected 150263956Sdteske 151263956Sdteske# Let pkg_add be able to use name servers 152263956Sdteskef_quietly cp -f $BSDINSTALL_TMPETC/resolv.conf $BSDINSTALL_CHROOT/etc/ 153263956Sdteske 154263956Sdteske# 155263956Sdteske# Install each of the selected packages 156263956Sdteske# 157263956Sdteskefor lang in $selected; do 158263956Sdteske f_package_add $lang-freebsd-doc || return $FAILURE 159223897Snwhitehorndone 160263956Sdteske 161263956Sdteske################################################################################ 162263956Sdteske# END 163263956Sdteske################################################################################ 164