2 # Filename: /etc/grml/fai/config/scripts/GRMLBASE/05-hostname
3 # Purpose: set hostname of live-system
4 # Authors: grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
5 # Bug-Reports: see http://grml.org/bugs/
6 # License: This file is licensed under the GPL v2 or any later version.
7 ################################################################################
13 [ -r /etc/grml/grml-live.conf ] && . /etc/grml/grml-live.conf
14 [ -r /etc/grml/grml-live.local ] && . /etc/grml/grml-live.local
15 [ -n "$HOSTNAME" ] || HOSTNAME=grml
17 # the hostname of the chroot usually isn't the same as the one for the live-system
18 BUILD_HOSTNAME="$($ROOTCMD hostname)"
19 [ -n "$BUILD_HOSTNAME" ] || BUILD_HOSTNAME="grml"
21 echo "$HOSTNAME" > $target/etc/hostname
22 echo "$HOSTNAME" > $target/etc/mailname
24 if [ -r $target/etc/postfix/main.cf ] ; then
25 sed -i "s/^mydestination = .*/mydestination = $HOSTNAME, localhost, localhost.localdomain/" $target/etc/postfix/main.cf
26 sed -i "s/^myhostname = .*/myhostname = $HOSTNAME/" $target/etc/postfix/main.cf
27 echo "postfix postfix/mailname string $HOSTNAME" | $ROOTCMD debconf-set-selections
28 echo "postfix postfix/destinations string ${HOSTNAME}, localhost.grml.org, localhost" \
29 | $ROOTCMD debconf-set-selections
30 # make sure to execute newaliases after adjusting configuration,
31 # otherwise the old hostname will be left inside /etc/aliases.db
35 if [ -r $target/etc/bacula/bacula-fd.conf ] ; then
36 sed -i "s/$BUILD_HOSTNAME/$HOSTNAME/g" $target/etc/bacula/bacula-fd.conf
39 ## END OF FILE #################################################################
40 # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=3