Revision 9f4b2c31 common.sh.in

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))

Also available in: Unified diff