wok annotate vzctl/stuff/slitaz-set_hostname.sh @ rev 9215

mc, samba, perl-curses: use ncursesw instead of ncurses
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Mar 11 11:47:15 2011 +0100 (2011-03-11)
parents
children
rev   line source
erjo@8056 1 #!/bin/bash
erjo@8056 2 # Copyright (C) 2000-2009, Parallels, Inc. All rights reserved.
erjo@8056 3 # Copyright (C) 2011 Eric Joseph-Alexandre <erjo@slitaz.org>
erjo@8056 4 #
erjo@8056 5 # This program is free software; you can redistribute it and/or modify
erjo@8056 6 # it under the terms of the GNU General Public License as published by
erjo@8056 7 # the Free Software Foundation; either version 2 of the License, or
erjo@8056 8 # (at your option) any later version.
erjo@8056 9 #
erjo@8056 10 # This program is distributed in the hope that it will be useful,
erjo@8056 11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
erjo@8056 12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
erjo@8056 13 # GNU General Public License for more details.
erjo@8056 14 #
erjo@8056 15 # You should have received a copy of the GNU General Public License
erjo@8056 16 # along with this program; if not, write to the Free Software
erjo@8056 17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
erjo@8056 18 #
erjo@8056 19 #
erjo@8056 20 # Sets up hostname in a container running slitaz-like distro.
erjo@8056 21
erjo@8056 22 function set_hostname()
erjo@8056 23 {
erjo@8056 24 local cfgfile="$1"
erjo@8056 25 local hostname=$2
erjo@8056 26
erjo@8056 27 [ -z "${hostname}" ] && return 0
erjo@8056 28
erjo@8056 29 hostname=${hostname%%.*}
erjo@8056 30
erjo@8056 31 echo "${hostname}" > ${cfgfile}
erjo@8056 32
erjo@8056 33 hostname ${hostname}
erjo@8056 34 }
erjo@8056 35
erjo@8056 36 change_hostname /etc/hosts "${HOSTNM}" "${IP_ADDR}"
erjo@8056 37 set_hostname /etc/hostname "${HOSTNM}"
erjo@8056 38
erjo@8056 39 exit 0