-#!/bin/sh
+#!/bin/bash
# Filename: grml-reboot
# Purpose: reboot grml system
# Authors: grml-team (grml.org)
cd /
# Clean input/output
-exec >/dev/console 2>&1 </dev/console
+CONSOLE=/dev/console
+[ -c "$CONSOLE" ] && exec >"$CONSOLE" 2>&1 <"$CONSOLE"
# default variables
INSTALLED=false
DEVICE=""
if [ -n "$CDROM" ] ; then
DEVICE="${CDROM##/dev/}"
- DEVICE="${DEVICE%%[0-9]*}"
+ [ -d /sys/block/${DEVICE} ] || DEVICE="${DEVICE%%[0-9]*}"
if [ -n "$DEVICE" ] ; then
# is it a removable device?
[ "$(cat /sys/block/${DEVICE}/removable 2>/dev/null)" = "1" ] && REMOVABLE=true
# is it a usb device?
readlink /sys/block/${DEVICE} 2>/dev/null | grep -q '/usb' && USB_DEVICE=true
- $USB_DEVICE && USB_INFO="$(cat /sys/block/${DEVICE}/device/model 2>/dev/null)"
+ $USB_DEVICE && USB_INFO=" ($(cat /sys/block/${DEVICE}/device/model 2>/dev/null))"
fi
fi
fi