167204Sobrien#!/bin/sh 267204Sobrien#- 3139749Simp# Copyright (c) 2006-2013 Devin Teske 467204Sobrien# All rights reserved. 567204Sobrien# 667204Sobrien# Redistribution and use in source and binary forms, with or without 767204Sobrien# modification, are permitted provided that the following conditions 867204Sobrien# are met: 967204Sobrien# 1. Redistributions of source code must retain the above copyright 1067204Sobrien# notice, this list of conditions and the following disclaimer. 1167204Sobrien# 2. Redistributions in binary form must reproduce the above copyright 1267204Sobrien# notice, this list of conditions and the following disclaimer in the 1367204Sobrien# documentation and/or other materials provided with the distribution. 1467204Sobrien# 1567204Sobrien# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1667204Sobrien# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1767204Sobrien# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1867204Sobrien# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1967204Sobrien# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2067204Sobrien# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2167204Sobrien# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2267204Sobrien# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2367204Sobrien# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2467204Sobrien# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2567204Sobrien# SUCH DAMAGE. 2667204Sobrien# 2767204Sobrien# $FreeBSD: releng/10.2/usr.sbin/bsdconfig/networking/hostname 260678 2014-01-15 07:49:17Z dteske $ 2867204Sobrien# 2967204Sobrien############################################################ INCLUDES 3067204Sobrien 3167204Sobrien# Prevent device.subr (included indirectly) from auto scanning on load 3267204SobrienDEVICE_SELF_SCAN_ALL=NO 3367204Sobrien 3467204SobrienBSDCFG_SHARE="/usr/share/bsdconfig" 3567204Sobrien. $BSDCFG_SHARE/common.subr || exit 1 3667204Sobrienf_dprintf "%s: loading includes..." "$0" 3767204Sobrienf_include $BSDCFG_SHARE/dialog.subr 3867204Sobrienf_include $BSDCFG_SHARE/mustberoot.subr 3967204Sobrienf_include $BSDCFG_SHARE/networking/hostname.subr 4067204Sobrien 4167204SobrienBSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="120.networking" 4267204Sobrienf_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr 4367204Sobrien 4467204Sobrienf_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" ipgm && 4567204Sobrien pgm="${ipgm:-$pgm}" 4667204Sobrien 4767204Sobrien############################################################ MAIN 4867204Sobrien 4967204Sobrien# Incorporate rc-file if it exists 5067204Sobrien[ -f "$HOME/.bsdconfigrc" ] && f_include "$HOME/.bsdconfigrc" 5167204Sobrien 5267204Sobrien# 5367204Sobrien# Process command-line arguments 5467204Sobrien# 5567204Sobrienwhile getopts h$GETOPTS_STDARGS flag; do 5667204Sobrien case "$flag" in 5767204Sobrien h|\?) f_usage $BSDCFG_LIBE/$APP_DIR/USAGE "PROGRAM_NAME" "$pgm" ;; 5867204Sobrien esac 5967204Sobriendone 60194138Smariusshift $(( $OPTIND - 1 )) 61194138Smarius 6278877Sbenno# 63186347Snwhitehorn# Initialize 64186347Snwhitehorn# 6567204Sobrienf_dialog_title "$msg_hostname_domain" 66133862Smariusf_dialog_backtitle "${ipgm:+bsdconfig }$pgm" 6767204Sobrienf_mustberoot_init 6867204Sobrien 69194138Smarius# 70186347Snwhitehorn# Change the local hostname 71186347Snwhitehorn# 72105397Stmmf_dialog_input_hostname 73105397Stmm 7486557Stmm################################################################################ 7567204Sobrien# END 76186347Snwhitehorn################################################################################ 77186347Snwhitehorn