Revision 9f4b2c31

b/common.sh.in
291 291
EOF
292 292
}
293 293

  
294
setup_console() {
295
    local target=$1
296
    if [ -z "$target" ] ; then
297
        log_error "target not set for setup_console"
298
        exit 1
299
    fi
300
    # Upstart is on this system, so do this instead
301
    if [ -e ${target}/etc/event.d/tty1 ] ; then
302
        cat ${target}/etc/event.d/tty1 | sed -re 's/tty1/ttyS0/' \
303
            > ${target}/etc/event.d/ttyS0
304
        return
305
    fi
306
    get_os $target
307
    case $OPERATING_SYSTEM in
308
        gentoo)
309
            sed -i -e 's/.*ttyS0.*/s0:12345:respawn:\/sbin\/agetty 115200 ttyS0 vt100/' \
310
                ${target}/etc/inittab
311
            ;;
312
        centos)
313
            echo "s0:12345:respawn:/sbin/mingetty 115200 ttyS0 vt100" >> \
314
                ${target}/etc/inittab
315
            ;;
316
        debian|ubuntu)
317
            sed -i -e 's/.*T0.*/T0:23:respawn:/sbin/getty -L ttyS0 115200 vt100' \
318
                ${target}/etc/inittab
319
            ;;
320
        *)
321
            echo "No support for your OS in instance-image, skipping..."
322
            ;;
323
    esac
324
}
325

  
294 326
cleanup() {
295 327
  if [ ${#CLEANUP[*]} -gt 0 ]; then
296 328
    LAST_ELEMENT=$((${#CLEANUP[*]}-1))
b/create
95 95
        setup_fstab $TARGET
96 96
    fi
97 97

  
98
    if [ "${INSTANCE_HV_serial_console}" = "True" ] ; then
99
        setup_console $TARGET
100
    fi
101

  
98 102
    RUN_PARTS=`which run-parts`
99 103

  
100 104
    if [ -n "$RUN_PARTS" -a -n "$CUSTOMIZE_DIR" -a -d "$CUSTOMIZE_DIR" ]; then
b/import
59 59

  
60 60
setup_fstab $TARGET
61 61

  
62
if [ "${INSTANCE_HV_serial_console}" = "True" ] ; then
63
    setup_console $TARGET
64
fi
65

  
62 66
rm -f $TARGET/etc/udev/rules.d/z*_persistent-net.rules
63 67

  
64 68
if [ -n "$CUSTOMIZE_DIR" -a -d "$CUSTOMIZE_DIR" -a -x "$CUSTOMIZE_DIR/grub" ] ; then

Also available in: Unified diff