Revision 8d77389f

b/create
147 147
      ROOT_DEV=$root_dev
148 148
      BOOT_DEV=$boot_dev
149 149
      IMG_PASSWD=$IMG_PASSWD
150
      export TARGET SUITE BLOCKDEV ROOT_DEV BOOT_DEV IMAGE_TYPE IMG_PASSWD
150
      HOSTNAME=$instance
151
      export TARGET SUITE BLOCKDEV ROOT_DEV BOOT_DEV IMAGE_TYPE IMG_PASSWD HOSTNAME
151 152
      $RUN_PARTS $CUSTOMIZE_DIR/$OS_FAMILY
152 153
    fi
153 154
fi
b/example/hooks/linux/hostname
1
#!/bin/bash
2

  
3
set -e 
4
. common.sh
5
. common_linux.sh
6

  
7
debug set -x
8

  
9
CLEANUP=( )
10

  
11
trap cleanup EXIT
12

  
13
if [ -z "${HOSTNAME}" ] ; then
14
    log_error "Missing hostname"
15
    exit 1
16
fi
17

  
18
if [ -z "${TARGET}" -o ! -d "${TARGET}" ] ; then
19
    log_error "Missing target directory"
20
    exit 1
21
fi
22

  
23
get_os_type $TARGET
24

  
25
case "${OS_TYPE}" in
26
    debian)
27
        echo $HOSTNAME > ${TARGET}/etc/hostname
28
        ;;
29
    redhat)
30
        sed -ie "s/HOSTNAME=.*$/HOSTNAME=$HOSTNAME/g" ${TARGET}/etc/sysconfig/network
31

  
32
        ;;
33
    slackware|suse)
34
        #local domain=$(sed -e 's/^[^\.]*//g' < /etc/HOSTNAME)
35
        
36
        # In slackware hostname and domain name are joined together. For now I
37
        # will not retain the domain name.
38
        
39
        echo $HOSTNAME > ${TARGET}/etc/HOSTNAME
40
        ;;
41
    gentoo)
42
        sed -ie "s/\(\(HOSTNAME\)\|\(hostname\)\)=.*$/\1=\"${instance}\"/" ${TARGET}/etc/conf.d/hostname
43
        ;;
44
esac
45

  
46
# execute cleanups
47
cleanup
48
trap - EXIT
49

  
50
exit 0

Also available in: Unified diff