xref: /freebsd/usr.sbin/bsdconfig/packages/packages (revision c3755aa30cbddc30cbdc26707aac2606e9cd6ec5)
187c16275SDevin Teske#!/bin/sh
287c16275SDevin Teske#-
387c16275SDevin Teske# Copyright (c) 2013 Devin Teske
487c16275SDevin Teske# All Rights Reserved.
587c16275SDevin Teske#
687c16275SDevin Teske# Redistribution and use in source and binary forms, with or without
787c16275SDevin Teske# modification, are permitted provided that the following conditions
887c16275SDevin Teske# are met:
987c16275SDevin Teske# 1. Redistributions of source code must retain the above copyright
1087c16275SDevin Teske#    notice, this list of conditions and the following disclaimer.
1187c16275SDevin Teske# 2. Redistributions in binary form must reproduce the above copyright
1287c16275SDevin Teske#    notice, this list of conditions and the following disclaimer in the
1387c16275SDevin Teske#    documentation and/or other materials provided with the distribution.
1487c16275SDevin Teske#
1587c16275SDevin Teske# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1687c16275SDevin Teske# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, THE
1787c16275SDevin Teske# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1887c16275SDevin Teske# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1987c16275SDevin Teske# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2087c16275SDevin Teske# DAMAGES (INLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2187c16275SDevin Teske# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2287c16275SDevin Teske# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2387c16275SDevin Teske# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2487c16275SDevin Teske# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2587c16275SDevin Teske# SUCH DAMAGE.
2687c16275SDevin Teske#
2787c16275SDevin Teske# $FreeBSD$
2887c16275SDevin Teske#
2987c16275SDevin Teske############################################################ INCLUDES
3087c16275SDevin Teske
3187c16275SDevin Teske# Prevent device.subr (included indirectly via media/*.subr below) from auto
3287c16275SDevin Teske# scanning; we'll perform this manually using f_device_get_all() during init
3387c16275SDevin Teske# but only after we've successfully completed f_mustberoot_init().
3487c16275SDevin Teske#
3587c16275SDevin TeskeDEVICE_SELF_SCAN_ALL=NO
3687c16275SDevin Teske
3787c16275SDevin TeskeBSDCFG_SHARE="/usr/share/bsdconfig"
3887c16275SDevin Teske. $BSDCFG_SHARE/common.subr || exit 1
3987c16275SDevin Teskef_dprintf "%s: loading includes..." "$0"
4087c16275SDevin Teskef_include $BSDCFG_SHARE/dialog.subr
4187c16275SDevin Teskef_include $BSDCFG_SHARE/mustberoot.subr
4287c16275SDevin Teskef_include $BSDCFG_SHARE/packages/packages.subr
4387c16275SDevin Teske
4487c16275SDevin TeskeBSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="030.packages"
4587c16275SDevin Teskef_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
4687c16275SDevin Teske
4787c16275SDevin Teskeipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
4887c16275SDevin Teske[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
4987c16275SDevin Teske
5087c16275SDevin Teske############################################################ MAIN
5187c16275SDevin Teske
5287c16275SDevin Teske# Incorporate rc-file if it exists
5387c16275SDevin Teske[ -f "$HOME/.bsdconfigrc" ] && f_include "$HOME/.bsdconfigrc"
5487c16275SDevin Teske
5587c16275SDevin Teske#
5687c16275SDevin Teske# Process command-line arguments
5787c16275SDevin Teske#
58*c3755aa3SDevin Teskewhile getopts h$GETOPTS_STDARGS flag; do
5987c16275SDevin Teske	case "$flag" in
6087c16275SDevin Teske	h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";;
6187c16275SDevin Teske	esac
6287c16275SDevin Teskedone
6387c16275SDevin Teskeshift $(( $OPTIND - 1 ))
6487c16275SDevin Teske
6587c16275SDevin Teske#
6687c16275SDevin Teske# Initialize
6787c16275SDevin Teske#
6887c16275SDevin Teskef_dialog_title "$msg_package_selection"
6987c16275SDevin Teskef_dialog_backtitle "${ipgm:+bsdconfig }$pgm"
7087c16275SDevin Teskef_mustberoot_init
7187c16275SDevin Teskef_device_get_all
7287c16275SDevin Teske
7387c16275SDevin Teske#
7487c16275SDevin Teske# Display the package configuration menu and exit
7587c16275SDevin Teske#
7687c16275SDevin Teskef_package_config
77