1250323Sdteske#!/bin/sh
2250323Sdteske#-
3250323Sdteske# Copyright (c) 2013 Devin Teske
4252980Sdteske# All rights reserved.
5250323Sdteske#
6250323Sdteske# Redistribution and use in source and binary forms, with or without
7250323Sdteske# modification, are permitted provided that the following conditions
8250323Sdteske# are met:
9250323Sdteske# 1. Redistributions of source code must retain the above copyright
10250323Sdteske#    notice, this list of conditions and the following disclaimer.
11250323Sdteske# 2. Redistributions in binary form must reproduce the above copyright
12250323Sdteske#    notice, this list of conditions and the following disclaimer in the
13250323Sdteske#    documentation and/or other materials provided with the distribution.
14250323Sdteske#
15250323Sdteske# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16252987Sdteske# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17250323Sdteske# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18250323Sdteske# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19250323Sdteske# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20252987Sdteske# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21250323Sdteske# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22250323Sdteske# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23250323Sdteske# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24250323Sdteske# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25250323Sdteske# SUCH DAMAGE.
26250323Sdteske#
27250323Sdteske# $FreeBSD$
28250323Sdteske#
29250323Sdteske############################################################ INCLUDES
30250323Sdteske
31250323Sdteske# Prevent device.subr (included indirectly via media/*.subr below) from auto
32250323Sdteske# scanning; we'll perform this manually using f_device_get_all() during init
33250323Sdteske# but only after we've successfully completed f_mustberoot_init().
34250323Sdteske#
35250323SdteskeDEVICE_SELF_SCAN_ALL=NO
36250323Sdteske
37250323SdteskeBSDCFG_SHARE="/usr/share/bsdconfig"
38250323Sdteske. $BSDCFG_SHARE/common.subr || exit 1
39250323Sdteskef_dprintf "%s: loading includes..." "$0"
40250323Sdteskef_include $BSDCFG_SHARE/dialog.subr
41258266Sdteskef_include $BSDCFG_SHARE/media/common.subr
42250323Sdteskef_include $BSDCFG_SHARE/mustberoot.subr
43250323Sdteskef_include $BSDCFG_SHARE/packages/packages.subr
44250323Sdteske
45250323SdteskeBSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="030.packages"
46250323Sdteskef_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
47250323Sdteske
48259054Sdteskef_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" ipgm &&
49259054Sdteske	pgm="${ipgm:-$pgm}"
50250323Sdteske
51250323Sdteske############################################################ MAIN
52250323Sdteske
53250323Sdteske# Incorporate rc-file if it exists
54250323Sdteske[ -f "$HOME/.bsdconfigrc" ] && f_include "$HOME/.bsdconfigrc"
55250323Sdteske
56250323Sdteske#
57250323Sdteske# Process command-line arguments
58250323Sdteske#
59250633Sdteskewhile getopts h$GETOPTS_STDARGS flag; do
60250323Sdteske	case "$flag" in
61252178Sdteske	h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm" ;;
62250323Sdteske	esac
63250323Sdteskedone
64250323Sdteskeshift $(( $OPTIND - 1 ))
65250323Sdteske
66250323Sdteske#
67250323Sdteske# Initialize
68250323Sdteske#
69250323Sdteskef_dialog_title "$msg_package_selection"
70250323Sdteskef_dialog_backtitle "${ipgm:+bsdconfig }$pgm"
71250323Sdteskef_mustberoot_init
72250323Sdteskef_device_get_all
73250323Sdteske
74250323Sdteske#
75250323Sdteske# Display the package configuration menu and exit
76250323Sdteske#
77258266Sdtesketrap 'f_media_close' EXIT
78250323Sdteskef_package_config
79251930Sdteske
80251930Sdteske################################################################################
81251930Sdteske# END
82251930Sdteske################################################################################
83