Index: head/usr.sbin/bsdconfig/include/messages.subr =================================================================== --- head/usr.sbin/bsdconfig/include/messages.subr (revision 257816) +++ head/usr.sbin/bsdconfig/include/messages.subr (revision 257817) @@ -1,429 +1,429 @@ # Copyright (c) 2012 Ron McDowell # Copyright (c) 2012-2013 Devin Teske # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # # $FreeBSD$ field_password="Password:" field_username="Username:" hline_alnum_arrows_punc_tab_enter="Use alnum, arrows, punctuation, TAB or ENTER" hline_alnum_punc_tab_enter="Use alpha-numeric, punctuation, TAB or ENTER" hline_arrows_tab_enter="Press arrows, TAB or ENTER" hline_arrows_tab_punc_enter="Use arrows, TAB, punctuation, ENTER" hline_choose_help_for_more_information_on_media_types="Choose Help for more information on the various media types" msg_accept_continue="Accept/Continue" msg_accessibility_desc="Ports to help disabled users." msg_adding_package_as_a_dependency_from_media="Adding %s (as a dependency) from %s" msg_adding_package_from_media="Adding %s from %s" msg_afterstep_desc="Ports to support the AfterStep window manager." msg_all="All" msg_all_desc="All available packages in all categories." msg_always_try_sudo_when_run_as="Always try sudo(8) when run as %s" msg_an_unknown_error_occurred="An unknown error occurred" msg_arabic_desc="Ported software for Arab countries." msg_archivers_desc="Utilities for archiving and unarchiving data." msg_armenia="Armenia" msg_assume_network_is_already_configured="Running multi-user, assume that the network is already configured?" msg_assume_yes_to_all_non_critical_dialogs="Assume \"Yes\" answers to all non-critical dialogs" msg_astro_desc="Applications related to astronomy." msg_attempt_automatic_dhcp_configuration="Attempt automatic DHCP configuration of interfaces" msg_attempt_ipv6_configuration_of_interfaces="Attempt IPv6 configuration of interfaces" msg_attempting_to_update_repository_catalogue="Attempting to update repository catalogue from selected media." msg_audio_desc="Audio utilities - most require a supported sound card." msg_australia="Australia" msg_austria="Austria" msg_back="Back" msg_becoming_root_via_sudo="Becoming root via sudo(8)..." msg_benchmarks_desc="Utilities for measuring system performance." msg_biology_desc="Software related to biology." msg_brazil="Brazil" msg_building_package_menus="Building package menu(s)..." msg_cad_desc="Computer Aided Design utilities." msg_canada="Canada" msg_cancel="Cancel" msg_cancel_exit="Cancel/Exit" msg_cannot_create_permission_denied="%s: cannot create %s: Permission denied" msg_cannot_resolve_hostname="Cannot resolve \`%s'! Are you sure that your\nname server, gateway and network interface are correctly configured?" msg_cant_find_distribution="Warning: Can't find the \`%s' distribution on this\nFTP server. You may need to visit a different server for\nthe release you are trying to fetch or go to the Options\nmenu and set the release name to explicitly match what's\navailable on %s (or set to \"any\").\n\nWould you like to select another FTP server?" msg_cant_seem_to_write_out_resolv_conf="Can't seem to write out %s. Net cannot be used." msg_cd_dvd="CD/DVD" msg_cdrom="CDROM" msg_checking_access_to="Checking access to\n %s" msg_china="China" msg_chinese_desc="Ported software for the Chinese market." msg_choose_a_cd_dvd_type="Choose a CD/DVD type" msg_choose_a_dos_partition="Choose a DOS partition" msg_choose_a_floppy_drive="Choose a Floppy drive" msg_choose_a_ufs_partition="Choose a UFS partition" msg_choose_a_usb_drive="Choose a USB drive" msg_choose_installation_media="Choose Installation Media" msg_choose_installation_media_description="FreeBSD can be installed from a variety of different installation\nmedia, ranging from floppies to an Internet FTP server. If you're\ninstalling FreeBSD from a supported CD/DVD drive then this is generally\nthe best media to use if you have no overriding reason for using other\nmedia." msg_client_error="Client error, you could try an other server" msg_command_failed_rest_of_script_aborted="Command \`%s' failed - rest of script aborted." msg_comms_desc="Communications utilities." msg_configuration_for_interface="Configuration for Interface" msg_converters_desc="Format conversion utilities." msg_could_not_unmount_the_cdrom_dvd="Could not unmount the CDROM/DVD from %s: %s" msg_could_not_unmount_the_dos_partition="Could not unmount the DOS partition from %s: %s" msg_could_not_unmount_the_nfs_partition="Could not unmount the NFS partition from %s: %s" msg_could_not_unmount_the_ufs_partition="Could not unmount the UFS partition from %s: %s" msg_couldnt_connect_to_ftp_server="Couldn't connect to FTP server" msg_couldnt_connect_to_proxy="Couldn't connect to proxy" msg_couldnt_connect_to_server="Couldn't connect to server" msg_couldnt_open_ftp_connection="Couldn't open FTP connection to %s:\n %s." msg_created_path="Created %s" msg_czech_republic="Czech Republic" msg_databases_desc="Database software." msg_debugging="Debugging" msg_denmark="Denmark" msg_deskutils_desc="Various Desktop utilities." msg_devel_desc="Software development utilities and libraries." msg_device_is_not_configured="The %s device is not configured. You will need to do so\nin the Networking configuration menu before proceeding." msg_dhcp="DHCP" msg_dialog_mixedform_navigation_help="Use / arrows to navigate between fields, TAB to focus buttons, and Enter for OK/Cancel." msg_directory="Directory" msg_directory_not_found="%s: Directory not found." msg_directory_where_package_temporary_files_go="The directory where package temporary files should go" msg_dns_desc="Domain Name Service tools." msg_docs_desc="Meta-ports for FreeBSD documentation." msg_done="Done" msg_dos="DOS" msg_editor="Editor" msg_editors_desc="Editors." msg_elisp_desc="Things related to Emacs Lisp." msg_emit_extra_debugging_output="Emit extra debugging output" msg_emulators_desc="Utilities for emulating other operating systems." msg_enlightenment_desc="Software for the Enlightenment Desktop Environment." msg_enter_a_fully_qualified_pathname_for_the_directory="Enter a fully qualified pathname for the directory\ncontaining the FreeBSD distribution files:" msg_enter_the_device_name_of_a_ufs_formatted_partition="Enter the device-name of a UFS formatted partition" msg_error="Error" msg_error_mounting_device="Error mounting %s on %s: %s" msg_error_mounting_floppy_device="Error mounting floppy %s (%s) on %s: %s" msg_error_mounting_usb_drive="Error mounting USB drive %s on %s: %s" msg_error_when_requesting_url="Error when requesting %s, you could try an other server" msg_estonia="Estonia" msg_exit="Exit" msg_exit_bsdconfig="Exit bsdconfig" msg_extra_options_to_ifconfig="Extra options to ifconfig (usually empty):" msg_failed_to_add_default_route="Failed to add a default route; please check your network configuration" msg_file_system="File System" msg_finance_desc="Monetary, financial and related applications." msg_finland="Finland" msg_floppy="Floppy" msg_france="France" msg_french_desc="Ported software for French countries." msg_ftp="FTP" msg_ftp_desc="FTP client and server utilities." msg_ftp_passive="FTP Passive" msg_ftp_username="FTP username" msg_games_desc="Various games and sundry amusements." msg_generating_index_from_pkg_database="Generating INDEX from pkg(8) database\n(this can take a while)..." msg_geography_desc="Geography-related software." msg_german_desc="Ported software for Germanic countries." msg_germany="Germany" msg_getting_package_categories_via_pkg_rquery="Getting package categories via pkg-rquery(8)..." -msg_getting_package_dependencies_via_pkg_rquery="Getting package dependencyes via pkg-rquery(8)\n(this can take a while)..." +msg_getting_package_dependencies_via_pkg_rquery="Getting package dependencies via pkg-rquery(8)\n(this can take a while)..." msg_gnome_desc="Components of the Gnome Desktop environment." msg_gnustep_desc="Software for GNUstep desktop environment." msg_graphics_desc="Graphics libraries and utilities." msg_greece="Greece" msg_hamradio_desc="Software for amateur radio." msg_haskell_desc="Software related to the Haskell language." msg_hebrew_desc="Ported software for Hebrew language." msg_help="Help" msg_host_name_including_domain="Host name (including domain)" msg_hostname_variable_not_set="WARNING: hostname variable not set and is a non-optional\nparameter. Please add this to your installation script\nor set the netInteractive variable (see bsdconfig man page)" msg_http_direct="HTTP Direct" msg_http_proxy="HTTP Proxy" msg_hungarian_desc="Ported software for the Hungarian market." msg_iceland="Iceland" msg_install_from_a_dos_partition="Install from a DOS partition" msg_install_from_a_floppy_disk_set="Install from a floppy disk set" msg_install_from_a_freebsd_cd_dvd="Install from a FreeBSD CD/DVD" msg_install_from_a_ufs_partition="Install from a UFS partition" msg_install_from_a_usb_drive="Install from a USB drive" msg_install_from_an_ftp_server="Install from an FTP server" msg_install_from_an_ftp_server_thru_firewall="Install from an FTP server through a firewall" msg_install_from_an_ftp_server_thru_proxy="Install from an FTP server through an HTTP proxy" msg_install_from_an_http_server="Install from an HTTP server" msg_install_from_the_existing_filesystem="Install from the existing filesystem" msg_install_over_nfs="Install over NFS" msg_installed="Installed" msg_installed_lc="installed" msg_installed_desc="Leave package as-is, installed" msg_invalid_gateway_ipv4_address_specified="Invalid gateway IPv4 address specified" msg_invalid_hostname_value="Invalid hostname value" msg_invalid_ipv4_address="Invalid IPv4 address" msg_invalid_name_server_ip_address_specified="Invalid name server IP address specified" msg_invalid_netmask_value="Invalid netmask value" msg_invalid_nfs_path_specification="Invalid NFS path specification. Must be of the form:\nhost:/full/pathname/to/FreeBSD/distdir" msg_io_error_while_reading_in_the_package="I/O error while reading in the %s package." msg_io_or_format_error_on_index_file="I/O or format error on INDEX file.\nPlease verify media (or path to media) and try again." msg_ipv4_address="IPv4 Address" msg_ipv4_gateway="IPv4 Gateway" msg_ipv6="IPv6" msg_ipv6_desc="IPv6-related software." msg_ipv6_ready="IPv6 ready" msg_irc_desc="Internet Relay Chat utilities." msg_ireland="Ireland" msg_israel="Israel" msg_italy="Italy" msg_japan="Japan" msg_japanese_desc="Ported software for the Japanese market." msg_java_desc="Java language support." msg_kde_desc="Software for the K Desktop Environment." msg_kld_desc="Kernel loadable modules." msg_korea="Korea" msg_korean_desc="Ported software for the Korean market." msg_lang_desc="Computer languages." msg_latvia="Latvia" msg_length_of_specified_url_is_too_long="Length of specified URL is %u characters. Allowable maximum is %u." msg_linux_desc="Linux programs that can run under binary compatibility." msg_lisp_desc="Software related to the Lisp language." msg_lithuania="Lithuania" msg_loading_of_dependent_package_failed="Loading of dependent package %s failed" msg_located_index_now_reading_package_data_from_it="Located INDEX, now reading package data from it..." msg_logging_in_to_user_at_host="Logging in to %s@%s.." msg_looking_for_keymap_files="Looking for keymap files..." msg_looking_up_host="Looking up host %s" msg_mail_desc="Electronic mail packages and utilities." msg_main_menu="Main Menu" msg_main_site="Main Site" msg_math_desc="Mathematical computation software." msg_mbone_desc="Applications and utilities for the MBONE." msg_media_timeout="Media Timeout" msg_media_type="Media Type" msg_menu_text="If you've already installed FreeBSD, you may use\nthis menu to customize it somewhat to suit your\nparticular configuration. Most importantly, you\ncan use the Packages utility to load extra '3rd\nparty' software not provided in the base\ndistributions." msg_misc_desc="Miscellaneous utilities." msg_missing_ftp_host_or_directory="Missing FTP host or directory specification. FTP media not initialized." msg_multimedia_desc="Multimedia software." msg_must_be_root_to_execute="%s: must be root to execute" msg_must_specify_a_host_name_of_some_sort="Must specify a host name of some sort!" msg_name_server="Name server" msg_net_desc="Networking utilities." msg_net_device_init_failed="Net device init failed." msg_net_im_desc="Instant messaging software." msg_net_mgmt_desc="Network management tools." msg_net_p2p_desc="Peer to peer network applications." msg_netherlands="Netherlands" msg_netmask="Netmask" msg_network_configuration="Network Configuration" msg_network_interface_information_required="Network interface information required" msg_new_zealand="New Zealand" msg_news_desc="USENET News support software." msg_next_page="Next page" msg_nfailed_attempts="%u incorrect password attempts" msg_nfs="NFS" msg_nfs_secure="NFS Secure" msg_nfs_server_talks_only_on_a_secure_port="NFS server talks only on a secure port" msg_nfs_slow="NFS Slow" msg_nfs_tcp="NFS TCP" msg_nfs_version_3="NFS version 3" msg_no="No" msg_no_cd_dvd_devices_found="No CD/DVD devices found! Please check that your system's\nconfiguration is correct and that the CD/DVD drive is of a\nsupported type. For more information, consult the hardware\nguide in the Doc menu." msg_no_description_provided="No description provided" msg_no_dos_primary_partitions_found="No DOS primary partitions found! This installation method is unavailable" msg_no_floppy_devices_found="No floppy devices found! Please check that your system's configuration\nis correct. For more information, consult the hardware guide in the Doc\nmenu." msg_no_gateway_has_been_set="No gateway has been set. You will be unable to access hosts\nnot on your local network" msg_no_network_devices="No network devices available!" msg_no_package_name_passed_in_package_variable="No package name passed in package variable" msg_no_packages_were_selected_for_extraction="No packages were selected for extraction." msg_no_pkg_database_found="No pkg(8) database found!" msg_no_such_file_or_directory="%s: %s: No such file or directory" msg_no_usb_devices_found="No USB devices found (try Options/Re-scan Devices)" msg_no_username="No username provided!" msg_norway="Norway" msg_not_a_directory="%s: %s: Not a directory" msg_not_found="not found" msg_not_yet_set="not yet set" msg_ok="OK" msg_options="Options" msg_options_editor="Options Editor" msg_other="other" msg_pkg_delete_failed="Warning: pkg-delete(8) of %s failed.\n Run with debugging for details." msg_package_is_needed_by_other_installed_packages="Warning: Package %s is needed by\n %d other installed package%s." msg_package_not_installed_cannot_delete="Warning: package %s not installed\n No package can be deleted." msg_package_temp="Package Temp" msg_package_was_added_successfully="Package %s was added successfully" msg_packages="packages" msg_page_of_npages="(Page %s of %s)" msg_palm_desc="Software support for the Palm(tm) series." msg_parallel_desc="Applications dealing with parallelism in computing." msg_pear_desc="Software related to the Pear PHP framework." msg_perl5_desc="Utilities/modules for the PERL5 language." msg_permission_denied="%s: %s: Permission denied" msg_pkg_install_apparently_did_not_like_the_package="pkg-install(8) apparently did not like the %s package." msg_plan9_desc="Software from the Plan9 operating system." msg_please_check_the_url_and_try_again="No such directory: %s\nplease check the URL and try again.\n" msg_please_enter_password="Please enter your password for sudo(8):" msg_please_enter_the_address_of_the_http_proxy="Please enter the address of the HTTP proxy in this format:\n hostname:port (the ':port' is optional, default is 3128)" msg_please_enter_the_full_nfs_file_specification="Please enter the full NFS file specification for the remote\nhost and directory containing the FreeBSD distribution files.\nThis should be in the format: hostname:/some/freebsd/dir" msg_please_enter_the_password_for_this_user="Please enter the password for this user:" msg_please_enter_the_username_you_wish_to_login_as="Please enter the username you wish to login as:" msg_please_enter_username_password="Please enter a username and password for sudo(8):" msg_please_insert_floppy_containing="Please insert floppy containing %s in %s" msg_please_insert_floppy_in_drive="Please insert floppy in %s" msg_please_select_a_category_to_display="Please select a category to display." msg_please_select_a_cd_dvd_drive="FreeBSD can be installed directly from a CD/DVD containing a valid\nFreeBSD distribution. If you are seeing this menu it is because\nmore than one CD/DVD drive was found on your system. Please select\none of the following CD/DVD drives as your installation drive." msg_please_select_a_floppy_drive="You have more than one floppy drive. Please choose which drive\nyou would like to use." msg_please_select_a_freebsd_ftp_distribution_site="Please select a FreeBSD FTP distribution site" msg_please_select_a_freebsd_http_distribution_site="Please select a FreeBSD HTTP distribution site" msg_please_select_a_usb_drive="You have more than one USB drive. Please choose which drive\nyou would like to use." msg_please_select_dos_partition="FreeBSD can be installed directly from a DOS partition assuming,\nof course, that you have copied the relevant distributions into\nyour DOS partition before starting this installation. If this is\nnot the case then you should reboot DOS at this time and copy the\ndistributions you wish to install into a \"FREEBSD\" subdirectory\non one of your DOS partitions. Otherwise, please select the DOS\npartition containing the FreeBSD distribution files." msg_please_select_ethernet_device_to_configure="Please select the ethernet or PLIP device to configure." msg_please_select_the_site_closest_to_you_or_other="Please select the site closest to you or \"other\" if you'd like to\nspecify a different choice. Also note that not every site listed here\ncarries more than the base distribution kits. Only Primary sites are\nguaranteed to carry the full range of possible distributions." msg_please_select_ufs_partition="FreeBSD can be installed directly from another FreeBSD partition\nthat is UFS formatted assuming, of course, that you have copied\nthe relevant distributions into said partition before starting\ninstallation." msg_please_specify_a_temporary_directory="Please specify a temporary directory with lots of free space:" msg_please_specify_the_name_of_the_text_editor="Please specify the name of the text editor you wish to use:" msg_please_specify_the_number_of_seconds_to_wait="Please specify the number of seconds to wait for slow media:" msg_please_specify_the_release_you_wish_to_load="Please specify the release you wish to load or\n\"any\" for a generic release install:" msg_please_specify_url_of_a_freebsd_distribution="Please specify the URL of a FreeBSD distribution on a\nremote ftp site. This site must accept either anonymous\nftp or you should have set an ftp username and password\nin the Options screen.\n\nA URL looks like this: ftp:///\nWhere is relative to the anonymous ftp directory or the\nhome directory of the user being logged in as." msg_please_specify_url_of_freebsd_http_distribution="Please specify the URL of a FreeBSD distribution on a\nremote http site.\nA URL looks like this: http:///" msg_poland="Poland" msg_polish_desc="Ported software for the Polish market." msg_ports_mgmt_desc="Utilities for managing ports and packages." msg_portuguese_desc="Ported software for the Portuguese market." msg_previous_page="Previous page" msg_previous_syntax_errors="%s: Not overwriting \`%s' due to previous syntax errors" msg_primary="Primary" msg_print_desc="Utilities for dealing with printing." msg_probing_devices_please_wait_this_can_take_a_while="Probing devices, please wait (this can take a while)..." msg_proceed="Proceed" msg_processing_selection="Processing selection..." msg_python_desc="Software related to the Python language." msg_quick_start_how_to_use_this_menu_system="Quick start - How to use this menu system" msg_reinstall="Reinstall" msg_reinstall_desc="Mark this package for reinstall" msg_release_name="Release Name" msg_required_package_not_found="Warning: %s is a required package but was not found." msg_rerun_bsdconfig_initial_device_probe="Re-run bsdconfig initial device probe" msg_rescan_devices="Re-scan Devices" msg_reset="RESET!" msg_reset_all_values_to_startup_defaults="Reset all values to startup defaults" msg_reuse_old_ftp_site_selection_values="Re-use old FTP site selection values?" msg_reuse_old_http_site_settings="Re-use old HTTP site settings?" msg_review="Review" msg_review_desc="Review/perform pending actions" msg_review_help="Install, Re-Install, or Un-install selected packages and dependencies" msg_reviewing_selected_packages="Reviewing %u selected packages:" msg_ruby_desc="Software related to the Ruby language." msg_rubygems_desc="Ports of RubyGems packages." msg_russia="Russia" msg_russian_desc="Ported software for the Russian market." msg_scanning_for_dhcp_servers="Scanning for DHCP servers..." msg_scanning_for_ra_servers="Scanning for RA servers..." msg_scheme_desc="Software related to the Scheme language." msg_science_desc="Scientific software." msg_secure_mode_requires_root="Secure-mode requires root-access!" msg_secure_mode_requires_x11="Secure-mode requires X11 (use \`-X')!" msg_security_desc="System security software." msg_select="Select" msg_select_a_site_thats_close="Select a site that's close!" msg_selected="selected" msg_server_error_when_requesting_url="Server error when requesting %s, you could try an other server" msg_shells_desc="Various shells (tcsh, bash, etc)." msg_slovak_republic="Slovak Republic" msg_slovenia="Slovenia" msg_sorry_invalid_url="Sorry, %s is an invalid URL!" msg_sorry_package_was_not_found_in_the_index="Sorry, package %s was not found in the INDEX." msg_sorry_try_again="Sorry, try again." msg_south_africa="South Africa" msg_spain="Spain" msg_spanish_desc="Ported software for the Spanish market." msg_specify_some_other_ftp_site="Specify some other ftp site by URL" msg_specify_some_other_http_site="Specify some other http site by URL" msg_sweden="Sweden" msg_switzerland="Switzerland" msg_sysutils_desc="Various system utilities." msg_taiwan="Taiwan" msg_tcl_desc="TCL and packages that depend on it." msg_textproc_desc="Text processing/search utilities." msg_the_current_installation_media_type="The current installation media type." msg_timeout_value_in_seconds_for_slow_media="Timeout value in seconds for slow media." msg_tk_desc="Tk and packages that depend on it." msg_try_dhcp_configuration="Do you want to try DHCP configuration of the interface?" msg_try_ipv6_configuration="Do you want to try IPv6 configuration of the interface?" msg_try_sudo_only_this_once="Try sudo(8) only this once" msg_ufs="UFS" msg_uk="UK" msg_ukraine="Ukraine" msg_ukrainian_desc="Ported software for the Ukrainian market." msg_unable_to_configure_device="Unable to configure the %s interface!\nThis installation method cannot be used." msg_unable_to_fetch_package_from_selected_media="Unable to fetch package %s from selected media.\nNo package add will be done." msg_unable_to_get_file_from_selected_media="Unable to get %s file from selected media.\n\nThis may be because the packages collection is not available\non the distribution media you've chosen, most likely an FTP site\nwithout the packages collection mirrored. Please verify that\nyour media, or your path to the media, is correct and try again." msg_unable_to_get_proper_ftp_path="Unable to get proper FTP path. FTP media not initialized." msg_unable_to_initialize_media_type_for_package_extract="Unable to initialize media type for package extract." msg_unable_to_make_directory_mountpoint="Unable to make %s directory mountpoint for %s!" -msg_unable_to_pkg_rquery_package_dependeices="Unable to pkg-rquery(8) package dependencies!" +msg_unable_to_pkg_rquery_package_dependencies="Unable to pkg-rquery(8) package dependencies!" msg_unable_to_pkg_rquery_package_categories="Unable to pkg-rquery(8) package categories!" msg_unable_to_open="Unable to open %s" msg_unable_to_update_pkg_from_selected_media="Unable to update pkg(8) from selected media." msg_uninstall="Uninstall" msg_uninstall_desc="Mark this package for deletion" msg_uninstalling_package_waiting_for_pkg_delete="Uninstalling %s package - waiting for pkg-delete(8)" msg_unknown="unknown" msg_unknown_user="Unknown user: %s" msg_url_was_not_found="%s was not found, maybe directory or release-version are wrong?" msg_usa="USA" msg_usage="Usage" msg_usb="USB" msg_use_defaults="Use Defaults" msg_use_nfs_version_3="Use NFS version 3" msg_use_tcp_protocol_for_nfs="Use TCP protocol for NFS" msg_user_disallowed="User disallowed: %s" msg_user_is_using_a_slow_pc_or_ethernet_card="User is using a slow PC or Ethernet card" msg_username_and_password_to_use="Username and password to use instead of anonymous" msg_using_interface="Using interface %s" msg_using_usb_device="Using USB device: %s" msg_vietnamese_desc="Ported software for the Vietnamese market." msg_view_set_various_media_options="View/Set various media options" msg_what_would_you_like_to_do_with="What would you like to do with %s?" msg_which_release_to_attempt_to_load="Which release to attempt to load from installation media" msg_which_text_editor_to_use="Which text editor to use during installation" msg_windowmaker_desc="Ports to support the WindowMaker window manager." msg_would_you_like_to_bring_interface_up="Would you like to bring the %s interface up right now?" msg_www_desc="Web utilities (browsers, HTTP servers, etc)." msg_x11_clocks_desc="X Window System based clocks." msg_x11_desc="X Window System based utilities." msg_x11_drivers_desc="X Window System drivers." msg_x11_fm_desc="X Window System based file managers." msg_x11_fonts_desc="X Window System fonts and font utilties." msg_x11_servers_desc="X Window System servers." msg_x11_themes_desc="X Window System themes." msg_x11_toolkits_desc="X Window System based development toolkits." msg_x11_wm_desc="X Window System window managers." msg_xfce_desc="Software related to the Xfce Desktop Environment." msg_yes="Yes" msg_yes_to_all="Yes to All" msg_you_are_not_root_but="You are not root but %s can use sudo(8).\nWhat would you like to do?" msg_you_may_remove_the_floppy="You may remove the floppy from %s" msg_youve_already_done_the_network_configuration="You've already done the network configuration once,\nwould you like to skip over it now?" msg_zope_desc="Software related to the Zope platform." tcplayout_extras_help="Any interface-specific options to ifconfig you would like to add" tcplayout_extras_help_for_plip="For PLIP configuration, you must enter the peer's IP address here." tcplayout_gateway_help="IPv4 address of host forwarding packets to non-local destinations" tcplayout_hostname_help="Your fully-qualified hostname, e.g. foo.example.com" tcplayout_ipaddr_help="The IPv4 address to be used for this interface" tcplayout_nameserver_help="IPv4 or IPv6 address of your local DNS server" tcplayout_netmask_help="The netmask for this interface, e.g. 255.255.255.0 for a class C network" Index: head/usr.sbin/bsdconfig/share/packages/index.subr =================================================================== --- head/usr.sbin/bsdconfig/share/packages/index.subr (revision 257816) +++ head/usr.sbin/bsdconfig/share/packages/index.subr (revision 257817) @@ -1,458 +1,458 @@ if [ ! "$_PACKAGES_INDEX_SUBR" ]; then _PACKAGES_INDEX_SUBR=1 # # Copyright (c) 2013 Devin Teske # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # # $FreeBSD$ # ############################################################ INCLUDES BSDCFG_SHARE="/usr/share/bsdconfig" . $BSDCFG_SHARE/common.subr || exit 1 f_dprintf "%s: loading includes..." packages/index.subr f_include $BSDCFG_SHARE/device.subr f_include $BSDCFG_SHARE/media/common.subr f_include $BSDCFG_SHARE/strings.subr BSDCFG_LIBE="/usr/libexec/bsdconfig" f_include_lang $BSDCFG_LIBE/include/messages.subr ############################################################ GLOBALS PACKAGE_INDEX= _INDEX_INITTED= # # Default path to pkg(8) repo-packagesite.sqlite database # SQLITE_REPO="/var/db/pkg/repo-packagesite.sqlite" # # Default path to on-disk cache INDEX file # PACKAGES_INDEX_CACHEFILE="/var/run/bsdconfig/packages_INDEX.cache" # # INDEX format for FreeBSD-6.0 or higher: # # package|port-origin|install-prefix|comment|port-desc-file|maintainer| # categories|build-deps|run-deps|www-site|reserve|reserve|reserve|disc # INDEX_FORMAT="%n-%v" # package INDEX_FORMAT="$INDEX_FORMAT|/usr/ports/%o" # port-origin INDEX_FORMAT="$INDEX_FORMAT|%p" # install-prefix INDEX_FORMAT="$INDEX_FORMAT|%c" # comment INDEX_FORMAT="$INDEX_FORMAT|/usr/ports/%o/pkg-descr" # port-desc-file INDEX_FORMAT="$INDEX_FORMAT|%m" # maintainer INDEX_FORMAT="$INDEX_FORMAT|@CATEGORIES@" # place-holder INDEX_FORMAT="$INDEX_FORMAT|" # build-deps INDEX_FORMAT="$INDEX_FORMAT|@RUNDEPS@" # place-holder INDEX_FORMAT="$INDEX_FORMAT|%w" # www-site INDEX_FORMAT="$INDEX_FORMAT|" # reserved INDEX_FORMAT="$INDEX_FORMAT|" # reserved INDEX_FORMAT="$INDEX_FORMAT|" # reserved INDEX_FORMAT="$INDEX_FORMAT|" # disc ############################################################ FUNCTIONS # f_index_initialize [$var_to_set] # # Read and initialize the global index. Returns success unless media cannot be # initialized for any reason (e.g. user cancels media selection dialog or an # error occurs). The index is sorted before being loaded into $var_to_set. # # NOTE: The index is processed with f_index_read() [below] after being loaded. # f_index_initialize() { local __var_to_set="${2:-PACKAGE_INDEX}" [ "$_INDEX_INITTED" ] && return $SUCCESS # Got any media? f_media_verify || return $FAILURE # Does it move when you kick it? f_device_init media || return $FAILURE f_show_info "$msg_attempting_to_update_repository_catalogue" # # Generate $PACKAGESITE variable for pkg(8) based on media type # local __type __data __site device_media get type __type device_media get private __data case "$__type" in $DEVICE_TYPE_UFS|$DEVICE_TYPE_DISK) __site="file://$MOUNTPOINT" ;; $DEVICE_TYPE_DIRECTORY) __site="file://$__data" ;; $DEVICE_TYPE_FLOPPY) __site="file://${__data:-$MOUNTPOINT}" ;; $DEVICE_TYPE_FTP) f_getvar $VAR_FTP_PATH __site ;; $DEVICE_TYPE_HTTP_PROXY) f_getvar $VAR_HTTP_PROXY_PATH __site ;; $DEVICE_TYPE_HTTP) f_getvar $VAR_HTTP_PATH __site ;; $DEVICE_TYPE_CDROM) __site="file://$MOUNTPOINT" ;; $DEVICE_TYPE_USB) __site="file://$MOUNTPOINT" ;; $DEVICE_TYPE_DOS) __site="file://$MOUNTPOINT" ;; $DEVICE_TYPE_NFS) __site="file://$MOUNTPOINT" ;; esac if ! PACKAGESITE="$__site" f_quietly pkg update; then f_show_err "$msg_unable_to_update_pkg_from_selected_media" f_device_shutdown media return $FAILURE fi # # Try to get contents from validated on-disk cache # # # Calculate digest used to determine if the on-disk persistant cache # INDEX (containing this digest on the first line) is valid and can be # used to quickly populate the environment. # local __sqlite_digest if ! __sqlite_digest=$( md5 < "$SQLITE_REPO" 2> /dev/null ); then f_show_err "$msg_no_pkg_database_found" f_device_shutdown media return $FAILURE fi # # Check to see if the persistant cache INDEX file exists # if [ -f "$PACKAGES_INDEX_CACHEFILE" ]; then # # Attempt to populate the environment with the (soon to be) # validated on-disk cache. If validation fails, fall-back to # generating a fresh cache. # if eval $__var_to_set='$( ( # Get digest as the first word on first line read digest rest_ignored # # If the stored digest matches the calculated- # one populate the environment from the on-disk # cache and provide success exit status. # if [ "$digest" = "$__sqlite_digest" ]; then cat exit $SUCCESS else # Otherwise, return the current value eval echo \"\$__var_to_set\" exit $FAILURE fi ) < "$PACKAGES_INDEX_CACHEFILE" 2> /dev/null )'; then f_show_info \ "$msg_located_index_now_reading_package_data_from_it" if ! f_index_read "$__var_to_set"; then f_show_err \ "$msg_io_or_format_error_on_index_file" return $FAILURE fi _INDEX_INITTED=1 return $SUCCESS fi # Otherwise, fall-thru to create a fresh cache from scratch fi # # If we reach this point, we need to generate the data from scratch # f_show_info "$msg_getting_package_categories_via_pkg_rquery" if ! eval "$( pkg rquery "%n-%v %C" | awk ' { categories[$1] = categories[$1] " " $2 } END { for (package in categories) { cats = categories[package] sub(/^ /, "", cats) gsub(/[^[:alnum:]_]/, "_", package) printf "local _%s_categories=\"%s\";\n", package, cats } }' )"; then - f_show_err "$msg_unable_to_pkg_rquery_package_dependeices" + f_show_err "$msg_unable_to_pkg_rquery_package_dependencies" f_device_shutdown media return $FAILURE fi f_show_info "$msg_getting_package_dependencies_via_pkg_rquery" if ! eval "$( pkg rquery "%n-%v %dn-%dv" | awk ' { rundeps[$1] = rundeps[$1] " " $2 } END { for (package in rundeps) { deps = rundeps[package] sub(/^ /, "", deps) gsub(/[^[:alnum:]_]/, "_", package) printf "local _%s_rundeps=\"%s\";\n", package, deps } }' )"; then - f_show_err "$msg_unable_to_pkg_rquery_package_dependeices" + f_show_err "$msg_unable_to_pkg_rquery_package_dependencies" f_device_shutdown media return $FAILURE fi f_show_info "$msg_generating_index_from_pkg_database" eval "$__var_to_set"='$( pkg rquery "$INDEX_FORMAT" | while read LINE; do package="${LINE%%|*}"; f_str2varname "$package" varpkg; eval f_replaceall \"\$LINE\" \"\|@CATEGORIES@\|\" \ \"\|\$_${varpkg}_categories\|\" LINE eval f_replaceall \"\$LINE\" \"\|@RUNDEPS@\|\" \ \"\|\$_${varpkg}_rundeps\|\" LINE echo "$LINE" done )' # always returns true (status of last item in pipe-chain) eval "$__var_to_set"='$( debug= f_getvar "$__var_to_set" | sort )' # # Attempt to create the persistant on-disk cache # # Create a new temporary file to write to local __tmpfile="$( mktemp -t "$pgm" )" if [ "$__tmpfile" ]; then # Write the temporary file contents echo "$__sqlite_digest" > "$__tmpfile" debug= f_getvar "$__var_to_set" >> "$__tmpfile" # Finally, move the temporary file into place case "$PACKAGES_INDEX_CACHEFILE" in */*) f_quietly mkdir -p "${PACKAGES_INDEX_CACHEFILE%/*}" esac f_quietly mv -f "$__tmpfile" "$PACKAGES_INDEX_CACHEFILE" fi f_show_info "$msg_located_index_now_reading_package_data_from_it" if ! f_index_read "$__var_to_set"; then f_show_err "$msg_io_or_format_error_on_index_file" return $FAILURE fi _INDEX_INITTED=1 return $SUCCESS } # f_index_read [$var_to_get] # # Process the INDEX file (contents contained in $var_to_get) and... # # 1. create a list ($CATEGORY_MENU_LIST) of categories with package counts # 2. For convenience, create $_npkgs holding the total number of all packages # 3. extract associative categories for each package into $_categories_$varpkg # 4. extract runtime dependencies for each package into $_rundeps_$varpkg # 5. extract a [sorted] list of categories into $PACKAGE_CATEGORIES # 6. create $_npkgs_$varcat holding the total number of packages in category # # NOTE: $varpkg is the product of f_str2varname $package varpkg # NOTE: $package is the name as it appears in the INDEX (no archive suffix) # NOTE: We only show categories for which there are at least one package. # NOTE: $varcat is the product of f_str2varname $category varcat # f_index_read() { local var_to_get="${1:-PACKAGE_INDEX}" # Export variables required by awk(1) below export msg_no_description_provided export msg_all msg_all_desc export VALID_VARNAME_CHARS export msg_packages eval "$( debug= f_getvar "$var_to_get" | awk -F'|' ' function asorti(src, dest) { # Copy src indices to dest and calculate array length nitems = 0; for (i in src) dest[++nitems] = i # Sort the array of indices (dest) using insertion sort method for (i = 1; i <= nitems; k = i++) { idx = dest[i] while ((k > 0) && (dest[k] > idx)) { dest[k+1] = dest[k] k-- } dest[k+1] = idx } return nitems } function print_category(category, npkgs, desc) { cat = category # Accent the category if the first page has been # cached (also acting as a visitation indicator) if ( ENVIRON["_index_page_" varcat "_1"] ) cat = cat "*" printf "'\''%s'\'' '\''%s " packages "'\'' '\''%s'\''\n", cat, npkgs, desc } BEGIN { valid_chars = ENVIRON["VALID_VARNAME_CHARS"] default_desc = ENVIRON["msg_no_description_provided"] packages = ENVIRON["msg_packages"] tpkgs = 0 prefix = "" } { tpkgs++ varpkg = $1 gsub("[^" valid_chars "]", "_", varpkg) print "_categories_" varpkg "=\"" $7 "\"" split($7, pkg_categories, /[[:space:]]+/) for (pkg_category in pkg_categories) categories[pkg_categories[pkg_category]]++ print "_rundeps_" varpkg "=\"" $9 "\"" } END { print "_npkgs=" tpkgs # For convenience, total package count n = asorti(categories, categories_sorted) # Produce package counts for each category for (i = 1; i <= n; i++) { cat = varcat = categories_sorted[i] npkgs = categories[cat] gsub("[^" valid_chars "]", "_", varcat) print "_npkgs_" varcat "=\"" npkgs "\"" } # Create menu list and generate list of categories at same time print "CATEGORY_MENU_LIST=\"" print_category(ENVIRON["msg_all"], tpkgs, ENVIRON["msg_all_desc"]) category_list = "" for (i = 1; i <= n; i++) { cat = varcat = categories_sorted[i] npkgs = categories[cat] cur_prefix = tolower(substr(cat, 1, 1)) if ( prefix != cur_prefix ) prefix = cur_prefix else cat = " " cat gsub("[^" valid_chars "]", "_", varcat) desc = ENVIRON["_category_" varcat] if ( ! desc ) desc = default_desc print_category(cat, npkgs, desc) category_list = category_list " " cat } print "\"" # Produce the list of categories (calculated in above block) sub(/^ /, "", category_list) print "PACKAGE_CATEGORIES=\"" category_list "\"" }' )" # End-Quote } # f_index_extract_pages $var_to_get $var_basename $pagesize [$category] # # Extracts the package INDEX ($PACKAGE_INDEX by default if/when $var_to_get is # NULL; but should not be missing) into a series of sequential variables # corresponding to "pages" containing up to $pagesize packages. The package # INDEX data must be contained in the variable $var_to_get. The extracted pages # are stored in variables ${var_basename}_# -- where "#" is a the page number. # If $category is set, only packages for that category are extracted. # Otherwise, if $category is "All", missing, or NULL, all packages are # extracted and no filtering is done. # f_index_extract_pages() { local var_to_get="${1:-PACKAGE_INDEX}" var_basename="$2" pagesize="$3" local category="$4" # Optional eval "$( debug= f_getvar "$var_to_get" | awk -F'|' \ -v cat="$category" \ -v pagesize="$pagesize" \ -v var_basename="$var_basename" \ -v i18n_all="$msg_all" ' BEGIN { n = page = 0 } /'\''/{ gsub(/'\''/, "'\''\\'\'\''") } { if ( cat !~ "(^$|^" i18n_all "$)" && $7 !~ \ "(^|[[:space:]])" cat "([[:space:]]|$)" ) next starting_new_page = (n++ == (pagesize * page)) if ( starting_new_page ) printf "%s%s", ( n > 1 ? "'\''\n" : "" ), var_basename "_" ++page "='\''" printf "%s%s", ( starting_new_page ? "" : "\n" ), $0 } END { if ( n > 0 ) print "'\''" }' )" } # f_index_search $var_to_get $name [$var_to_set] # # Search the package INDEX ($PACKAGE_INDEX by default if/when $var_to_get is # NULL; but should not be missing) for $name, returning the first match. # Matches are strict (not regular expressions) and must match the beginning # portion of the package name to be considered a match. If $var_to_set is # missing or NULL, output is sent to standard output. If a match is found, # returns success; otherwise failure. # f_index_search() { local __var_to_get="${1:-PACKAGE_INDEX}" __pkg_basename="$2" local __var_to_set="$3" f_dprintf "f_index_search: Searching package data (in %s) for %s" \ "$__var_to_get" "$__pkg_basename" local __pkg= __pkg=$( debug= f_getvar "$__var_to_get" | awk -F'|' -v basename="$__pkg_basename" ' BEGIN { n = length(basename) } substr($1, 0, n) == basename { print $1; exit } ' ) if [ ! "$__pkg" ]; then f_dprintf "f_index_search: No packages matching %s found" \ "$__pkg_basename" return $FAILURE fi f_dprintf "f_index_search: Found package %s" "$__pkg" if [ "$__var_to_set" ]; then setvar "$__var_to_set" "$__pkg" else echo "$__pkg" fi return $SUCCESS } ############################################################ MAIN f_dprintf "%s: Successfully loaded." packages/index.subr fi # ! $_PACKAGES_INDEX_SUBR Index: head/usr.sbin/bsdconfig/share/packages/packages.subr =================================================================== --- head/usr.sbin/bsdconfig/share/packages/packages.subr (revision 257816) +++ head/usr.sbin/bsdconfig/share/packages/packages.subr (revision 257817) @@ -1,1174 +1,1174 @@ if [ ! "$_PACKAGES_PACKAGES_SUBR" ]; then _PACKAGES_PACKAGES_SUBR=1 # # Copyright (c) 2013 Devin Teske # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # # $FreeBSD$ # ############################################################ INCLUDES 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/device.subr f_include $BSDCFG_SHARE/media/common.subr f_include $BSDCFG_SHARE/packages/categories.subr f_include $BSDCFG_SHARE/packages/index.subr f_include $BSDCFG_SHARE/strings.subr BSDCFG_LIBE="/usr/libexec/bsdconfig" f_include_lang $BSDCFG_LIBE/include/messages.subr ############################################################ CONFIGURATION # # How many packages to display (maximum) per dialog menubox. # : ${PACKAGE_MENU_PAGESIZE:=2000} ############################################################ GLOBALS # # Package extensions to try # PACKAGE_EXTENSIONS=".txz .tbz .tbz2 .tgz" # # Variables used to track runtime states # PACKAGES_DETECTED= # Boolean (NULL/non-NULL); detected installed packages? PACKAGE_CATEGORIES= # List of package categories parsed from INDEX SELECTED_PACKAGES= # Packages selected by user in [X]dialog(1) interface # # Options # [ "${SHOW_DESC+set}" ] || SHOW_DESC=1 ############################################################ FUNCTIONS # eval f_package_accent_category_menu $var_to_set $CATEGORY_MENU_LIST # # Accent the CATEGORY_MENU_LIST produced by f_index_read() (see # packages/index.subr). Accented information includes adding an asterisk to the # category name if its index has been cached, adding the number of installed # packages for each category, and adding the number _selected_ packages for # each category. # # NOTE: The reason `eval' is recommended/shown for the syntax above is because # the $CATEGORY_MENU_LIST generated by f_index_read() is meant to be expanded # prior to execution (it contains a series of pre-quoted strings which act as # the interpolated command arguments). # f_package_accent_category_menu() { local var_to_set="$1" category cat desc help varcat menu_buf n shift 1 # var_to_set while [ $# -gt 0 ]; do category="${1%\*}" desc="${2%%; *}" help="$3" shift 3 # cat/desc/help cat="${category# }" # Trim lead space inserted by sort-method f_str2varname "$cat" varcat # Add number of installed packages for this category (if any) n=0 case "$cat" in "$msg_all") debug= f_getvar "_All_ninstalled" n ;; *) debug= f_getvar "_${varcat}_ninstalled" n ;; esac && [ $n -ge 1 ] && desc="$desc; $n $msg_installed_lc" # Add number of selected packages for this category (if any) n=0 case "$cat" in "$msg_all") debug= f_getvar "_All_nselected" n ;; *) debug= f_getvar "_${varcat}_nselected" n ;; esac && [ $n -ge 1 ] && desc="$desc; $n $msg_selected" # Re-Add asterisk to the category if its index has been cached f_isset _index_page_${varcat}_1 && category="$category*" # Update buffer with modified elements menu_buf="$menu_buf '$category' '$desc' '$help'" # End-Quote done setvar "$var_to_set" "$menu_buf" # return our buffer } # f_package_select $package ... # # Add $package to the list of tracked/selected packages. If $package is already # being tracked (already apears in $SELECTED_PACKAGES), this function amounts # to having no effect. # f_package_select() { local package pkgsel while [ $# -gt 0 ]; do package="$1" shift 1 # package for pkgsel in $SELECTED_PACKAGES; do [ "$package" = "$pkgsel" ] && return $SUCCESS done SELECTED_PACKAGES="$SELECTED_PACKAGES $package" f_dprintf "Added %s to selection list" "$package" done SELECTED_PACKAGES="${SELECTED_PACKAGES# }" # Trim leading space } # f_package_deselect $package ... # # Remove $package from teh list of tracked/selected packages. If $package is # not being tracked (doesn't appear in $SELECTED_PACKAGES), this function # amounts to having no effet. # f_package_deselect() { local package pkgsel while [ $# -gt 1 ]; do local new_list="" package="$1" shift 1 # package for pkgsel in $SELECTED_PACKAGES; do [ "$pkgsel" = "$package" ] && continue new_list="$new_list${new_list:+ }$pkgsel" done SELECTED_PACKAGES="$new_list" f_dprintf "Removed %s from selection list" "$package" done } # f_package_detect_installed # # Detect installed packages. Currently this uses pkg-query(8) for querying # entries and marks each entry as an installed/selected package. # f_package_detect_installed() { local package varpkg for package in $( pkg query "%n-%v" ); do f_str2varname $package varpkg export _mark_$varpkg=X # exported for awk(1) ENVIRON[] f_package_select $package done } # f_package_calculate_totals # # Calculate number of installed/selected packages for each category listed in # $PACKAGE_CATEGORIES (the number of installed packages for $category is stored # as $_${varcat}_ninstalled -- where $varcat is the product of `f_str2varname # $category varcat' -- and number selected packages as $_${varcat}_nselected). # Also calculates the total number of installed/selected packages stored as # $_All_ninstalled and $_All_nselected. # # Calculations are peformed by checking "marks". A "mark" is stored as # $_mark_$varpkg -- where $varpkg is the product of `f_str2varname $package # varpkg'. A mark can be "X" for an installed package, `I' for a package that # is marked for installation, "R" for a package that is marked for re-install, # and "U" for a package that is marked for uninstallation. If a package mark is # NULL or a single space (e.g., " "), the package is considered to be NOT # selected (and therefore does not increment the counts calculated herein). # f_package_calculate_totals() { local pkg varpkg mark cat varcat pkgcat n tselected=0 tinstalled=0 for cat in $PACKAGE_CATEGORIES; do f_str2varname $cat varcat setvar _${varcat}_ninstalled=0 setvar _${varcat}_nselected=0 done for pkg in $SELECTED_PACKAGES; do f_str2varname $pkg varpkg mark= f_getvar _mark_$varpkg mark case "$mark" in ""|" ") : ;; X) tinstalled=$(( $tinstalled + 1 )) ;; *) tselected=$(( $tselected + 1 )) esac f_getvar _categories_$varpkg pkgcat for cat in $pkgcat; do f_str2varname $cat varcat case "$mark" in ""|" ") : ;; X) debug= f_getvar _${varcat}_ninstalled n setvar _${varcat}_ninstalled $(( $n + 1 )) ;; *) debug= f_getvar _${varcat}_nselected n setvar _${varcat}_nselected $(( $n + 1 )) esac done done _All_nselected=$tselected _All_ninstalled=$tinstalled } # f_package_calculate_rundeps # # Update package dependencies by first unmarking all dependencies and then # re-marking all dependencies of packages marked for either install ("I") or # re-install ("R"). # f_package_calculate_rundeps() { local pkg varpkg mark rundeps dep vardep # # First unmark all the existing run-dependencies # f_dprintf "Unselecting package run-dependencies..." for pkg in $SELECTED_PACKAGES; do f_str2varname $pkg varpkg mark= debug= f_getvar _mark_$varpkg mark # Only unmark if it's marked as a Dependency if [ "$mark" = "D" ]; then f_dprintf "%s unselected" $pkg unset _mark_$varpkg f_package_deselect $pkg fi done # # Processes selected packages, adding dependencies # f_dprintf "Re-selecting package run-dependencies..." for pkg in $SELECTED_PACKAGES; do f_str2varname $pkg varpkg mark= debug= f_getvar _mark_$varpkg mark # Skip pkg unless marked for [Re-]Install [ "$mark" = "I" -o "$mark" = "R" ] || continue f_getvar _rundeps_$varpkg rundeps for dep in $rundeps; do f_str2varname $dep vardep mark= debug= f_getvar _mark_$vardep mark # Skip dep if already marked [ "${mark:- }" = " " ] || continue export _mark_$vardep="D" f_package_select $dep done done f_dprintf "Finished recalculating dependencies." } # f_package_menu_categories $var_to_set $defaultitem # # Dislay the menu of package categories, complete with package counts for each # category, accents, and other miscellany. If $defaultitem is non-NULL and # matches one of the existing menu-items, it will be pre-highlighted in the # menu dialog (HINT: Use f_dialog_menutag_fetch() to populate a local variable # that is passed as $defaultitem to highlight the user's last selection). # f_package_menu_categories() { local var_to_get="$1" defaultitem="$2" local prompt="$msg_please_select_a_category_to_display" local menu_list=" '> $msg_review' '$msg_review_desc' '$msg_review_help' " # End-Quote local hline= f_package_calculate_rundeps # updates package mark variables and SELECTED_PACKAGES f_package_calculate_totals # creates _{varcat}_ninstalled and _{varcat}_nselected local category_list debug= f_getvar "$var_to_get" category_list || return $DIALOG_CANCEL # Accent the category menu list with ninstalled/nselected eval f_package_accent_category_menu category_list $category_list # Add list of categories to menu list menu_list="$menu_list $category_list" local height width rows eval f_dialog_menu_with_help_size height width rows \ \"\$DIALOG_TITLE\" \ \"\$DIALOG_BACKTITLE\" \ \"\$prompt\" \ \"\$hline\" \ $menu_list local menu_choice menu_choice=$( eval $DIALOG \ --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ --item-help \ --default-item \"\$defaultitem\" \ --ok-label \"$msg_select\" \ --cancel-label \"$msg_cancel\" \ --menu \"\$prompt\" \ $height $width $rows \ $menu_list \ 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD ) local retval=$? f_dialog_menutag_store -s "$menu_choice" return $retval } # f_package_index_get_page $category $page [$var_to_set [$var_to_get]] # # Obtain a [potentially cached] page of the INDEX file for a given $category. # If $page is 1 and the cache has not yet been generated, the cache-generating # function f_index_extract_pages() (above) is called to generate all pages # (not just the requested page) in cache before returning the requested page. # If $page is not 1 and there is no cached page, failure status is returned. # f_package_index_get_page() { local category="$1" page="$2" var_to_set="$3" var_to_get="$4" varcat f_str2varname "$category" varcat if ! debug= f_getvar "_index_page_${varcat}_$page" $var_to_set && [ "$page" = "1" ] then f_show_info "$msg_building_package_menus" local pagesize="$PACKAGE_MENU_PAGESIZE" f_index_extract_pages "${var_to_get:-PACKAGE_INDEX}" \ _index_page_${varcat} "$pagesize" "$category" debug= f_getvar _index_page_${varcat}_$page $var_to_set # Update category default-item because now we're cached [ $page -eq 1 ] && category_defaultitem="${category_defaultitem%\*}*" else return $FAILURE fi } # f_package_menu_select $category [$page [$defaultitem]] # # Display list of packages for $category, optionally $page N and with a default # item selected. If $page is omitted, the first page is displayed (but this # only matters if there are multiple pages; which is determined by the global # maximum $PACKAGE_MENU_PAGESIZE). # # On success, if the user doesn't press ESC or choose Cancel, use # f_dialog_menuitem_fetch() to populate a local variable with the item (not # tag) corresponding to the user's selection. The tag portion of the user's # selection is available through f_dialog_menutag_fetch(). # f_package_menu_select() { local category="$1" page="${2:-1}" local prompt= # Calculated below local menu_list # Calculated below local defaultitem="$3" local hline="$hline_arrows_tab_punc_enter" f_isinteger "$page" || return $DIALOG_CANCEL local varcat f_str2varname "$category" varcat # Get number of packages for this category local npkgs=0 case "$category" in "$msg_all"|"") npkgs="${_npkgs:-0}" ;; *) f_getvar _npkgs_$varcat npkgs esac # Calculate number of pages local npages=$(( ${npkgs:=0} / $PACKAGE_MENU_PAGESIZE )) # Add a page to the pagecount if not evenly divisible [ $(( $npages * $PACKAGE_MENU_PAGESIZE )) -lt $npkgs ] && npages=$(( $npages + 1 )) # Print some debugging information f_dprintf "f_package_menu_select: category=[%s] npkgs=%u npages=%u" \ "$category" "$npkgs" "$npages" local add_prev="" add_next="" local previous_page="$msg_previous_page" next_page="$msg_next_page" if [ $page -gt 1 ]; then add_prev=1 # Accent the `Previous Page' item with an asterisk # if the page-before-previous is loaded/cached f_isset _index_page_${varcat}_$(( $page - 1 )) && previous_page="$previous_page*" fi if [ $page -lt $npages ]; then add_next=1 # Accent the `Next Page' item with an asterisk # if the page-after-next is loaded/cached f_isset _index_page_${varcat}_$(( $page + 1 )) && next_page="$next_page*" fi local index_page f_package_index_get_page "$category" $page index_page menu_list=" ${add_prev:+'> $previous_page' '' ${SHOW_DESC:+''}} ${add_next:+'> $next_page' '' ${SHOW_DESC:+''}} $( export SHOW_DESC export VALID_VARNAME_CHARS echo "$index_page" | awk -F'|' -v view="port" ' BEGIN { valid_chars = ENVIRON["VALID_VARNAME_CHARS"] prefix = "" } { cur_prefix = tolower(substr($1, 1, 1)) printf "'\''" if ( prefix != cur_prefix ) prefix = cur_prefix else printf " " package = $1 if ( view == "port" ) desc = $2 varpkg = package gsub("[^" valid_chars "]", "_", varpkg) mark = ENVIRON["_mark_" varpkg] if ( ! mark ) mark = " " printf "%s'\'' '\''[%c] %s'\''", package, mark, desc if ( ENVIRON["SHOW_DESC"] ) { help = $4 gsub(/'\''/, "'\''\\'\'\''", help) printf " '\''%s'\''", help } printf "\n" }' ) ${add_prev:+'> $previous_page' '' ${SHOW_DESC:+''}} ${add_next:+'> $next_page' '' ${SHOW_DESC:+''}} " # End-Quote # Accept/Translate i18n "All" but other category names must # match tree definitions from INDEX, ports, FTP, etc. case "$category" in "$msg_all"|"") f_category_desc_get "All" prompt ;; *) f_category_desc_get "$category" prompt ;; esac prompt="$prompt $( printf "$msg_page_of_npages" \ "$page" "$npages" )" local mheight mwidth mrows eval f_dialog_menu${SHOW_DESC:+_with_help}_size mheight mwidth mrows \ \"\$DIALOG_TITLE\" \"\$DIALOG_BACKTITLE\" \ \"\$prompt\" \"\$hline\" $menu_list local iheight iwidth f_dialog_infobox_size iheight iwidth \ "$DIALOG_TITLE" "$DIALOG_BACKTITLE" \ "$msg_processing_selection" local menu_choice menu_choice=$( eval $DIALOG \ --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ --keep-tite \ --ok-label \"$msg_select\" \ --cancel-label \"$msg_back\" \ ${SHOW_DESC:+--item-help} \ --default-item \"\$defaultitem\" \ --menu \"\$prompt\" \ $mheight $mwidth $mrows \ $menu_list \ --and-widget \ ${USE_XDIALOG:+--no-buttons} \ --infobox \"\$msg_processing_selection\" \ $iheight $iwidth \ 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD ) local retval=$? f_dialog_data_sanitize menu_choice f_dialog_menutag_store "$menu_choice" if [ $retval -eq $DIALOG_OK ]; then local item item=$( eval f_dialog_menutag2item${SHOW_DESC:+_with_help} \ \"\$menu_choice\" $menu_list ) f_dialog_menuitem_store "$item" fi return $retval } # f_package_menu_deselect $package # # Display a menu, asking the user what they would like to do with $package # with regard to "deselecting" an already installed package. Choices include # uninstall, re-install, or cancel (leave $package marked as installed). # Returns success if the user does not press ESC or choose Cnacel. Use the # f_dialog_menutag_fetch() function upon success to retrieve the user's choice. # f_package_menu_deselect() { local package="$1" local prompt # Calculated below local menu_list=" 'X $msg_installed' '$msg_installed_desc' 'R $msg_reinstall' '$msg_reinstall_desc' 'U $msg_uninstall' '$msg_uninstall_desc' " # End-Quote local hline="$hline_alnum_arrows_punc_tab_enter" prompt=$( printf "$msg_what_would_you_like_to_do_with" "$package" ) local height width rows eval f_dialog_menu_size height width rows \ \"\$DIALOG_TITLE\" \ \"\$DIALOG_BACKTITLE\" \ \"\$prompt\" \ \"\$hline\" \ $menu_list local menu_choice menu_choice=$( eval $DIALOG \ --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ --ok-label \"$msg_select\" \ --cancel-label \"$msg_cancel\" \ --menu \"\$prompt\" \ $height $width $rows \ $menu_list \ 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD ) local retval=$? f_dialog_menutag_store -s "$menu_choice" return $retval } # f_package_review # # Display a review screen, showing selected packages and what they are marked # for, before proceeding (if the user does not press ESC or choose Cancel) to # operate on each selection. Returns error if no packages have been selected, # or the user has pressed ESC, or if they have chosen Cancel. # f_package_review() { local prompt # Calculated below local menu_list # Calculated below local hline="$hline_alnum_arrows_punc_tab_enter" local fname=f_package_review f_dprintf "%s: SELECTED_PACKAGES=[%s]" $fname "$SELECTED_PACKAGES" prompt=$( printf "$msg_reviewing_selected_packages" "$_All_nselected" ) local package varpkg mark for package in $SELECTED_PACKAGES; do mark= f_str2varname "$package" varpkg f_getvar _mark_$varpkg mark [ "$mark" -a ! "${mark#[IRUD]}" ] || continue menu_list="$menu_list '$mark' '$package' " # End-Quote done if [ ! "$menu_list" ]; then f_show_msg "$msg_no_packages_were_selected_for_extraction" return $DIALOG_CANCEL # Might have selected this by accident fi menu_list=$( echo "$menu_list" | sort ) local height width rows eval f_dialog_menu_size height width rows \ \"\$DIALOG_TITLE\" \ \"\$DIALOG_BACKTITLE\" \ \"\$prompt\" \ \"\$hline\" \ $menu_list # Show the review menu (ignore menu choice) eval $DIALOG \ --title \"\$DIALOG_TITLE\" \ --backtitle \"\$DIALOG_BACKTITLE\" \ --hline \"\$hline\" \ --ok-label \"\$msg_proceed\" \ --cancel-label \"\$msg_cancel\" \ --menu \"\$prompt\" \ $height $width $rows \ $menu_list \ 2> /dev/null || return $? # Return if the user pressed ESC or chose Cancel/No # # Process each of the selected packages: # + First, process packages marked for Install. # + Second, process packages marked for Re-install. # + Finally, process packages marked for Uninstall. # for package in $SELECTED_PACKAGES; do mark= f_str2varname "$package" varpkg debug= f_getvar _mark_$varpkg mark [ "$mark" = "I" ] || continue f_dprintf "%s: Installing %s package" $fname "$package" f_package_add "$package" done for package in $SELECTED_PACKAGES; do mark= f_str2varname "$package" varpkg debug= f_getvar _mark_$varpkg mark [ "$mark" = "R" ] || continue f_dprintf "%s: Reinstalling %s package" $fname "$package" f_package_reinstall "$package" done for package in $SELECTED_PACKAGES; do mark= f_str2varname "$package" varpkg debug= f_getvar _mark_$varpkg mark [ "$mark" = "U" ] || continue f_dprintf "%s: Uninstalling %s package" $fname "$package" f_package_delete "$package" || continue f_package_deselect "$package" done return $DIALOG_OK } # f_package_config # # Allow the user to configure packages and install them. Initially, a list of # package categories is loaded/displayed. When the user selects a category, # the menus for that category are built (unlike sysinstall which built all # category menus up-front -- which also took forever, despite the fact that # few people visit more than a couple of categories each time). # f_package_config() { # Did we get an INDEX? f_index_initialize packages/INDEX || return $FAILURE # Creates following variables (indirectly via f_index_read()) # CATEGORY_MENU_LIST _categories_{varpkg} _rundeps_{varpkg} # PACKAGE_CATEGORIES _npkgs # Detect installed packages (updates marks/SELECTED_PACKAGES) f_package_detect_installed export PACKAGES_DETECTED=1 # exported for awk(1) ENVIRON[] local retval category varcat defaultitem category_defaultitem="" while :; do # Display the list of package categories f_package_menu_categories \ CATEGORY_MENU_LIST "$category_defaultitem" retval=$? f_dialog_menutag_fetch category f_dprintf "retval=%u mtag=[%s]" $retval "$category" category_defaultitem="$category" [ $retval -eq $DIALOG_OK ] || break # Maybe the user chose an action (like `Review') case "$category" in "> $msg_review") f_package_review && break continue ;; "> "*) continue esac # Anything else is a package category category=${category# } # Trim leading space if present category=${category%\*} # Trim trailing asterisk if present f_str2varname "$category" varcat local page package varpkg mark menu_choice while :; do # Display the list of packages for selected category page=1 defaultitem="" f_getvar _defaultitem_$varcat defaultitem f_getvar _defaultpage_$varcat page f_package_menu_select \ "$category" "${page:=1}" "$defaultitem" retval=$? f_dialog_menutag_fetch menu_choice f_dprintf "retval=%u mtag=[%s]" $retval "$menu_choice" # NOTE: When --and-widget is used only ESC will cause # dialog(1) to return without going to the next widget. # This is alright in our case as we can still detect # the Cancel button because stdout will be NULL. # Alternatively, Xdialog(1) will terminate with 1 # if/when Cancel is chosen on any widget. if [ $retval -eq $DIALOG_ESC -o ! "$menu_choice" ] then break elif [ $retval -eq $DIALOG_CANCEL ]; then # Using X11, Xdialog(1) returned 1 for Cancel f_show_msg "%s" "$menu_choice" break elif [ $retval -ne $DIALOG_OK ]; then # X11-related error occurred using Xdialog(1) f_show_msg "%s" "$menu_choice" break fi defaultitem="$menu_choice" # NOTE: f_package_menu_select() does not show the # `Previous Page' or `Next Page' items unless needed case "$menu_choice" in "> $msg_previous_page"|"> $msg_previous_page*") page=$(( $page - 1 )) setvar _defaultpage_$varcat $page # Update default-item to match accent that will # be applied by f_package_menu_select(); if the # page-before-prev is cached, add an asterisk. if f_isset \ _index_page_${varcat}_$(( $page - 1 )) then defaultitem="${defaultitem%\*}*" else defaultitem="${defaultitem%\*}" fi setvar _defaultitem_$varcat "$defaultitem" continue ;; "> $msg_next_page"|"> $msg_next_page*") page=$(( $page + 1 )) setvar _defaultpage_$varcat $page # Update default-item to match accent that will # be applied by f_package_menu_select(); if the # page-after-next is cached, add an asterisk. if f_isset \ _index_page_${varcat}_$(( $page + 1 )) then defaultitem="${defaultitem%\*}*" else defaultitem="${defaultitem%\*}" fi setvar _defaultitem_$varcat "$defaultitem" continue ;; "> "*) # Unknown navigation/action item setvar _defaultpage_$varcat $page continue ;; # Do not treat as a package *) setvar _defaultitem_$varcat "$defaultitem" esac # Treat any other selection as a package package="${menu_choice# }" # Trim leading space f_str2varname $package varpkg f_dialog_menuitem_fetch mark mark="${mark#?}" mark="${mark%%\] *}" case "$mark" in "I") mark=" " f_package_deselect $package ;; " "|"D") mark="I" f_package_select $package ;; "X"|"R"|"U") f_package_menu_deselect $package || continue f_dialog_menutag_fetch menu_choice case "$menu_choice" in "X $msg_installed") f_package_deselect "$package" mark="X" ;; "R $msg_reinstall") f_package_select "$package" mark="R" ;; "U $msg_uninstall") f_package_select "$package" mark="U" ;; esac ;; esac export _mark_$varpkg="$mark" # NOTE: exported for awk(1) ENVIRON[] done done } # f_package_add $package_name [$depended] # # Like f_package_extract(), but assumes current media device and chases deps. # Note that $package_name should not contain the archive suffix (e.g., `.tbz'). # If $depended is present and non-NULL, the package is treated as a dependency # (in this function, dependencies are not handled any differently, but the # f_package_extract() function is passed this value and it displays a different # message when installing a dependency versus non-dependency). # f_package_add() { local name="$1" depended="$2" status=$SUCCESS retval local alert=f_show_msg no_confirm= f_getvar $VAR_NO_CONFIRM no_confirm [ "$no_confirm" ] && alert=f_show_info if ! { [ "$name" ] || { f_getvar $VAR_PACKAGE name && [ "$name" ]; }; } then f_dprintf "packageAdd: %s" \ "$msg_no_package_name_passed_in_package_variable" return $FAILURE fi { # Verify and initialize device media if-defined f_media_verify && f_device_init media && f_index_initialize packages/INDEX } || return $FAILURE # Now we have (indirectly via f_index_read()): # CATEGORY_MENU_LIST _categories_{varpkg} _rundeps_{varpkg} # PACKAGE_CATEGORIES _npkgs local varpkg f_str2varname "$name" varpkg # Just as-in the user-interface (opposed to scripted-use), only allow # packages with at least one category to be recognized. # local pkgcat= if ! f_getvar _categories_$varpkg pkgcat || [ ! "$pkgcat" ]; then # $pkg may be a partial name, search the index (this is slow) f_index_search PACKAGE_INDEX $name name if [ ! "$name" ]; then f_show_msg \ "$msg_sorry_package_was_not_found_in_the_index" \ "$name" return $FAILURE fi f_str2varname "$name" varpkg fi # If invoked through the scripted interface, we likely have not yet # detected the installed packages -- something we should do only once. # if [ ! "$PACKAGES_DETECTED" ]; then f_dprintf "f_package_add: Detecting installed packages" f_package_detect_installed export PACKAGES_DETECTED=1 # exported for awk(1) ENVIRON[] fi # Now we have: _mark_{varpkg}=X for all installed packages # # Since we're maintaining data structures for installed packages, # short-circuit the package dependency checks if the package is already # installed. This prevents wasted cycles, minor delays between package # extractions, and worst-case an infinite loop with a certain faulty # INDEX file. # local mark= f_getvar _mark_$varpkg mark && [ "$mark" = "X" ] && return $SUCCESS local dep vardep rundeps= f_getvar _rundeps_$varpkg rundeps for dep in $rundeps; do f_str2varname "$dep" vardep # Skip dependency if already installed mark= f_getvar _mark_$vardep mark && [ "$mark" = "X" ] && continue # Just as-in the user-interface (opposed to scripted-use), only # allow packages with at least one category to be recognized. # local depcat= if ! f_getvar _categories_$vardep depcat || [ ! "$depcat" ] then $alert "$msg_required_package_not_found" "$dep" [ "$no_confirm" ] && sleep 2 fi f_package_add "$dep" retval=$? if [ $retval -ne $SUCCESS ]; then status=$(( $status | $retval )) # XXX package could be on a future disc volume # XXX (not supporting multiple disc volumes yet) $alert "$msg_loading_of_dependent_package_failed" \ "$dep" [ "$no_confirm" ] && sleep 2 fi done [ $status -eq $SUCCESS ] || return $status # # Done with the deps? Try to load the real m'coy. # f_package_extract media "$name" "$depended" retval=$? if [ $retval -ne $SUCCESS ]; then status=$(( $status | $retval )) else setvar _mark_$varpkg X fi return $status } # f_package_extract $device $name [$depended] # # Extract a package based on a namespec and media device. If $depended is # present and non-NULL, the notification displayed while installing the package # has "as a dependency" appended. # f_package_extract() { local device="$1" name="$2" depended="$3" local fname=f_package_extract f_dprintf "%s: device=[%s] name=[%s] depended=[%s]" \ $fname "$device" "$name" "$depended" # Check to make sure it's not already there local varpkg mark= f_str2varname "$name" varpkg f_getvar _mark_$varpkg mark [ "$mark" = "X" ] && return $SUCCESS if ! f_device_init $device; then f_show_msg \ "$msg_unable_to_initialize_media_type_for_package_extract" return $FAILURE fi # If necessary, initialize the ldconfig hints [ -f "/var/run/ld-elf.so.hints" ] || f_quietly ldconfig /usr/lib /usr/lib/compat /usr/local/lib # Make a couple paranoid locations for temp # files to live if user specified none local tmpdir f_getvar $VAR_PKG_TMPDIR:-/var/tmp tmpdir f_quietly mkdir -p -m 1777 "$tmpdir" local path case "$name" in */*) path="$name" ;; *) path="All/$name" ;; esac # We have a path, call the device strategy routine to check the file local pkg_ext found= for pkg_ext in "" $PACKAGE_EXTENSIONS; do if f_device_get $device "$path$pkg_ext" $PROBE_EXIST; then path="$path$pkg_ext" f_dprintf "%s: found path=[%s] dev=[%s]" \ $fname "$path" "$device" found=1 break fi done local alert=f_show_msg no_confirm= f_getvar $VAR_NO_CONFIRM no_confirm [ "$no_confirm" ] && alert=f_show_info if [ ! "$found" ]; then f_dprintf "%s: No such %s file on %s device" \ $fname "$path" "$device" $alert "$msg_unable_to_fetch_package_from_selected_media" \ "$name" [ "$no_confirm" ] && sleep 2 return $FAILURE fi local orphan devname= f_struct device_$device get name devname if [ "$depended" ]; then f_show_info "$msg_adding_package_as_a_dependency_from_media" \ "$name" "$devname" else f_show_info "$msg_adding_package_from_media" "$name" "$devname" fi # Request the package be added via pkg-install(8) if f_debugging; then pkg -d install -y $orphan "$name" else f_quietly pkg install -y "$name" fi if [ $? -ne $SUCCESS ]; then $alert "$msg_pkg_install_apparently_did_not_like_the_package" \ "$name" [ "$no_confirm" ] && sleep 2 else f_show_info "$msg_package_was_added_successfully" "$name" sleep 1 fi return $SUCCESS } # f_package_delete $name # # Delete package by full $name (lacks archive suffix; e.g., `.tbz'). # f_package_delete() { local name="$1" local fname=f_package_delete if ! { [ "$name" ] || { f_getvar $VAR_PACKAGE name && [ "$name" ]; }; } then f_dprintf "packageDelete: %s" \ "$msg_no_package_name_passed_in_package_variable" return $FAILURE fi f_dprintf "%s: name=[%s]" $fname "$name" [ "$name" ] || return $FAILURE { # Verify and initialize device media if-defined f_media_verify && f_device_init media && f_index_initialize packages/INDEX } || return $FAILURE # Now we have (indirectly via f_index_read()): # CATEGORY_MENU_LIST _categories_{varpkg} _rundeps_{varpkg} # PACKAGE_CATEGORIES _npkgs local varpkg f_str2varname "$name" varpkg # Just as-in the user-interface (opposed to scripted-use), only allow # packages with at least one category to be recognized. # local pkgcat= if ! f_getvar _categories_$varpkg pkgcat || [ ! "$pkgcat" ]; then # $pkg may be a partial name, search the index (this is slow) f_index_search PACKAGE_INDEX "$name" name if [ ! "$name" ]; then f_show_msg \ "$msg_sorry_package_was_not_found_in_the_index" \ "$name" return $FAILURE fi f_str2varname "$name" varpkg fi # If invoked through the scripted interface, we likely have not yet # detected the installed packages -- something we should do only once. # if [ ! "$PACKAGES_DETECTED" ]; then f_dprintf "%s: Detecting installed packages" $fname f_package_detect_installed export PACKAGES_DETECTED=1 # exported for awk(1) ENVIRON[] fi # Now we have: _mark_{varpkg}=X for all installed packages # # Return failure if the package is not already installed. # local pkgmark= f_getvar _mark_$varpkg pkgmark if ! [ "$pkgmark" -a ! "${pkgmark#[XUR]}" ]; then f_show_msg "$msg_package_not_installed_cannot_delete" "$name" return $FAILURE fi # # Check for dependencies # local pkgsel depc=0 udeps= for pkgsel in $SELECTED_PACKAGES; do local mark= f_str2varname $pkgsel varpkg debug= f_getvar _mark_$varpkg mark [ "$mark" -a ! "${mark#[XUR]}" ] || continue local dep rundeps= debug= f_getvar _rundeps_$varpkg rundeps for dep in $rundeps; do if [ "$dep" = "$name" ]; then # Maybe this package is marked for deletion too if [ "$mark" = "U" ]; then udeps="$udeps $pkgsel" else depc=$(( $depc + 1 )) fi break fi done done if [ $depc -gt 0 ]; then local grammatical_s= [ $depc -gt 1 ] && grammatical_s=s f_show_msg \ "$msg_package_is_needed_by_other_installed_packages" \ "$name" "$depc" "$grammatical_s" return $FAILURE fi # # Chase dependencies that are marked for uninstallation # for pkgsel in $udeps; do - f_dprintf "%s: Uninstalling dependecy %s (marked for delete)" \ - $fname "$pkgsel" + f_dprintf "%s: Uninstalling dependency %s (%s)" \ + $fname "$pkgsel" "marked for delete" f_package_delete "$pkgsel" done # # OK to perform the delete (no other packages depend on it)... # f_show_info "$msg_uninstalling_package_waiting_for_pkg_delete" "$name" if f_debugging; then pkg -d delete -y "$name" else f_quietly pkg delete -y "$name" fi if [ $? -ne $SUCCESS ]; then f_show_msg "$msg_pkg_delete_failed" "$name" return $FAILURE else f_dprintf "%s: pkg-delete(8) of %s successful" $fname "$name" f_str2varname "$name" varpkg setvar _mark_$varpkg "" fi } # f_package_reinstall $name # # A simple wrapper to f_package_delete() + f_package_add() # f_package_reinstall() { f_package_delete "$1" && f_package_add "$1" } ############################################################ MAIN f_dprintf "%s: Successfully loaded." packages/packages.subr fi # ! $_PACKAGES_PACKAGES_SUBR