1bfc3bab8SNathan Whitehorn#!/bin/sh 2bfc3bab8SNathan Whitehorn#- 3bfc3bab8SNathan Whitehorn# Copyright (c) 2011 Marc Fonvieille 4bc4a673fSDevin Teske# Copyright (c) 2013 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:=\ 45bc4a673fSDevin Teske bn da de el en es fr hu it ja mn nl pl pt ru sr 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" 58bc4a673fSDevin Teskemsg_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." 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" 63bc4a673fSDevin Teskemsg_freebsd_documentation_installation="FreeBSD Documentation Installation" 64bc4a673fSDevin Teskemsg_freebsd_installer="FreeBSD Installer" 65bc4a673fSDevin Teskemsg_hudoc_desc="Hungarian Documentation" 66bc4a673fSDevin Teskemsg_itdoc_desc="Italian Documentation" 67bc4a673fSDevin Teskemsg_jadoc_desc="Japanese Documentation" 68bc4a673fSDevin Teskemsg_mndoc_desc="Mongolian Documentation" 69bc4a673fSDevin Teskemsg_nldoc_desc="Dutch Documentation" 70bc4a673fSDevin Teskemsg_ok="OK" 71bc4a673fSDevin Teskemsg_pldoc_desc="Polish Documentation" 72bc4a673fSDevin Teskemsg_ptdoc_desc="Portuguese Documentation" 73bc4a673fSDevin Teskemsg_rudoc_desc="Russian Documentation" 74bc4a673fSDevin Teskemsg_srdoc_desc="Serbian 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 151bc4a673fSDevin Teske# Let pkg_add be able to use name servers 152bc4a673fSDevin Teskef_quietly cp -f $BSDINSTALL_TMPETC/resolv.conf $BSDINSTALL_CHROOT/etc/ 153bc4a673fSDevin Teske 154*d4218709SAllan Judeif [ ! -x $BSDINSTALL_CHROOT ]; then 155*d4218709SAllan Jude ASSUME_ALWAYS_YES=YES chroot $BSDINSTALL_CHROOT pkg bootstrap 156*d4218709SAllan Judefi 157*d4218709SAllan Jude 158bc4a673fSDevin Teske# 159bc4a673fSDevin Teske# Install each of the selected packages 160bc4a673fSDevin Teske# 161*d4218709SAllan Judedocsets="" 162bc4a673fSDevin Teskefor lang in $selected; do 163*d4218709SAllan Jude docsets="$docsets $lang-freebsd-doc" 164bc4a673fSDevin Teskedone 165bc4a673fSDevin Teske 166*d4218709SAllan JudeASSUME_ALWAYS_YES=YES chroot $BSDINSTALL_CHROOT pkg install $docsets || return $FAILURE 167*d4218709SAllan Jude 168bc4a673fSDevin Teske################################################################################ 169bc4a673fSDevin Teske# END 170bc4a673fSDevin Teske################################################################################ 171