hostname revision 240684
1250323Sdteske#!/bin/sh
2250323Sdteske#-
3250323Sdteske# Copyright (c) 2006-2012 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 (INLUDING, 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: head/usr.sbin/bsdconfig/networking/hostname 240684 2012-09-18 22:28:42Z dteske $
28250323Sdteske#
29250323Sdteske############################################################ INCLUDES
30250323Sdteske
31250323SdteskeBSDCFG_SHARE="/usr/share/bsdconfig"
32250323Sdteske. $BSDCFG_SHARE/common.subr || exit 1
33250323Sdteskef_include $BSDCFG_SHARE/dialog.subr
34250323Sdteskef_include $BSDCFG_SHARE/mustberoot.subr
35250323Sdteskef_include $BSDCFG_SHARE/networking/hostname.subr
36250323Sdteske
37250323SdteskeBSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="120.networking"
38250323Sdteskef_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr
39250323Sdteske
40250323Sdteskeipgm=$( f_index_menu_selection $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
41250323Sdteske[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"
42250323Sdteske
43250323Sdteske############################################################ MAIN
44250323Sdteske
45250323Sdteske# Incorporate rc-file if it exists
46257795Sdteske[ -f "$HOME/.bsdconfigrc" ] && f_include "$HOME/.bsdconfigrc"
47257795Sdteske
48257795Sdteske#
49257795Sdteske# Process command-line arguments
50257795Sdteske#
51257795Sdteskewhile getopts hSX flag; do
52257795Sdteske	case "$flag" in
53257795Sdteske	h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm";;
54257795Sdteske	esac
55257795Sdteskedone
56257795Sdteskeshift $(( $OPTIND - 1 ))
57257795Sdteske
58257795Sdteske#
59257795Sdteske# Initialize
60257795Sdteske#
61257795Sdteskef_dialog_init
62257795Sdteskef_dialog_title "$msg_hostname_domain"
63257795Sdteskef_dialog_backtitle "${ipgm:+bsdconfig }$pgm"
64257795Sdteskef_mustberoot_init
65257795Sdteske
66257795Sdteske#
67257795Sdteske# Change the local hostname
68257795Sdteske#
69257795Sdteskef_dialog_input_hostname
70257795Sdteske
71257795Sdteske################################################################################
72257795Sdteske# END
73257795Sdteske################################################################################
74257795Sdteske