Deleted Added
full compact
3a4
> # Copyright (c) 2013 Devin Teske
27c28,30
< # $FreeBSD: head/usr.sbin/bsdinstall/scripts/docsinstall 257749 2013-11-06 15:49:31Z gjb $
---
> # $FreeBSD: head/usr.sbin/bsdinstall/scripts/docsinstall 257842 2013-11-08 09:57:03Z dteske $
> #
> ############################################################ INCLUDES
28a32,37
> BSDCFG_SHARE="/usr/share/bsdconfig"
> . $BSDCFG_SHARE/common.subr || exit 1
> f_dprintf "%s: loading includes..." "$0"
> f_include $BSDCFG_SHARE/dialog.subr
> f_include $BSDCFG_SHARE/mustberoot.subr
> f_include $BSDCFG_SHARE/packages/packages.subr
30,60c39
< exec 3>&1
< DOCS=$(dialog --backtitle "FreeBSD Installer" \
< --title "FreeBSD Documentation Installation" --separate-output \
< --checklist "This menu will allow you to install the whole documentation set
< from the FreeBSD Documentation Project: Handbook, FAQ and articles.\n\n
< Please select the language versions you wish to install. At minimum,
< you should install the English version, this is the original version
< of the documentation.\n\n
< NB: This requires a working, configured network connection." 0 0 0 \
< bn "Bengali Documentation" ${DIST_DOC_BN:-off} \
< da "Danish Documentation" ${DIST_DOC_DA:-off} \
< de "German Documentation" ${DIST_DOC_DE:-off} \
< el "Greek Documentation" ${DIST_DOC_EL:-off} \
< en "English Documentation (recommended)" ${DIST_DOC_EN:-on} \
< es "Spanish Documentation" ${DIST_DOC_ES:-off} \
< fr "French Documentation" ${DIST_DOC_FR:-off} \
< hu "Hungarian Documentation" ${DIST_DOC_HU:-off} \
< it "Italian Documentation" ${DIST_DOC_IT:-off} \
< ja "Japanese Documentation" ${DIST_DOC_JA:-off} \
< mn "Mongolian Documentation" ${DIST_DOC_MN:-off} \
< nl "Dutch Documentation" ${DIST_DOC_NL:-off} \
< pl "Polish Documentation" ${DIST_DOC_PL:-off} \
< pt "Portuguese Documentation" ${DIST_DOC_PT:-off} \
< ru "Russian Documentation" ${DIST_DOC_RU:-off} \
< sr "Serbian Documentation" ${DIST_DOC_SR:-off} \
< tr "Turkish Documentation" ${DIST_DOC_TR:-off} \
< zh_cn "Simplified Chinese Documentation" ${DIST_DOC_ZH_CN:-off} \
< zh_tw "Traditional Chinese Documentation" ${DIST_DOC_ZH_TW:-off} \
< 2>&1 1>&3)
< test $? -eq 0 || exit 0
< exec 3>&-
---
> ############################################################ CONFIGURATION
62,63c41,46
< # Let pkg(8) be able to use name servers
< cp ${BSDINSTALL_TMPETC}/resolv.conf ${BSDINSTALL_CHROOT}/etc
---
> #
> # List of languages to display (descriptions pulled from $msg_{lang}doc_desc)
> #
> : ${DOCSINSTALL_LANGS:=\
> bn da de el en es fr hu it ja mn nl pl pt ru sr tr zh_cn zh_tw \
> }
65,68c48,132
< error() {
< dialog --backtitle "FreeBSD Installer" --title "Error" --msgbox \
< "Could not install package $1 (`tail -n 1 ${BSDINSTALL_LOG}`)" 0 0
< exit 1
---
> ############################################################ GLOBALS
>
> #
> # Strings that should be moved to an i18n file and loaded with f_include_lang()
> #
> hline_arrows_space_tab_enter="Use arrows, SPACE, TAB or ENTER"
> msg_bndoc_desc="Bengali Documentation"
> msg_cancel="Cancel"
> msg_dadoc_desc="Danish Documentation"
> msg_dedoc_desc="German Documentation"
> msg_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."
> msg_eldoc_desc="Greek Documentation"
> msg_endoc_desc="English Documentation (recommended)"
> msg_esdoc_desc="Spanish Documentation"
> msg_frdoc_desc="French Documentation"
> msg_freebsd_documentation_installation="FreeBSD Documentation Installation"
> msg_freebsd_installer="FreeBSD Installer"
> msg_hudoc_desc="Hungarian Documentation"
> msg_itdoc_desc="Italian Documentation"
> msg_jadoc_desc="Japanese Documentation"
> msg_mndoc_desc="Mongolian Documentation"
> msg_nldoc_desc="Dutch Documentation"
> msg_ok="OK"
> msg_pldoc_desc="Polish Documentation"
> msg_ptdoc_desc="Portuguese Documentation"
> msg_rudoc_desc="Russian Documentation"
> msg_srdoc_desc="Serbian Documentation"
> msg_trdoc_desc="Turkish Documentation"
> msg_zh_cndoc_desc="Simplified Chinese Documentation"
> msg_zh_twdoc_desc="Traditional Chinese Documentation"
>
> ############################################################ FUNCTIONS
>
> # dialog_menu_main
> #
> # Display the dialog(1)-based application main menu.
> #
> dialog_menu_main()
> {
> local title="$DIALOG_TITLE"
> local btitle="$DIALOG_BACKTITLE"
> local prompt="$msg_docsinstall_menu_text"
> local check_list= # Calculated below
> local hline="$hline_arrows_space_tab_enter"
>
> local lang desc upper status
> for lang in $DOCSINSTALL_LANGS; do
> # Fetch the i18n description to display
> f_getvar msg_${lang}doc_desc desc
> f_shell_escape "$desc" desc
>
> # Get default status for each language
> upper=$( echo "$lang" | awk '{print toupper($0)}' )
> case "$lang" in
> en) f_getvar DIST_DOC_$upper:-on status ;;
> *) f_getvar DIST_DOC_$upper:-off status
> esac
>
> check_list="$check_list
> '$lang' '$desc' '$status'
> " # END-QUOTE
> done
>
> local height width rows
> eval f_dialog_checklist_size height width rows \
> \"\$title\" \
> \"\$btitle\" \
> \"\$prompt\" \
> \"\$hline\" \
> $check_list
> local selected
> selected=$( eval $DIALOG \
> --title \"\$title\" \
> --backtitle \"\$btitle\" \
> --hline \"\$hline\" \
> --ok-label \"\$msg_ok\" \
> --cancel-label \"\$msg_cancel\" \
> --checklist \"\$prompt\" \
> $height $width $rows \
> $check_list \
> 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD
> )
> local retval=$?
> f_dialog_menutag_store -s "$selected"
> return $retval
70a135
> ############################################################ MAIN
72,75c137,142
< clear
< echo "FreeBSD Installer"
< echo "========================"
< echo
---
> #
> # Initialize
> #
> f_dialog_title "$msg_freebsd_documentation_installation"
> f_dialog_backtitle "$msg_freebsd_installer"
> f_mustberoot_init
77,78c144,148
< echo "Please wait while the repository metadata is fetched."
< echo "This may take a few moments."
---
> #
> # Launch application main menu
> #
> dialog_menu_main || f_die
> f_dialog_menutag_fetch selected
80,81c150,151
< env ASSUME_ALWAYS_YES=1 pkg -c ${BSDINSTALL_CHROOT} install pkg \
< || error pkg
---
> # Let pkg_add be able to use name servers
> f_quietly cp -f $BSDINSTALL_TMPETC/resolv.conf $BSDINSTALL_CHROOT/etc/
83,85c153,157
< for i in $DOCS; do
< env ASSUME_ALWAYS_YES=1 pkg -c ${BSDINSTALL_CHROOT} install ${i}-freebsd-doc \
< || error $i-freebsd-doc
---
> #
> # Install each of the selected packages
> #
> for lang in $selected; do
> f_package_add $lang-freebsd-doc || return $FAILURE
86a159,162
>
> ################################################################################
> # END
> ################################################################################