xref: /freebsd/usr.sbin/bsdconfig/packages/packages (revision d0b2dbfa0ecf2bbc9709efc5e20baf8e4b44bbbf)
187c16275SDevin Teske#!/bin/sh
287c16275SDevin Teske#-
387c16275SDevin Teske# Copyright (c) 2013 Devin Teske
4f8ea072aSDevin 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
168e37a7c8SDevin 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
208e37a7c8SDevin Teske# DAMAGES (INCLUDING, 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#
2887c16275SDevin Teske############################################################ INCLUDES
2987c16275SDevin Teske
3087c16275SDevin Teske# Prevent device.subr (included indirectly via media/*.subr below) from auto
3187c16275SDevin Teske# scanning; we'll perform this manually using f_device_get_all() during init
3287c16275SDevin Teske# but only after we've successfully completed f_mustberoot_init().
3387c16275SDevin Teske#
3487c16275SDevin TeskeDEVICE_SELF_SCAN_ALL=NO
3587c16275SDevin Teske
3687c16275SDevin TeskeBSDCFG_SHARE="/usr/share/bsdconfig"
3787c16275SDevin Teske. $BSDCFG_SHARE/common.subr || exit 1
3887c16275SDevin Teskef_dprintf "%s: loading includes..." "$0"
3987c16275SDevin Teskef_include $BSDCFG_SHARE/dialog.subr
406ef6ba99SDevin Teskef_include $BSDCFG_SHARE/media/common.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
47*d4ae33f0SDevin Teskef_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" ipgm &&
48*d4ae33f0SDevin Teske	pgm="${ipgm:-$pgm}"
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#
58c3755aa3SDevin 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#
766ef6ba99SDevin Tesketrap 'f_media_close' EXIT
7787c16275SDevin Teskef_package_config
78997cf00aSDevin Teske
79997cf00aSDevin Teske################################################################################
80997cf00aSDevin Teske# END
81997cf00aSDevin Teske################################################################################
82