1#!/bin/sh 2#- 3# Copyright (c) 2011 Marc Fonvieille
| 1#!/bin/sh 2#- 3# Copyright (c) 2011 Marc Fonvieille
|
| 4# Copyright (c) 2013 Devin Teske
|
4# All rights reserved. 5# 6# Redistribution and use in source and binary forms, with or without 7# modification, are permitted provided that the following conditions 8# are met: 9# 1. Redistributions of source code must retain the above copyright 10# notice, this list of conditions and the following disclaimer. 11# 2. Redistributions in binary form must reproduce the above copyright 12# notice, this list of conditions and the following disclaimer in the 13# documentation and/or other materials provided with the distribution. 14# 15# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25# SUCH DAMAGE. 26#
| 5# All rights reserved. 6# 7# Redistribution and use in source and binary forms, with or without 8# modification, are permitted provided that the following conditions 9# are met: 10# 1. Redistributions of source code must retain the above copyright 11# notice, this list of conditions and the following disclaimer. 12# 2. Redistributions in binary form must reproduce the above copyright 13# notice, this list of conditions and the following disclaimer in the 14# documentation and/or other materials provided with the distribution. 15# 16# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26# SUCH DAMAGE. 27#
|
27# $FreeBSD: stable/10/usr.sbin/bsdinstall/scripts/docsinstall 257875 2013-11-09 00:59:31Z gjb $
| 28# $FreeBSD: stable/10/usr.sbin/bsdinstall/scripts/docsinstall 258421 2013-11-21 03:40:52Z dteske $ 29# 30############################################################ INCLUDES
|
28
| 31
|
| 32BSDCFG_SHARE="/usr/share/bsdconfig" 33. $BSDCFG_SHARE/common.subr || exit 1 34f_dprintf "%s: loading includes..." "$0" 35f_include $BSDCFG_SHARE/dialog.subr 36f_include $BSDCFG_SHARE/mustberoot.subr 37f_include $BSDCFG_SHARE/packages/packages.subr
|
29
| 38
|
30exec 3>&1 31DOCS=$(dialog --backtitle "FreeBSD Installer" \ 32 --title "FreeBSD Documentation Installation" --separate-output \ 33 --checklist "This menu will allow you to install the whole documentation set 34from the FreeBSD Documentation Project: Handbook, FAQ and articles.\n\n 35Please select the language versions you wish to install. At minimum, 36you should install the English version, this is the original version 37of the documentation.\n\n 38NB: This requires a working, configured network connection." 0 0 0 \ 39 bn "Bengali Documentation" ${DIST_DOC_BN:-off} \ 40 da "Danish Documentation" ${DIST_DOC_DA:-off} \ 41 de "German Documentation" ${DIST_DOC_DE:-off} \ 42 el "Greek Documentation" ${DIST_DOC_EL:-off} \ 43 en "English Documentation (recommended)" ${DIST_DOC_EN:-on} \ 44 es "Spanish Documentation" ${DIST_DOC_ES:-off} \ 45 fr "French Documentation" ${DIST_DOC_FR:-off} \ 46 hu "Hungarian Documentation" ${DIST_DOC_HU:-off} \ 47 it "Italian Documentation" ${DIST_DOC_IT:-off} \ 48 ja "Japanese Documentation" ${DIST_DOC_JA:-off} \ 49 mn "Mongolian Documentation" ${DIST_DOC_MN:-off} \ 50 nl "Dutch Documentation" ${DIST_DOC_NL:-off} \ 51 pl "Polish Documentation" ${DIST_DOC_PL:-off} \ 52 pt "Portuguese Documentation" ${DIST_DOC_PT:-off} \ 53 ru "Russian Documentation" ${DIST_DOC_RU:-off} \ 54 sr "Serbian Documentation" ${DIST_DOC_SR:-off} \ 55 tr "Turkish Documentation" ${DIST_DOC_TR:-off} \ 56 zh_cn "Simplified Chinese Documentation" ${DIST_DOC_ZH_CN:-off} \ 57 zh_tw "Traditional Chinese Documentation" ${DIST_DOC_ZH_TW:-off} \ 582>&1 1>&3) 59test $? -eq 0 || exit 0 60exec 3>&-
| 39############################################################ CONFIGURATION
|
61
| 40
|
62# Let pkg(8) be able to use name servers 63cp ${BSDINSTALL_TMPETC}/resolv.conf ${BSDINSTALL_CHROOT}/etc
| 41# 42# List of languages to display (descriptions pulled from $msg_{lang}doc_desc) 43# 44: ${DOCSINSTALL_LANGS:=\ 45 bn da de el en es fr hu it ja mn nl pl pt ru sr tr zh_cn zh_tw \ 46}
|
64
| 47
|
65error() { 66 dialog --backtitle "FreeBSD Installer" --title "Error" --msgbox \ 67 "Could not install package $1 (`tail -n 1 ${BSDINSTALL_LOG}`)" 0 0 68 exit 1
| 48############################################################ GLOBALS 49 50# 51# Strings that should be moved to an i18n file and loaded with f_include_lang() 52# 53hline_arrows_space_tab_enter="Use arrows, SPACE, TAB or ENTER" 54msg_bndoc_desc="Bengali Documentation" 55msg_cancel="Cancel" 56msg_dadoc_desc="Danish Documentation" 57msg_dedoc_desc="German Documentation" 58msg_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." 59msg_eldoc_desc="Greek Documentation" 60msg_endoc_desc="English Documentation (recommended)" 61msg_esdoc_desc="Spanish Documentation" 62msg_frdoc_desc="French Documentation" 63msg_freebsd_documentation_installation="FreeBSD Documentation Installation" 64msg_freebsd_installer="FreeBSD Installer" 65msg_hudoc_desc="Hungarian Documentation" 66msg_itdoc_desc="Italian Documentation" 67msg_jadoc_desc="Japanese Documentation" 68msg_mndoc_desc="Mongolian Documentation" 69msg_nldoc_desc="Dutch Documentation" 70msg_ok="OK" 71msg_pldoc_desc="Polish Documentation" 72msg_ptdoc_desc="Portuguese Documentation" 73msg_rudoc_desc="Russian Documentation" 74msg_srdoc_desc="Serbian Documentation" 75msg_trdoc_desc="Turkish Documentation" 76msg_zh_cndoc_desc="Simplified Chinese Documentation" 77msg_zh_twdoc_desc="Traditional Chinese Documentation" 78 79############################################################ FUNCTIONS 80 81# dialog_menu_main 82# 83# Display the dialog(1)-based application main menu. 84# 85dialog_menu_main() 86{ 87 local title="$DIALOG_TITLE" 88 local btitle="$DIALOG_BACKTITLE" 89 local prompt="$msg_docsinstall_menu_text" 90 local check_list= # Calculated below 91 local hline="$hline_arrows_space_tab_enter" 92 93 local lang desc upper status 94 for lang in $DOCSINSTALL_LANGS; do 95 # Fetch the i18n description to display 96 f_getvar msg_${lang}doc_desc desc 97 f_shell_escape "$desc" desc 98 99 # Get default status for each language 100 upper=$( echo "$lang" | awk '{print toupper($0)}' ) 101 case "$lang" in 102 en) f_getvar DIST_DOC_$upper:-on status ;; 103 *) f_getvar DIST_DOC_$upper:-off status 104 esac 105 106 check_list="$check_list 107 '$lang' '$desc' '$status' 108 " # END-QUOTE 109 done 110 111 local height width rows 112 eval f_dialog_checklist_size height width rows \ 113 \"\$title\" \ 114 \"\$btitle\" \ 115 \"\$prompt\" \ 116 \"\$hline\" \ 117 $check_list 118 local selected 119 selected=$( eval $DIALOG \ 120 --title \"\$title\" \ 121 --backtitle \"\$btitle\" \ 122 --hline \"\$hline\" \ 123 --ok-label \"\$msg_ok\" \ 124 --cancel-label \"\$msg_cancel\" \ 125 --checklist \"\$prompt\" \ 126 $height $width $rows \ 127 $check_list \ 128 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD 129 ) 130 local retval=$? 131 f_dialog_menutag_store -s "$selected" 132 return $retval
|
69} 70
| 133} 134
|
| 135############################################################ MAIN
|
71
| 136
|
72clear 73echo "FreeBSD Installer" 74echo "========================" 75echo
| 137# 138# Initialize 139# 140f_dialog_title "$msg_freebsd_documentation_installation" 141f_dialog_backtitle "$msg_freebsd_installer" 142f_mustberoot_init
|
76
| 143
|
77echo "Please wait while the repository metadata is fetched." 78echo "This may take a few moments."
| 144# 145# Launch application main menu 146# 147dialog_menu_main || f_die 148f_dialog_menutag_fetch selected
|
79
| 149
|
80env ASSUME_ALWAYS_YES=1 pkg -c ${BSDINSTALL_CHROOT} install pkg \ 81 || error pkg
| 150# Let pkg_add be able to use name servers 151f_quietly cp -f $BSDINSTALL_TMPETC/resolv.conf $BSDINSTALL_CHROOT/etc/
|
82
| 152
|
83for i in $DOCS; do 84 env ASSUME_ALWAYS_YES=1 pkg -c ${BSDINSTALL_CHROOT} install ${i}-freebsd-doc \ 85 || error $i-freebsd-doc
| 153# 154# Install each of the selected packages 155# 156for lang in $selected; do 157 f_package_add $lang-freebsd-doc || return $FAILURE
|
86done
| 158done
|
| 159 160################################################################################ 161# END 162################################################################################
|
| |