xref: /freebsd/usr.sbin/bsdconfig/packages/packages (revision 87c1627502a5dde91e5284118eec8682b60f27a2)
1*87c16275SDevin Teske#!/bin/sh
2*87c16275SDevin Teske#-
3*87c16275SDevin Teske# Copyright (c) 2013 Devin Teske
4*87c16275SDevin Teske# All Rights Reserved.
5*87c16275SDevin Teske#
6*87c16275SDevin Teske# Redistribution and use in source and binary forms, with or without
7*87c16275SDevin Teske# modification, are permitted provided that the following conditions
8*87c16275SDevin Teske# are met:
9*87c16275SDevin Teske# 1. Redistributions of source code must retain the above copyright
10*87c16275SDevin Teske#    notice, this list of conditions and the following disclaimer.
11*87c16275SDevin Teske# 2. Redistributions in binary form must reproduce the above copyright
12*87c16275SDevin Teske#    notice, this list of conditions and the following disclaimer in the
13*87c16275SDevin Teske#    documentation and/or other materials provided with the distribution.
14*87c16275SDevin Teske#
15*87c16275SDevin Teske# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16*87c16275SDevin Teske# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, THE
17*87c16275SDevin Teske# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18*87c16275SDevin Teske# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19*87c16275SDevin Teske# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20*87c16275SDevin Teske# DAMAGES (INLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21*87c16275SDevin Teske# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22*87c16275SDevin Teske# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23*87c16275SDevin Teske# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24*87c16275SDevin Teske# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25*87c16275SDevin Teske# SUCH DAMAGE.
26*87c16275SDevin Teske#
27*87c16275SDevin Teske# $FreeBSD$
28*87c16275SDevin Teske#
29*87c16275SDevin Teske############################################################ INCLUDES
30*87c16275SDevin Teske
31*87c16275SDevin Teske# Prevent device.subr (included indirectly via media/*.subr below) from auto
32*87c16275SDevin Teske# scanning; we'll perform this manually using f_device_get_all() during init
33*87c16275SDevin Teske# but only after we've successfully completed f_mustberoot_init().
34*87c16275SDevin Teske#
35*87c16275SDevin TeskeDEVICE_SELF_SCAN_ALL=NO
36*87c16275SDevin Teske
37*87c16275SDevin TeskeBSDCFG_SHARE="/usr/share/bsdconfig"
38*87c16275SDevin Teske. $BSDCFG_SHARE/common.subr || exit 1
39*87c16275SDevin Teskef_dprintf "%s: loading includes..." "$0"
40*87c16275SDevin Teskef_include $BSDCFG_SHARE/dialog.subr
41*87c16275SDevin Teskef_include $BSDCFG_SHARE/mustberoot.subr
42*87c16275SDevin Teskef_include $BSDCFG_SHARE/packages/packages.subr
43*87c16275SDevin Teske
44*87c16275SDevin TeskeBSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="030.packages"
45*87c16275SDevin Teskef_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
46*87c16275SDevin Teske
47*87c16275SDevin Teskeipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
48*87c16275SDevin Teske[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
49*87c16275SDevin Teske
50*87c16275SDevin Teske############################################################ MAIN
51*87c16275SDevin Teske
52*87c16275SDevin Teske# Incorporate rc-file if it exists
53*87c16275SDevin Teske[ -f "$HOME/.bsdconfigrc" ] && f_include "$HOME/.bsdconfigrc"
54*87c16275SDevin Teske
55*87c16275SDevin Teske#
56*87c16275SDevin Teske# Process command-line arguments
57*87c16275SDevin Teske#
58*87c16275SDevin Teskewhile getopts dD:hSX flag; do
59*87c16275SDevin Teske	case "$flag" in
60*87c16275SDevin Teske	h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";;
61*87c16275SDevin Teske	esac
62*87c16275SDevin Teskedone
63*87c16275SDevin Teskeshift $(( $OPTIND - 1 ))
64*87c16275SDevin Teske
65*87c16275SDevin Teske#
66*87c16275SDevin Teske# Initialize
67*87c16275SDevin Teske#
68*87c16275SDevin Teskef_dialog_title "$msg_package_selection"
69*87c16275SDevin Teskef_dialog_backtitle "${ipgm:+bsdconfig }$pgm"
70*87c16275SDevin Teskef_mustberoot_init
71*87c16275SDevin Teskef_device_get_all
72*87c16275SDevin Teske
73*87c16275SDevin Teske#
74*87c16275SDevin Teske# Display the package configuration menu and exit
75*87c16275SDevin Teske#
76*87c16275SDevin Teskef_package_config
77